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?

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

1 Answer 1


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.

  • Let me try to reboot. lock is removed, but it now asks me to configure, which again is giving me an error. BRB!
    – P.K.
    May 30, 2013 at 14:33
  • Unfortunately, I am not able to understand the output of the second command.
    – P.K.
    May 30, 2013 at 14:36

You must log in to answer this question.

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