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

I ran apt-get upgrade on my debian/testing system and now I get the error above. How can I fix this? shell transcript follows:

136 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
1 not fully installed or removed.
Need to get 182kB/143MB of archives.
After this operation, 3671kB disk space will be freed.
Do you want to continue [Y/n]? 
Get:1 http://ftp.us.debian.org testing/main libtiff4 3.9.4-3 [182kB]
Fetched 182kB in 0s (318kB/s) 
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another p
rocess: Resource temporarily unavailable
Setting up sysv-rc (2.88dsf-12) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another p
rocess: Resource temporarily unavailable
dpkg: error processing sysv-rc (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 sysv-rc
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB
localepurge: Disk space freed in /usr/share/gnome/help: 0 KiB
localepurge: Disk space freed in /usr/share/omf: 0 KiB
localepurge: Disk space freed in /usr/share/doc/kde/HTML: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)

Solution 1:

You can look at what process is locking the file with:

fuser -v /var/cache/debconf/config.dat

Depending on the program, you might want to try to terminate it with something like kill -15.

On Debian you can find fuser in the psmisc package. Install this package if you get a 'fuser: command not found' error.