Linux How-To

Repair ‘E: Couldn’t get lock /var/lib/dpkg/lock’ Error in Ubuntu [Quick Tip]

SEOClerks

Just lately I used to be making an attempt to put in an utility utilizing the apt command on Ubuntu after I encountered the next error:

E: Couldn’t get lock /var/lib/dpkg/lock – open (11: Useful resource briefly unavailable)
E: Unable to lock the administration listing (/var/lib/dpkg/), is one other course of utilizing it?

In actual fact, there’s a comparable error you might even see:

E: Couldn’t get lock /var/lib/apt/lists/lock – open (11: Useful resource briefly unavailable)
E: Unable to lock listing /var/lib/apt/lists/
E: Couldn’t get lock /var/lib/dpkg/lock – open (11: Useful resource briefly unavailable)
E: Unable to lock the administration listing (/var/lib/dpkg/), is one other course of utilizing it?

Each of those errors are similar to one other frequent Ubuntu error Unable to lock listing /var/cache/apt/archives/ and the fascinating factor is that the fixes for all these errors are comparable as effectively.

Methodology 1: Fixing Unable to lock the administration listing (/var/lib/dpkg/) error

There could possibly be many the explanation why you see this error. The primary and most blatant motive could possibly be that another course of is utilizing APT bundle administration device (apt or apt-get command in different phrases). Examine if Ubuntu Software program Heart or Synaptic Package deal Supervisor is working or not.

You too can use Linux command line to search out and kill the working course of. To do this use the command beneath:

ps aux | grep -i apt

It will present you the id of the method working apt or apt-get. Within the instance beneath, the method id is 7343. You’ll be able to ignore the final line containing ‘grep –coloration=auto’.

Kill apt process in Ubuntu

Kill apt process in Ubuntu

You need to use this course of id to kill it:

sudo kill -9

One other simpler means can be to make use of killall command. It will kill all of the cases of a working program.

sudo killall apt apt-get

Methodology 2: Additional fixing Unable to lock the administration listing (/var/lib/dpkg/) error

Usually, this could repair the issue for you normally. However my case was a bit totally different. I used to be updating my system and unintentionally closed the terminal. For that motive, there have been no processes working apt nevertheless it nonetheless confirmed me the error.

Instructed learn

How To Improve To Ubuntu 14.10 Beta From Ubuntu 14.04

On this case, the foundation trigger is the lock file. Lock recordsdata are used to forestall two or extra processes from utilizing the identical knowledge. When apt or apt-commands are run, it creates lock recordsdata in just a few locations. When the earlier apt command was not terminated correctly, the lock recordsdata weren’t deleted and therefore they forestall any new cases of apt/apt-get instructions.

To repair the issue, all it’s essential to do is to take away the lock recordsdata. You are able to do that simply utilizing the instructions beneath:

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

After that, reconfigure the packages

sudo dpkg –configure -a

Now in case you run the sudo apt replace command, all the things must be advantageous.

I hope this small tip helped you in fixing the ‘Couldn’t get lock /var/lib/dpkg/lock’ error. If in case you have questions or suggestion, please be happy to drop a remark.

Source link

Related Articles

Leave a Reply

Back to top button