Sunday, 24 September 2017

Solved : Unable to lock the administration directory (/var/lib/dpkg/)

Sometimes when you boot into your Linux Ubuntu system and use Terminal to install any application, you will get an error saying :


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? 


This error usually means either the Software Center or the Update Manager has acquired a lock to the apt database and some process is currently running in background. Ubuntu automatically checks for any update once you boot up your system and if any update is available, the download process begins causing the above error, if at that particular instance you try using apt-get.

There are various ways to get rid of the error, most recommended of which is to allow the process to complete. Once the background task is completed, the apt resource is free and you can run it in terminal.

What if even after waiting for long, you are still seeing the error? In that case, follow the below method.

Search the process first which has acquired the lock to apt.

ps -A | grep apt-get

You will get the process id, kill that process with the below command:

sudo kill -9 <process_Id>

This will free up the apt-lock.

However, its not recommended to kill a process forcefully. 

The best way is to wait for the resource to free. You can use the below command to keep your system updated in order to avoid Unable to lock the administration directory very frequently. 

sudo apt-get update

What do you do when you see this error while using apt-get, tell us in the comments.

0 comments:

Post a Comment