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

Unable To lock Administration, DPKG is a software at the base of the package management system for free Operating systems based on Debian. It can be used to install, remove, and update the existing Packages. Once you face dpkg lib directory lock or package error in ubuntu.

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 about this, it can be the cause of system failure.

This situation occurs when the apt process is already running or from being used by either user or system in the ubuntu. you can follow the below steps to fix this issue. 

Unable To lock Administration Directory (/var/lib/dpkg/):

When you face such an issue like unable to lock the administration directory and unable to remove or delete files as an administrator in ubuntu.

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

Check Out:  Install New Relic Infrastructure Agent

Step 1: Find if there any process running using the below commands.

ps –a | grep apt
Or
ps -aux | grep apt

Check Out: Install PlayonLinux On Ubuntu

Step 2: If you found the process, kill them using their PID.

Kill -9 processnumber

Remove lock file here, this will automatically create again.

rm –rf /var/lib/dpkg/lock

Check Out:  Installation of Ubuntu 15.10 In Vmware

Step 3: If you could not find the lock file, you may find it at this location /var/lib/apt/lists or /var/cache/apt/archives/

After running the above commands, now run these commands to reconfigure its database.

sudo dpkg –configure –a

Check Out: Install Putty On Ubuntu 18.04

Step 4: Finally run the below command to update the system.

sudo apt-get update

You’re done dpkg directory lock error package lib

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment