Thoughts, information and reflections about technology

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

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:

[email protected]:~$ 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.


Similar Posts:

Leave a Reply

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

Contact me