February 19

0 comments

Ubuntu – Do NOT delete the lock file if you see a ‘could not get lock’ when trying to install an app.

By Christopher G Mendla

February 19, 2018

Windows 10

Last Updated on January 19, 2020 by Christopher G Mendla

I was trying to install ClamAv on two of my Ubuntu machines. I got a ‘could not get lock’ error. A lot of the posts I found said to delete /var/lib/dpkg/lock.  DO NOT DO THIS UNTIL YOU EXHAUST ALL OTHER OPTIONS.

I wanted to install clam AV.  I received the following error:

chris@chris-VirtualBox:~$ sudo apt install clamav
E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

The posts I found had a number of steps to take including deleting the lock file. I started to think about the situation. Both machines hadn’t been used in a couple of days. One is an Ubuntu laptop and the other is a virtual machine running Ubuntu under Windows 10.   It dawned on me that the problem might simply be that automatic updates had locked the lock file.

I filled up my coffee (decaf this time) and tried again. Sure enough, the installs of ClamAV and ClamTk went smoothly.

Takeaway: If you get a ‘could not lock’ error simply wait about 10 to 15 minutes and try again. It might just be the result of auto updates.

Ubuntu Desktop Operating System
guaxipo / Pixabay

Christopher G Mendla

About the author

A web developer living in Southampton, PA

Self motivated critical thinker and problem solver providing technology consulting services.

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}