Insight: How To Fix “Could not get lock /var/lib/dpkg/lock – open (11 Resource temporarily unavailable)” Errors
This tutorial post is for you if you are getting following errors in your Linux system:
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?
It does says that another process might be using the /var/lib/dpkg and you have to make sure that every thing is closed or not any process is being executed or if this doesn’t work then you have to restart your system which might solve your problem.
Even restarting your system didn’t work then let’s go through the following process to fix this error.
How To Fix “Could not get lock /var/lib/dpkg/lock – open (11 Resource temporarily unavailable)” Errors
Let’s start our process by removing the apt lock file and see if that fixes this issue or not.
sudo rm /var/lib/apt/lists/lock
If you’re still getting errors related to apt
cache lock (/var/cache/apt/archives/lock
) or the dpkg
lock (/var/lib/dpkg/lock
), then remove them by running the following commands:
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
You need to reconfigure the package as well as fix any potentially broken packages:
sudo dpkg --configure -a
sudo apt install -f
In some cases you might receive the following error after trying to run sudo dpkg --configure -a
:
sudo dpkg --configure -a
dpkg: error: parsing file '/var/lib/dpkg/updates/0008' near line 0:
newline in field name '#padding'
You can remove the file creating problem like /var/lib/dpkg/updates/008 and reconfigure dpkg
sudo rm /var/lib/dpkg/updates/0008
sudo dpkg --configure -a
We hope that you are not getting any “Could not get lock /var/lib/dpkg/lock – open (11 Resource temporarily unavailable)” error now.