Recently I was trying to install an application using the apt command on Ubuntu when I encountered the following 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?
In fact, there is a similar error you may see:
- E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)
- E: Unable to lock directory /var/lib/apt/lists/
- 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?
Fixing “Unable to lock the administration directory (/var/lib/dpkg/)” error
You see this error because some other program is trying to update Ubuntu. When a command or application is updating the system or installing a new software, it locks the dpkg file (Debian package manager).
This locking is done so that two processes don’t change the content at the same time as it may lead to unwarranted situation and a possible broken system.
Let’s see what steps can you take to fix this issue of ‘unable to lock administration directory’.
You can now safely remove the lock files using the commands below:
After that, reconfigure the packages:
Now if you run the sudo apt update command, everything should be fine.
Troubleshooting 1: “Unable to acquire the dpkg frontend lock”
If you see an error like this:
- E: Could not get lock /var/lib/dpkg/lock-frontend – open (11: Resource temporarily unavailable)
- E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
Troubleshooting 2: “dpkg: error: dpkg frontend is locked by another process”
If you see the error “dpkg frontend is locked by another process” while running the steps in method 2, you need to one additional step.
First, find out the id of the process that is holding the lock file.
The above command will give you the details of the processes using the lock files. Use the process ID to kill this program:
Now you can remove the lock and reconfigure dpkg: