HowToSolve: Could not get lock /var/lib/dpkg/lock

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
deeniel

HowToSolve: Could not get lock /var/lib/dpkg/lock

Post by deeniel »

Hi im a newbie to linux world (also sorry for my poor english)
I installed linuxmint 2 times and both i immidatly got this error:

E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

I guess it happened to everyone at least one time, and couldnt understand what was wrong?
First let say that dpkg is the software at the base of the Debian package management system. dpkg is used to install, remove, and provide information about .deb packages ONCE at the time to avoid any kind errors between theme during these operations.
Everytime we try to do one of these dpkg creates a file in /var/lib/dpkg/ , named lock, to warn that an operation is running on some package and that other packages have to wait.
If we try so, we will get the message above, so a simply solution is to wait for that operation to finish and then we can do the new one.
But it could still happen that even if we dont have any other installation running we still get this error. Why is that?
The answer is that an installation/uninstallation/upgrading was interrupted or other problems came out.
A reboot could make everything turn back to normal but lot of other times wont.
so we could try this simple way, but be carefull and always check before that there arent any other installation/uninstallation/upgrading running:

-first we have to delet the lock file:
sudo rm /var/lib/dpkg/lock
-then we rebuild the dpkg database
sudo dpkg --configure -a
-and at the end we delete any possibile installation that didnt ended
sudo apt-get -f install

I had this problem twice and i never solved it with 1000 solution i found on the net, untill i found this written by Jessica Lambiase on an italian Ubuntu blog, and totally helped me both.
podagee

Re: HowToSolve: Could not get lock /var/lib/dpkg/lock

Post by podagee »

all i did was restart my laptop and it stopped.
accessdennied

Re: HowToSolve: Could not get lock /var/lib/dpkg/lock

Post by accessdennied »

i get an error that says

Code: Select all

accessdennied@augmentation ~ $ sudo dpkg --configure -aSetting up man-db (2.6.3-3) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing man-db (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 man-db
after running the other step(s) im trying to install something and it wont
also if i could get help one of my usb ports lost connection and when i try to use the search bar in menu cinnamon restarts also theres the prob. bout not being able to install things and uninstall
Post Reply

Return to “Tutorials”