Unable to obtain lock for software installation


Could not get lock /var/lib/apt/lists/lock- open (11: Resource temporarily unavailable)

Explanation of the problem:
Ubuntu uses the programs apt and dpkg for all package handling (installing, removing, updating, upgrading, etc.). To prevent multiple package management processes from running at once, apt or dpkg opens or “locks” an empty file named (appropriately) “lock”, in either /var/lib/apt/lists/ (for apt processes) or /var/lib/dpkg/ (for dpkg processes). If this file is already locked by an apt or dpkg process, no other process of that nature can run. That’s the in-depth explanation. Put shortly, you apparently have another apt or dpkg process running. This could be in the form of Synaptic Package Manager, or the USC, as they both utilize apt. Here’s brief instructions on how to remedy this.

Open a terminal and run

ps -ef | grep apt

The result will be a list of processes using apt. Kill them (all except the bottom one, called something like

cortman 3298 2798 0 15:40 pts/0 00:00:00 grep --color=auto apt

This is the grep process itself. To kill run

sudo kill -9 process_id

Substituting “process_id” for the actual id, which is a 4-5 digit number, second column from the left. If I were to kill the process given above, it would be

sudo kill -9 3298

Do the same for dpkg-

ps -ef | grep dpkg

to unlock the /var/lib/dpkg/lock file. You can now run whatever installation process you were attempting before.


Glossary of terms:

ps -ef: lists all processes
grep apt: means “find processes with apt in the description”
sudo: run the following command as root
kill -9: end the process immediately and unconditionally.


One Comment on “Unable to obtain lock for software installation”

  1. jerrrys says:

    Nice site, your now part of my collection 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s