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

问题描述 投票:0回答:2

我有 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)

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

发生错误,请从右键菜单运行程序包管理器或在终端中运行apt-get以查看错误。错误消息是:“错误:BrokenCount>0”。这通常意味着你安装的包有未满足的依赖关系

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

可用磁盘空间不足 升级需要磁盘“/boot”上总共有 107 M 的可用空间。请在“/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
ubuntu terminal dependencies ubuntu-18.04 apt-get
2个回答
19
投票

我很抱歉这个糟糕的问题,但我找到了解决方案

当我执行

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


0
投票

有一次我打得很糟糕,这是因为

.prerm
dpkg
脚本中的错误。我必须调试该脚本本身才能通过锁定。只需摆脱破坏的软件包就足以取消您的设置,如果您足够大胆,您可以重新安装。

如果您从

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
© www.soinside.com 2019 - 2024. All rights reserved.