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

Ralf Mardorf kde.lists at yahoo.com
Sun Nov 13 02:14:10 UTC 2022


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 [...]

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



More information about the ubuntu-users mailing list