Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was downloading the icedtea-7-plugin package for Ubuntu on the Terminal. I used the sudo apt-get install icedtea-7-plugin just like any other person would and I turned back to what I was doing, for I knew it was going to take some time for my connection to download the whole thing.

But I later had some urgent work to do so I put my laptop on sleep mode. I came back and saw how the download was interrupted. So I used sudo apt-get install --reinstall icedtea-7-plugin and it was giving me this error:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
enter preformatted text here
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process
using it

I went to the directory /var/lib/dpkg and tried to remove all the files by rm -f or even sudo apt-get remove icedtea-7-plugin but it gives me exactly the same error in both the cases.

What is the solution for this problem?

share|improve this question
    
@terdon It's a transliteration of my name: Parth Kohli –  Parth Kohli May 30 '13 at 14:23
    
rm: cannot remove ‘lock’: Permission denied –  Parth Kohli May 30 '13 at 14:25
    
I have not removed dpkg. I only tried to, but it gave me the same error. –  Parth Kohli May 30 '13 at 14:26
    
let us continue this discussion in chat –  Parth Kohli May 30 '13 at 14:27

1 Answer 1

up vote 1 down vote accepted

Right, the lock file is just there to stop you from running multiple dpkg processes at once. The first thing you should try is

sudo rm /var/lib/dpkg/lock

If that doesn't work, have a look at which processes are actually using apt or dpkg:

ps aux | grep 'apt\|dpkg'

Your hanged process should be one of those, you can kill it with

kill PID

where PID is its process ID number, the second field of the above ps output.

However, the easiest way to fix this would be to simply log out and log back in, or at worst, to reboot.

share|improve this answer
    
Let me try to reboot. lock is removed, but it now asks me to configure, which again is giving me an error. BRB! –  Parth Kohli May 30 '13 at 14:33
    
Unfortunately, I am not able to understand the output of the second command. –  Parth Kohli May 30 '13 at 14:36

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.