60

when I try to apt-get update I'm getting the below error,

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
hari
  • 601

4 Answers4

77

This just means that there is an application using apt.

First try to find out which application it is by using this command in the terminal

ps aux | grep '[a]pt'

If there is a process running using apt (like apt-get or aptitude), the best thing to do is just to let it finish what its doing. Otherwise you can kill it using

kill <PID of the process (2nd column in output of ps aux)>

After making sure there is no process or killing it, you can just remove the lock using

sudo rm /var/lib/apt/lists/lock
zwets
  • 12,770
  • 2
  • 37
  • 46
Fahad Yousuf
  • 1,264
8

You can find out which process is using the file with fuser and optionally kill it:

sudo fuser -vik -TERM /var/lib/apt/lists/lock
rubo77
  • 34,024
  • 52
  • 172
  • 299
1

This worked like a charm:

sudo service packagekit restart

Original answer: here. Detailed explanation: here.

sm10
  • 11
0

try this commad : sudo fuser -vik -TERM /var/lib/apt/lists/lock

The fuser command is a Linux utility designed to find which process is using a given file, directory, or socket. It also provides information about the user owning running that process, and the type of access.