我无法运行 apt-get 命令。apt --修复损坏的安装不起作用。以下软件包具有未满足的依赖项libc6-dbg和libc6-dev



我有Ubuntu 18.04 LTS(仿生海狸(。

当我运行sudo apt-get upgrade

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libc6-dbg : Depends: libc6 (= 2.27-3ubuntu1.2) but 2.27-3ubuntu1 is installed
libc6-dev : Depends: libc6 (= 2.27-3ubuntu1.2) but 2.27-3ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

然后我运行sudo apt --fix-broken install

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
libsss-nss-idmap0
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
libc6
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc6
1 upgraded, 0 newly installed, 0 to remove and 72 not upgraded.
2 not fully installed or removed.
Need to get 0 B/2,827 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: warning: files list file for package 'linux-image-5.3.0-53-generic' missing; assuming package has no files currently installed
(Reading database ... 214594 files and directories currently installed.)
Preparing to unpack .../libc6_2.27-3ubuntu1.2_amd64.deb ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing archive /var/cache/apt/archives/libc6_2.27-3ubuntu1.2_amd64.deb (--unpack):
new libc6:amd64 package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/libc6_2.27-3ubuntu1.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试过使用sudo apt-get install -f,但仍然会出现同样的错误。

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
libsss-nss-idmap0
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
libc6
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc6
1 upgraded, 0 newly installed, 0 to remove and 72 not upgraded.
2 not fully installed or removed.
Need to get 0 B/2,827 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: warning: files list file for package 'linux-image-5.3.0-53-generic' missing; assuming package has no files currently installed
(Reading database ... 214594 files and directories currently installed.)
Preparing to unpack .../libc6_2.27-3ubuntu1.2_amd64.deb ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing archive /var/cache/apt/archives/libc6_2.27-3ubuntu1.2_amd64.deb (--unpack):
new libc6:amd64 package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/libc6_2.27-3ubuntu1.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

此外,在屏幕的右上角,会出现一条通知,上面写着:

出现错误,请从右键菜单运行包管理器,或进入终端查看问题所在。错误消息为:"错误:BrokenCount>"0"。这通常意味着您安装的软件包具有未满足的依赖性

我尝试安装新的更新,但软件更新程序显示以下消息:

可用磁盘空间不足升级需要磁盘"/boot"上总共107M的可用空间。请在"/boot"上至少释放额外的49.6 M磁盘空间。您可以使用"sudo-apt-autoremove"删除旧内核,也可以在/etc/initramfs-tools/initramfs.conf中设置COMPRESS=xz以减小initramfs的大小。

我尝试sudo apt autoremove:

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libc6-dbg : Depends: libc6 (= 2.27-3ubuntu1.2) but 2.27-3ubuntu1 is installed
libc6-dev : Depends: libc6 (= 2.27-3ubuntu1.2) but 2.27-3ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

这些都是我安装的内核:

$ sudo dpkg --list | egrep -i --color 'linux-image|linux-headers'
ii  linux-headers-5.3.0-51                     5.3.0-51.44~18.04.2                              all          Header files related to Linux kernel version 5.3.0
ii  linux-headers-5.3.0-51-generic             5.3.0-51.44~18.04.2                              amd64        Linux kernel headers for version 5.3.0 on 64 bit x86 SMP
ii  linux-headers-5.3.0-53                     5.3.0-53.47~18.04.1                              all          Header files related to Linux kernel version 5.3.0
ii  linux-headers-5.3.0-53-generic             5.3.0-53.47~18.04.1                              amd64        Linux kernel headers for version 5.3.0 on 64 bit x86 SMP
ii  linux-headers-5.3.0-59                     5.3.0-59.53~18.04.1                              all          Header files related to Linux kernel version 5.3.0
ii  linux-headers-5.3.0-59-generic             5.3.0-59.53~18.04.1                              amd64        Linux kernel headers for version 5.3.0 on 64 bit x86 SMP
ii  linux-headers-generic-hwe-18.04            5.3.0.59.113                                     amd64        Generic Linux kernel headers
ri  linux-image-5.3.0-53-generic               5.3.0-53.47~18.04.1                              amd64        Signed kernel image generic
ii  linux-image-5.3.0-59-generic               5.3.0-59.53~18.04.1                              amd64        Signed kernel image generic
ii  linux-image-generic-hwe-18.04              5.3.0.59.113                                     amd64        Generic Linux kernel image

我找到了解决方案:

当我执行sudo apt --fix-broken install时,我没有看到这行:

debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable

我们必须运行这个:sudo fuser -v /var/cache/debconf/config.dat,你会看到这样的东西:

USER        PID ACCESS COMMAND
/var/cache/debconf/config.dat:
root       5346 F.... frontend

您必须运行sudo kill <PID>,其中PID是上面的数字,在本例中为sudo kill 5346

最后,运行sudo apt-get install -f,然后就可以运行sudo apt-get update

我有一次遇到这种情况很严重,是因为dpkg.prerm脚本中有一个错误。我必须调试脚本本身才能通过锁定。只要去掉坏掉的软件包就足以解开你的安装程序,如果你足够大胆的话,你可以重新安装。

如果您从apt调用,您需要通过检查调用的命令行来找到dpkg被卡住的脚本,否则您就知道了。

检查dpkg咒语:

ps aux | grep dpkg

找一条这样的线:

/bin/sh /var/lib/dpkg/info/${PACKAGE}.prerm remove

然后,您需要编辑例如/var/lib/dpkg/info/${PACKAGE}.prerm文件,以显示开始调试过程的执行情况。在编辑器中打开文件(具有root权限(,并将顶部的set -e更改为:

set -eux -o pipefail

相关内容

  • 没有找到相关文章

最新更新