5

Whenever I try a command, I get an error saying:

Unable to get exclusive lock

Also apt-get is busy, but I am not even running any other application.

3
  • Check if the answers on this question help: askubuntu.com/q/15433/52726
    – Alaa Ali
    Aug 29, 2014 at 14:29
  • Thank you Mr,ALI , But its still confusing and I tried some of the steps but still not able to solve , I am not able to get used to these commands as well @AlaaAli Aug 29, 2014 at 14:52
  • Pleàe restart the system and try again. Jan 18, 2019 at 10:05

2 Answers 2

4

You probably aborted an install at some time or another. The Following will release any lock you have. Just be sure you don't have software center open or are installing anything.

sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock 
sudo fuser -cuk /var/cache/apt/archives/lock; sudo rm -f /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock;sudo dpkg --configure -a
4
  • Thank you sir @scottgoodname but even this does not help :( when i type the command 'sudo fuser -cuk /var/lib/dpkg/lock' I get an error saying specified file name doesnt exist Aug 29, 2014 at 15:08
  • If the file dosen't exist, that is ok. It will only exist when it is locked. Did you try all the commands, one by one? Aug 29, 2014 at 15:15
  • Yes Sir, same issue everytime . @scottgoodname Aug 29, 2014 at 15:23
  • I didn't need all of this, but it helped me to remove /var/lib/dpkg/lock.
    – dfrankow
    Jan 19, 2019 at 21:28
1

apt-get could be busy downloading updates in the background, and will prevent you from doing any other package management action while it is doing so.

You could kill it and then try to recover the package database manually, using the following command. If any of the commands fail and reports errors - stop and read what they say and see if you can understand what to do - they usually give instructions on how to recover from an error:

sudo killall apt-get
sudo dpkg --configure -a
sudo apt-get install -f

You must log in to answer this question.

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