35

I am really New to UBUNTU 14.04 and whenever I try to update or install anything I get this error:

sudo apt-get update [sudo] password for trojanfm: 
E: Could not ge lock /var/lib/apt/lists/lock - open (11: Resource temporarily
unavailable)
E: Unable to lock directory /var/lib/apt/lists/ 
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?
Braiam
  • 67,791
  • 32
  • 179
  • 269
Yelmaaz
  • 451
  • 1
  • 5
  • 8
  • Probably you run 2 instances of program or you have synaptic or some another package manager. – 2707974 Apr 22 '14 at 07:41
  • 3
    Wait for few minutes because apt-get update may have been running in background. This happens when you have just started the ubuntu. Try to run apt-get update, DO NOT DELETE ANYTHING FIRST. – Drt Apr 11 '15 at 06:12
  • I found this question instead of duplicate, and also this one helped me and not the linked duplicate one. – Drt Apr 11 '15 at 06:13
  • I don't think much of any of the answers here. It might be better to find out which process has the lock and kill that process. See this for more info: http://ubuntuforums.org/showthread.php?t=1858466 – user3728501 Oct 10 '15 at 18:46

1 Answers1

65

search for processes. Since Ubuntu 16.04, "apt" is used instead of "apt-get"

ps -A | grep apt-get

or

ps -aux | grep 'apt-get'

or

ps -A | grep apt

then see if there any process running as apt-get/apt

kill that process it by using:

sudo kill -9 <process-id> 

for example if process id is 2345

sudo kill -9 2345

then run the sudo apt-get update

Edit: If you are sure that you have no instances of dpkg or apt running and you still get the message, you can just delete the file:

sudo rm /var/lib/apt/lists/lock

A lock file is just a file with zero size that indicates locking of a resource.

Update:

As of Ubuntu 16.04 release, apt-get was replaced with apt. The running process can be located with:

ps -A | grep apt
kushvarma
  • 958
  • 5
  • 8