E: Could not get lock /var/lib/apt/lists/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.
E: Could not get lock /var/lib/dpkg/lock
E: Unable to lock the administration directory (/var/lib/dpkg/)
You can force the lock off by removing the file, but it's not
recommended without first closing the program that's holding the lock
safely, since you could cause corruption or interrupt an installation
(bad). The command provided below should close the program that holds
the lock and then remove the lock but won't protect you from install
interruption:
Ctrl + Alt + F2 (To go to tty2 session to run below commands)
fuser
-cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock
fuser
-cuk /var/cache/apt/archives/lock; sudo rm -f
/var/cache/apt/archives/lock
OR
Remove lock files directly
sudo
rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
OR
kill the process holding lock files
ps
-e | grep -e apt -e dpkg | grep -v grep
kill
[PID OF APT, DPKG]
Then Run Below Commands Perspectively
For aptitude run
apt-get -f install
For dpkg run
dpkg --configure -a
No comments:
Post a Comment