Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 596  / 2 Years ago, wed, july 20, 2022, 4:27:07

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?


More From » apt

 Answers
2

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.


[#980] Wednesday, July 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shionnky

Total Points: 276
Total Questions: 104
Total Answers: 108

Location: Montenegro
Member since Thu, Jun 16, 2022
2 Years ago
;