Score:-1

Could not get lock /var/lib/apt/lists/lock. It is held by process 1981 (apt-get)

bh flag
mat

When I try to update packages, I am getting the following:

sudo apt-get update
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1981 (apt-get)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/lib/apt/lists/

After waiting for some time, I am getting the same issue. After losing patience I killed the process id 1981 and am getting the same issue again.

I checked the pid status with:

➜  ~ ps u --pid 1981
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      1981  0.0  0.2  13768  8448 pts/6    T+   22:34   0:00 apt-
above is the status 

Please guide me through this as I am a beginner. Any resources would be really appreciated.

Nmath avatar
ng flag
Does this answer your question? [Could not get lock /var/lib/apt/lists/lock](https://askubuntu.com/questions/335794/could-not-get-lock-var-lib-apt-lists-lock) This means something else is using apt. You need to wait for it to finish. If it doesn't, then reboot your computer. If it still doesn't resolve, delete the lock file as a last resort.
Score:-1
sa flag

It looks like your system was running an update in the background and you killed the process mid-update. I'd advise against doing this as it can break your system.

To proceed, since you already killed the process, go ahead and delete the file /var/lib/apt/lists/lock. You'll need to do it as root, so run this command: sudo rm /var/lib/apt/lists/lock.

Next, to make sure your system isn't broken and to try to fix any broken or half-installed packages, run this command: sudo apt-get -f install. This should resume where the process you killed left off, hopefully.

mat avatar
bh flag
mat
Thanks for the information , its really helpful
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.