Solution to the error “Unable to lock the administration directory (/var/lib/dpkg/)”

I noticed some error when executing apt-get install and other commands with apt-get:

Unable to lock the administration directory (/var/lib/dpkg/); is another process using it?

I noticed the error on my virtual test Ubuntu Server, on which I performed various settings via apt-get install and during the execution the power was lost and the installation was not completed.

In my case, after the server was turned on, the installation continued in the background and of course apt-get commands were not accepted, so the best option for solving the error is to wait, the “top” command shows that the installation process is continuing.
Also, if auto-update is enabled, the system can install them, in this case it is advisable to wait.

If there is no time to wait, then you can unlock the directory with the command:

sudo fuser -vki /var/lib/dpkg/lock

Leave a comment

Leave a Reply