Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to Linux (installed Ubuntu for the first time yesterday), and have never dealt with any unix-based OS. I started using Linux for the sole purpose of collaborating code with my partners via git. I first needed to install jdk/jre. However, when i tried to install it, like so:

ben@ubuntu:~$ sudo apt-get install openjdk-7-jre-headless

I got this message:

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?

I cannot get git to install either, so I don't think it is a problem with the specific package I selected. Can someone explain what that error means, and how to deal with it?

Any help is greatly appreciated.

share|improve this question
Have you tried just rebooting? An error like that usually indicates that another package manager has locked the whole system. If you reboot, it should not persist. – Splinter of Chaos Jun 26 '12 at 22:18
@SplinterofChaos I'll try that, thanks. – Ben7005 Jun 26 '12 at 22:21
@Ben7005 I'd hold off on the rebooting and wait for your downloads to finish – Levon Jun 26 '12 at 22:25
3 years ago there was also this answer on askubuntu. – Survenant Lazurite Nov 29 '13 at 5:53
up vote 8 down vote accepted

Do you have the GUI package manager/or update manager programs running? If so there's a conflict, simply close those programs down and your command line should work.

share|improve this answer
I am downloading some software from the software center... I'll finish that and see if it works. – Ben7005 Jun 26 '12 at 22:22
@Ben7005 That's most likely it .. in fact trying to use both of those GUI programs at the same time will result in the same error message, so I'd not be surprised you'd get this with the command line while something else is going on. – Levon Jun 26 '12 at 22:25
That's definitely it. Only one of aptitude, apt-get, dpkg and the software centre can install at the same time. They use a lock on /var/lib/dpkg/lock to ensure that, hence the error message. – Alexios Jun 26 '12 at 23:20
Either that or one of the above frontends was /very/ rudely interrupted mid-install and its dpkg backend was still hanging on to the lock. Can sometimes happen running aptitude remotely and losing connection while dpkg was waiting for user input (eg, to tell it what to do with a modified config file) – Shadur Jun 27 '12 at 7:55
check if the lockfile exists, and if there is no dpkg/apt process running, delete it. – Arcadien Jun 27 '12 at 9:03

This should be used as last resource. If you use this carelessly you can end with a broken system. Please evaluate other answers first before trying this. You can delete the lock file with the following command:

sudo rm /var/lib/dpkg/lock

After that, try installing again.

share|improve this answer
It works on all linus distributions. Try removing it and install. – Ruban Savvy Nov 29 '13 at 4:11
It works on all distributions that use apt, not all Linuxes. It is also a pretty bad idea, as you point out, the OP should first look for running apt processes and kill them. – terdon Nov 29 '13 at 4:18
Yup @terdon I mentioned in first line that it should be done when no other solutions helps. – Ruban Savvy Nov 29 '13 at 4:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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