182

I'm trying to install the flashybrid but when I enter the apt-get install flashybrid command, I get this error:

root@user-desktop:/home/user# apt-get install flashybrid
Reading package lists... Done
Building dependency tree
Reading state information... Done
flashybrid is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up flashybrid (0.15+nmu2) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing flashybrid (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
flashybrid
E: Sub-process /usr/bin/dpkg returned an error code (1)

I also tried this one to find what is already using that file:

root@user-desktop:/home/user# lsof | grep /var/cache/debconf/config.dat
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/user/.gvfs
Output information may be incomplete.
dpkg-prec 4672 root 4rW REG 8,6 39658 1697827 /var/cache/debconf/config.dat

But I don't know how to fix this.

0

6 Answers 6

285

A solution to this locking problem is detailed in the wiki:

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

Will show you what process is holding the lock:

                     USER        PID ACCESS COMMAND
/var/cache/debconf/config.dat:
                     root      18210 F.... dpkg-preconfigu

Then you simply need to note down the PID and kill it like so:

sudo kill PID
sudo kill -9 PID  # if the first doesn't work
8
  • 10
    This worked fantastic! Thanks a bunch, I didn't know of 'fuser'!
    – stolsvik
    Jan 1, 2014 at 22:54
  • 19
    fuser also has the option switch -k which kills the found process that uses the file: sudo fuser -v -k /var/cache/debconf/config.dat will kill the process right away
    – minni
    Dec 30, 2015 at 9:30
  • 6
    This should be selected as best answer.
    – Arda
    Jan 19, 2018 at 21:12
  • Worked for me when an upgrade of Debian from Stretch to Buster accidentally got backgrounded.
    – Adambean
    Jul 19, 2019 at 18:57
  • 1
    That worked perfectly thanks. However the process holds the file after restart and I have to manually kill it after every restart. Do you have any idea? Aug 24, 2020 at 4:30
126

This is more simple one command

I just did:

sudo rm /var/cache/debconf/*.dat 

After I run the apt-get install and (I was installing curl ) and it worked restored the db manual pages.

PS: I removed something with apt-get and I did have this problem. but solved it simply thank also to @rajagenupula

9
  • I used sudo \rm -v /var/cache/debconf/*.dat Jan 27, 2014 at 5:03
  • 31
    Don't do this... you can break your system. The correct answer is to use fuser and kill the process, as in Sayed's answer below.
    – kitti
    Oct 29, 2015 at 18:30
  • 9
    Um, don't delete that. Just kill the process that has the file opened.
    – jorfus
    Dec 16, 2016 at 18:10
  • 6
    This could be very dangerous thing to do. Please see answer below Jan 27, 2017 at 9:34
  • 1
    In my case, there was no process running, so this was the only solution that worked.
    – MacroMan
    Aug 17, 2018 at 8:13
17
  1. open your terminal
  2. open the location /var/cache/debconf with gksu nautilus
  3. move (cut/paste) all of the .dat files to another backup directory.
  4. attempt to run again (will likely get a different error)
  5. restore those dat files from the aforementioned backup directory.
  6. Then try again what you were doing (should work this time).
5
  • 1
    I had a similar problem and I just deleted all the files in the debconf folder.
    – Agmenor
    Jul 16, 2012 at 22:25
  • i said there at point 3 . a file with password and with extension . ok now what you're getting . could you post them here by pastebin link .
    – Raja G
    Jul 17, 2012 at 13:07
  • same problem, I needed to remove all files in debconf folder Nov 7, 2012 at 12:11
  • i am still getting the error debconf: apt-extracttemplates failed: No such file or directory apt-extracttemplates failed
    – user106405
    Nov 8, 2012 at 9:20
  • 1
    I was getting really quite angry, saw your answer and suddenly there's progress. Thank you. Feb 1, 2014 at 11:00
15
sudo fuser -vik /var/cache/debconf/config.dat

Will display the process and ask if you want to terminate it.

0
0

There is a process still running blocking debconf. You should wait until it finish. Or find out how it got stuck, since in some cases it will be try to ask you a question but since you don't have a scope to see it. If you wait sometime and things doesn't change you may need to reboot the system, or terminate the process.

sudo kill 4672

or

sudo killall dpkg-prec

This will assure you that your database will not get damaged and will prevent further problems.

2
  • 3
    I think it's pointless to use process id 4672 in your first command example. Somebody might use that command as-is, but it won't work as he would very likely have a different process id.
    – juzzlin
    Nov 6, 2013 at 16:56
  • @user205301 that's what the second is for ;)
    – Braiam
    Nov 6, 2013 at 17:09
0

If you are getting this error in an unattended script, make sure you don't accidentally have two consecutive apt-get upgrade or apt-get dist-upgrade commands running, otherwise the second command can fail to obtain the lock and thus end up in this error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .