-1

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.

Gogeta70
  • 347
mat
  • 1

1 Answers1

0

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.

Gogeta70
  • 347