How do I clear a lock so as to allow an upgrade

Bret Busby bret at busby.net
Sun Nov 13 03:21:17 UTC 2022


On 13/11/2022 10:14, Ralf Mardorf via ubuntu-users wrote:
> Hi,
> 
> next time consider to use the error message as google term, before you
> waste any thoughts with the consideration to reinstall Ubuntu.
> 
> Due to the zombie apt couldn't unlock the lock file/s anymore, hence
> checking with lsof should be redundant, but you never know.
> 
> sudo -i
> 
> lsof /var/lib/dpkg/lock
> lsof /var/lib/apt/lists/lock
> lsof /var/cache/apt/archives/lock
> lsof /var/lib/dpkg/lock-frontend
> 
> If against expectation lsof should spit out processes, kill'em all.
> 
> kill -9 [...]
> 

sudo -i
returned nothing (it did not return "nothing" - it did not return anything)

> With or without killing, remove possible existing lock files.
> 
> rm /var/lib/apt/lists/lock
> rm /var/cache/apt/archives/lock
> rm /var/lib/dpkg/lock
> rm /var/lib/dpkg/lock-frontend
> 
> Fix any unfinished installed packages.
> 
> dpkg --configure -a
> apt update
> apt full-upgrade
> 
> Regards,
> Ralf
> 
That sequence of commands appears to have worked.

Thank you.

And, yes, I should have remembered to copy the error message and paste 
it to a google search box.

As a man used to tell me, about an old Scotsman, "he had a grand memory 
for forgetting" - it seems to happen to me, also - old age...

Anyway, thank you, Ralf.

..
Bret Busby
Armadale
West Australia
(UTC+0800)
..............




More information about the ubuntu-users mailing list