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?
4
  • Probably you run 2 instances of program or you have synaptic or some another package manager.
    – 2707974
    Apr 22, 2014 at 7: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, 2015 at 6:12
  • I found this question instead of duplicate, and also this one helped me and not the linked duplicate one.
    – Drt
    Apr 11, 2015 at 6: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: ubuntuforums.org/showthread.php?t=1858466 Oct 10, 2015 at 18:46

1 Answer 1

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
7
  • I am running no other dpkg program :\
    – Yelmaaz
    Apr 22, 2014 at 7:47
  • 2
    ubuntu automatically check for updates once the system boot up, it is not you, it is the system.
    – kushvarma
    Apr 22, 2014 at 7:49
  • 6
    best way is wait for few minutes while it search for update then run your update command or kill apt-get process, and run manually. once the system boots, it automatically runs sudo apt-get update to search for latest update. :)
    – kushvarma
    Apr 22, 2014 at 7:51
  • it should work :)
    – kushvarma
    Apr 22, 2014 at 7:52
  • If the state was reached after you manually terminated an apt-get installation, then use: sudo dpkg --configure -a Jul 19, 2016 at 11:19

Not the answer you're looking for? Browse other questions tagged .