Resolving apt-get error

Resolving apt-get error

Xubuntu LTS 64bit

I encountered this problem today and I managed to resolve it with a few easy steps.
Here are the error lines I got while running sudo apt-get install [package name]

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?

If you try and search with the error lines, usually someone recommends to remove the lock file and the cached lock files.
This is not recommended as your go-to solution, merely a last resort. However, there is a safer way to get it working again.

And that is…

Try and find out if there’s any processes running with the word apt, apt-get or aptitude in it.
Killing these processes is harmless, unless it’s in the middle of installing packages.

ps aux | grep apt

This will show if there are processes running with the word apt.

So using kill with the process ID eg. 3072 may resolve your problem, it did for me.

kill processID

In some cases you might need to try it with

kill -9 processID

By doing this it should kill the process(es) and maybe remove the lock.

References: Faheem Mitha on

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.