[SOLVED] DPKG lock error unable to lock the administration directory (/var/lib/dpkg/)

Spread the love
DPKG is a package management system in Debian based systems especially used in Ubuntu, elementary Os and much more. With this, the OS is provided with GUI based software update store or Package update store for updating your packages. Sometimes we update our systems with the CLI and sometimes with the GUI what this does is, it locks the library files required by the DPKG package management. This cause an error that “unable to lock the /var/lib/dpkg” due to this you won’t be able to update your system. 

In some cases the error is caused due to incomplete installation of any package or becasuse of broken pacakges. In some cases youo run multiple update request that can also cause the same error.

DPKG directory


To Fix this error Follow these steps :

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

You can aslo use this script to automate the process (the link is given below.)

Download script (GIT)

How to run:

  • Download the script from above link.
  • Make sure to run the script as root user.
  • Rest it will do all the work and also update your system at the same time.
Scrpt is running.

 Note: Please made the necessary changes if any according to your system.


Hits: 80

1 thought on “[SOLVED] DPKG lock error unable to lock the administration directory (/var/lib/dpkg/)”

Leave a Comment