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.

I have ubuntu 12.10 on my laptop. When I try to install vlc, i get this error

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?

What to do? I can't install other softwares too. Also, mp3 files don't play. It shows error that mpehg-1 layer3 decoder not found.

share|improve this question
    
how do you try to install VLC? You could e.g. have forgotten to type "sudo" in front of apt-get install. The question about mp3 files seems like a seperate problem btw. –  Nanne Nov 23 '12 at 10:31
    
if he had forgotten sudo, the error would be different (namely, complaining about insufficient permissions). The note about the mp3 question is valid anyway. @harshit-gangwar : try checking help.ubuntu.com/community/RestrictedFormats for the mp3 problem. If it doesn't help, search here for similar questions or post a new one specifically for that. –  poomerang Nov 23 '12 at 11:21
add comment

2 Answers 2

This error comes if another program is making some operations on packages (e.g. you're running an update, you have Synaptic opened, etc. ). Only one program at a time is allowed to do so.

The way the package manager ensures this, is to check if a file /var/lib/dpkg/lock exists when it starts operating. If it doesn't exist, then the program creates one. It then removes it when it finishes its operation. So if the file exists, it means that another package operation is running, or that an operation didn't finish correctly and thus didn't delete the file.

Check that the program you're using (no matter if this is Synaptic, Ubuntu Software Center or command line apt-get) is the only one open at the moment.

Try also to wait some time: Ubuntu checks periodically for updates, and if you're trying to install VLC while this is happening you might get the error. It should take maximum a few minutes (less than one with a good connection), so if after a short time you still get this error, this is not the problem.

If you have checked all the previous and you're still having the issue, there's two possibilities:

  1. there is still a dpkg process running in the background: you can easily check by opening System Monitor, looking at processes running and search for dpkg. Or, in a terminal, run ps aux | grep dpkg | grep -v grep: if you get nothing, you're sure this is not the case. If, instead, you find a dpkg process, then something is running. Try waiting. In any case, after restarting your machine the problem should not appear any longer.
  2. At some point, a package operation (installation, update, removal, or any other) crashed/failed/was incorrectly interrupted. This means that it was unable to delete the file /var/lib/dpkg/lock, as explained. In this case, you can safely remove such file. From a terminal, run sudo rm /var/lib/dpkg/lock.

After this, you should be able to install any software again

share|improve this answer
add comment

Either you have other packages which are using lock to install, or you have terminated or killed a ongoing install program for installation, which is why it is not accessing the lock, and showing this message.

Simple solution is either restart your terminal, or reboot your ubuntu.

share|improve this answer
add comment

Your Answer

 
discard

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.