Unable To lock The Administration Directory (/var/lib/dpkg/) On Ubuntu 18.04

0
21
Unable To lock The Administration Directory (/var/lib/dpkg/)

Unable To lock The Administration Directory (/var/lib/dpkg/) On Ubuntu 18.04

I received this error while I was trying to install some packages with apt-get commands on Ubuntu 18.04 flavor of linux. If you do not care for this, it can be the cause of system failure.

First of all, You will have to remove the lock file from the location given below

Method 1 : find the any process is running

ps –A | grep apt

Or

ps aux | grep apt

If yes, kill the process

Kill -9 processnumber

remove lock file here

rm –rf /var/lib/dpkg/lock

If you do not find lock file, it can be at this locations /var/lib/apt/lists or /var/cache/apt/archives/

After running above commands, now run this commands to reconfigure

Sudo dpkg –configure –a

Finally run the sudo apt-get update

You’re done

Sponsored

LEAVE A REPLY

Please enter your comment!
Please enter your name here