APT Update not responding as expected [duplicate]
I have tried to resolve the following issue in Ubuntu, but so far have only been able to resolve the issue by rebooting my Linux box.
I was running the sudo apt update
command and soon realized that I had no internet for some reason. So I pressed the Ctrl + Z keys to stop the process. When I was sure the internet was back online, I attempted to restart the sudo apt update
command and encountered the following error:
root@myubuntu-OS:/home/root# apt update
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
Other than restarting the system, is there a way to clean up my mess and run this process again?
Ctrl + Z does not stop a process (Ctrl + C does that). Instead, it moves it to the background. You have to execute fg
command in the same terminal to move sudo apt update
back to the foreground. This is why when you tried sudo apt update
a second time it failed - the process in the background already locked apt
(only one process should be using apt
at once, so it locks it to prevent multiple processes from interfering with each other).
If you have closed this terminal then remove lock-files by
sudo rm -v /var/lib/dpkg/lock* /var/cache/apt/archives/lock
and then run
sudo apt update
again.