5
votes

I'm new here

I have Ubuntu 18.04 LTS

When I run 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).

Then I run 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)

I've tried to use sudo apt-get install -f, but still getting the same error

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)

Also, in the top-right corner of the screen, a notification appears saying:

An error ocurred, please run Package Manager from the right-clic menu or apt-get in a terminal to see what is wrong. The error message was: 'Error: BrokenCount>0'. This usually means that your installed packages have unmet dependencies

And I try to install the new updates but Software Updater shows this message:

Not enough free disk space The upgrade needs a total of 107 M free space on disk '/boot'. Please free at least an additional 49.6 M of disk space on '/boot'. You can remove old kernels using 'sudo apt autoremove', and you could also set COMPRESS=xz in /etc/initramfs-tools/initramfs.conf to reduce the size of your initramfs.

And I try 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).

These are all my installed kernels

$ 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
2

2 Answers

18
votes

I'm sorry for the bad question, but I found the solution

When I executed sudo apt --fix-broken install, I didn't see this line:

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

We have to run this: sudo fuser -v /var/cache/debconf/config.dat and you'll see something like this:

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

And you have to run sudo kill <PID>, where PID is the number above, in this case sudo kill 5346

Finally, run sudo apt-get install -f and then you'll be able to run sudo apt-get update

0
votes

The one time I hit this badly it was due to a bug in the .prerm script for dpkg. I had to debug that script itself to get past the lock. Just getting rid of the busted package should be sufficient to un-hork your setup and you can re-install if you're bold enough.

If you called from apt you need to find the script dpkg is stuck on by examining the command line for the invocation, otherwise you know this.

Inspect the dpkg incantations:

ps aux | grep dpkg

And look for a line like this:

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

You then want to edit the e.g. /var/lib/dpkg/info/${PACKAGE}.prerm file to show execution to start the debug process. Open the file in your editor (with root permissions) and change the set -e at the top to this:

set -eux -o pipefail