7

I'm trying to install some program on Ubuntu, but when I try it I got the following 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?

Searching on the WEB, I applied this.-

sudo lsof /var/lib/dpkg/lock
sudo kill -TERM <PID>
sudo dpkg --configure -a
sudo apt-get update && sudo apt-get upgrade

Apparently it works until the second line, but when I execute the third line the terminal doesn't answer (marks that it continues downloading a program that I tried previously to install. I left the PC works with this, one day, waiting for the end of this but nothing happened).

The previous program that I tried to install is Dropbox.

Thanks for any help.

3
  • What was the exact package name you tried to install, and the actual command you used?
    – jimm-cl
    Aug 1, 2014 at 21:00
  • Wireshark, but it happens with any package. sudo apt-get install vlc (for example)
    – ArCiGo
    Aug 1, 2014 at 21:04
  • Check for existing processes. ps aux | grep apt or ps aux | grep dpkg. Aug 1, 2014 at 21:04

2 Answers 2

7

Run the following:

fuser /var/lib/dpkg/lock /var/lib/apt/lists/lock
ls -l /var/lib/dpkg/lock /var/lib/apt/lists/lock 

If there are processes running, and any of the 2 files exist, then run:

fuser -k /var/lib/dpkg/lock /var/lib/apt/lists/lock

Then fuser will send a SIGKILL signal to each process. That should resolve the issue.


If the above does not work for you, then you may want to take a look at this:

3
  • Ok. I used it and apparently it worked, but the Dropbox is still downloading. I tried to remove Dropbox via Ubuntu Software Center and the software center show me this: Waiting to dpkg to exit. The link that you provided me I had already used and I can't solve my problem.
    – ArCiGo
    Aug 4, 2014 at 17:10
  • My solution: reinstall Ubuntu
    – ArCiGo
    Aug 5, 2014 at 17:30
  • well, that's always an option :p
    – jimm-cl
    Aug 5, 2014 at 17:32
0

If you are using Ubuntu 16.0.4 above then type below command on terminal

 ps -A | grep apt

If you are using ubuntu version less than 16.0.4 then type below command,

 ps -A | grep apt-get

It will give you the currently running process id. If you kill that process then your problem will be solved.

For killing, process try out below command:

sudo kill -TERM  process_id

e.g : sudo kill -TERM 18846

You must log in to answer this question.

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