Question / Problem
apt-get upgrade fails with
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Any ideas of what else can I try to solve or identify the problem?
Background
This is on Ubuntu 19.10.
Today I received a pop up error window while using the gui Software Updater. Sorry, I forget exactly what it said. Looking in /var/log/apt I see that an error actually occurred yesterday
Start-Date: 2020-02-18 06:24:48
Commandline: aptdaemon role='role-commit-packages' sender=':1.686'
Upgrade: dmidecode:amd64 (3.2-2, 3.2-2ubuntu0.1), libwebkit2gtk-4.0-37:amd64 (2.26.3-0ubuntu0.19.10.1, 2.26.4-0ubuntu0.19.10.1), gir1.2-webkit2-4.0:amd64 (2.26.3-0ubuntu0.19.10.1, 2.26.4-0ubuntu0.19.10.1), libjavascriptcoregtk-4.0-18:amd64 (2.26.3-0ubuntu0.19.10.1, 2.26.4-0ubuntu0.19.10.1), gir1.2-javascriptcoregtk-4.0:amd64 (2.26.3-0ubuntu0.19.10.1, 2.26.4-0ubuntu0.19.10.1)
Remove: linux-headers-5.0.0-40:amd64 (5.0.0-40.44), linux-image-5.0.0-40-generic:amd64 (5.0.0-40.44), linux-modules-extra-5.0.0-40-generic:amd64 (5.0.0-40.44), linux-headers-5.0.0-40-generic:amd64 (5.0.0-40.44), linux-modules-5.0.0-40-generic:amd64 (5.0.0-40.44)
Error: Sub-process /usr/bin/dpkg returned an error code (1)
End-Date: 2020-02-18 06:24:50
but that a subsequent ?run of the gui? completed without error
Start-Date: 2020-02-18 06:25:48
Commandline: aptdaemon role='role-commit-packages' sender=':1.686'
Upgrade: dmidecode:amd64 (3.2-2, 3.2-2ubuntu0.1), libwebkit2gtk-4.0-37:amd64 (2.26.3-0ubuntu0.19.10.1, 2.26.4-0ubuntu0.19.10.1), gir1.2-webkit2-4.0:amd64 (2.26.3-0ubuntu0.19.10.1, 2.26.4-0ubuntu0.19.10.1), libjavascriptcoregtk-4.0-18:amd64 (2.26.3-0ubuntu0.19.10.1, 2.26.4-0ubuntu0.19.10.1), gir1.2-javascriptcoregtk-4.0:amd64 (2.26.3-0ubuntu0.19.10.1, 2.26.4-0ubuntu0.19.10.1)
End-Date: 2020-02-18 06:25:50
The log entry from today's first run of the gui Software Updater is
Start-Date: 2020-02-19 06:17:37
Commandline: aptdaemon role='role-commit-packages' sender=':1.1055'
Upgrade: libsystemd0:amd64 (242-7ubuntu3.6, 242-7ubuntu3.7), udev:amd64 (242-7ubuntu3.6, 242-7ubuntu3.7), libudev1:amd64 (242-7ubuntu3.6, 242-7ubuntu3.7), systemd-sysv:amd64 (242-7ubuntu3.6, 242-7ubuntu3.7), libpam-systemd:amd64 (242-7ubuntu3.6, 242-7ubuntu3.7), systemd:amd64 (242-7ubuntu3.6, 242-7ubuntu3.7), libnss-systemd:amd64 (242-7ubuntu3.6, 242-7ubuntu3.7)
Error: Sub-process /usr/bin/dpkg returned an error code (1)
End-Date: 2020-02-19 06:17:57
apt-get upgrade fails with "/var/cache/debconf/config.dat is locked"
me@9380:/var/lib/dpkg$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
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
Setting up libpam-systemd:amd64 (242-7ubuntu3.7) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package libpam-systemd:amd64 (--configure):
installed libpam-systemd:amd64 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libpam-systemd:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
me@9380:/var/lib/dpkg$
Investigations / What I've tried
/var/cache/debconf/config.dat does not seem to be in use
me@9380:/var/lib/dpkg$ fuser -v /var/cache/debconf/config.dat
me@9380:/var/lib/dpkg$ lsof | grep config.dat
me@9380:/var/lib/dpkg$
Removing the lock file (as per this Ubuntu Forums post) didn't seem to change anything.
me@9380:/var/lib/dpkg$ sudo rm lock
me@9380:/var/lib/dpkg$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
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
Setting up libpam-systemd:amd64 (242-7ubuntu3.7) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package libpam-systemd:amd64 (--configure):
installed libpam-systemd:amd64 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libpam-systemd:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
me@9380:/var/lib/dpkg$
Recalling the problem originated with the gui Software Updater, I tried also removing lock-frontend
me@9380:/var/lib/dpkg$ sudo rm lock lock-frontend
me@9380:/var/lib/dpkg$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
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
Setting up libpam-systemd:amd64 (242-7ubuntu3.7) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package libpam-systemd:amd64 (--configure):
installed libpam-systemd:amd64 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libpam-systemd:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
me@9380:/var/lib/dpkg$
Then I tried removing the lock and lock-frontend files and using the gui Software-Updater, which resulted in a "The software on this compute is up to date" with apperently no info entered in /var/log/apt/history.log. However apt-get upgrade still results in the same problem.
me@9380:/var/lib/dpkg$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
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
Setting up libpam-systemd:amd64 (242-7ubuntu3.7) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package libpam-systemd:amd64 (--configure):
installed libpam-systemd:amd64 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libpam-systemd:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
me@9380:/var/lib/dpkg$
Trying apt -f doesn't help
me@9380:/var/lib/dpkg$ sudo rm lock lock-frontend
me@9380:/var/lib/dpkg$ sudo apt-get -f upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
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
Setting up libpam-systemd:amd64 (242-7ubuntu3.7) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package libpam-systemd:amd64 (--configure):
installed libpam-systemd:amd64 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libpam-systemd:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
me@9380:/var/lib/dpkg$