Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
semary@SemarY-PC:~$ sudo apt-get install linux-headers-generic

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?

How do I fix this?

share|improve this question

marked as duplicate by Mitch, Radu Rădeanu, Kevin Bowen, bcbc, Eric Carvalho Jun 22 '13 at 8:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 3 down vote accepted

You can use the lsof command with argument the path to the directory you cannot lock /var/lib/dpkg/ this will show you which process holds the directory locked and kill it with killall process name

Afterwards you should be able to reissue the installation command.

For more details about using lsof you can see here or in man pages or just man lsof in terminal.

share|improve this answer

This can happen is for some reason an application (apt-get software-center) dosen't release control over the update process. It gets locked down during the upgrade so you won't have more than one thing trying to update/change things at the same time.

You can fix it by sudo rm /var/lib/apt/lists/lock

share|improve this answer
    
this will do Bad Things if an application is actually using the cache because it's still running (didn't crash). –  strugee May 28 '13 at 1:23
    
Good point.. I had assumed the computer had at least been rebooted in an effort to fix the problem. –  Scott Goodgame May 28 '13 at 15:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.