apt,dpkg issue in ubuntu. Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable). Apt process stuck in the middle ?

Posted by

Are you facing  issue with service in ubuntu?

ERROR CASE :
***************************
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 may be because of apt process get stuck while executing previous command and the package manager still holding the lock and we won’t be able to run any new apt process like package installation, uninstall, etc…

Most people, will remove the lock file directly and someties success and sometimes ends up with a corrupted system. This following is the recommended way to get rid of this.

Error I received.

Finding the process using ps and lsof commands. 

For a more Clear picture, we can use pstree command.(truncated output)

You could see the parent process-id and process which is holding that lock and it’s parent and children.

We can try killing the process

**If not success we can kill using kill -9 command.

Try running apt command and it will show that package manager is broken or something as follows along with a solution.

As it says, run dpkg –configure -a .

Test whether the issue is resolved by running

I hope you are clear about the issue and this resolves it.

————————————–
If not we  can manually remove the lock file and lock in cache directory and run following commands.

Reconfigure using

……………………………………….***…………………………………………..

2 comments

  1. magnificent put up, very informative. I wonder why the opposite specialists of this sector don’t understand this.
    You should proceed your writing. I’m confident, you have a huge readers’ base
    already!

Leave a Reply

Your email address will not be published. Required fields are marked *