3

I was trying to install firefox from deb instead of firefox snap because the firefox extensions will not work in the snap version, but the system tried to re-install snap version instead. The dialog box asking to approve re-installing snap version closed without an answer and now apt is locked and cannot be unlocked.

Could not get lock /var/cache/apt/archives/lock. It is held by process 33889 (apt)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/cache/apt/archives/

I have tried killing process 33889 but it will not die! The lock file in /var/cache/apt/archives/ appears to have 0 bytes.

1
  • Reboot and then delete the lock-file.
    – MikroPower
    Oct 2, 2022 at 22:09

1 Answer 1

2

2 methodes:

sudo killall apt-get

or ...

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
2
  • sudo killall apt-get returns "no process found" sudo killall apt returns nothing (making me think it must have worked) but then using "sudo apt clean" to check if apt is working again returns the same error message quoted above.....with the dire warning not to try to rm the lock file. All of the research I did before posting indicated rm the lock file was the only other solution but I was reluctant to try because of the dire warning. But.....since there appeared to be no other option, I tried it. It seems to have worked and so far doesn't look like anything is broken. Thanks. Oct 3, 2022 at 3:03
  • Just a follow-up in case anyone has a similar problem. Apt was messed up a bit, had to follow up with "sudo dpkg --configure -a" to sort it out, then it appeared firefox (from deb) was really messed up so system demanded "sudo apt-reinstall it" before I could remove it. I then proceeded with the remove firefox-snap/install from deb (procedure is documented elsewhere) without any more problems. Oct 5, 2022 at 1:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .