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

teb*_*n30 5 terminal ubuntu dependencies apt-get ubuntu-18.04

我是新来的

我有 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).
Run Code Online (Sandbox Code Playgroud)

然后我跑 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)
Run Code Online (Sandbox Code Playgroud)

我试过使用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)
Run Code Online (Sandbox Code Playgroud)

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

发生错误,请从右键菜单中运行包管理器或在终端中运行 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).
Run Code Online (Sandbox Code Playgroud)

这些都是我安装的内核

$ 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
Run Code Online (Sandbox Code Playgroud)

teb*_*n30 18

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

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

debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Run Code Online (Sandbox Code Playgroud)

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

                     USER        PID ACCESS COMMAND
/var/cache/debconf/config.dat:
                     root       5346 F.... frontend
Run Code Online (Sandbox Code Playgroud)

并且您必须运行sudo kill <PID>,在这种情况下,PID 是上面的数字sudo kill 5346

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

  • 你是救世主。谢谢。 (2认同)