If you try to get ubuntu update by apt-get update command and you get
these errors could not get lock /var/lib/apt/lists/lock or Could not
get lock /var/lib/dpkg/lock. I will show you how to fix this problem in
this article.
Could not get lock error happens when:
- you try to run or execute an apt command but forget to use “sudo”
- something has locked the apt database after install or remove software
- you try to use apt-get while running Ubuntu Software Center
- two apt-get commands at the same time
- run apt-get commands while applications is updating in the background automatically
You can wait for the processes to be completed, but sometimes those processes just hang there.
These applications or commands that cause could not get lock error problems.
- Apt command
- Ubuntu Software Center
- Update Manager
You will likely to see these errors
|
|
$ sudo apt-get update
Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
Unable to lock directory /var/lib/apt/lists/
|
or
|
|
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/)
|
You
can fix that problem by simply remove all of the temporary list in
/var/lib/apt/lists/ and lock file in the cache directory in
/var/cache/apt/archives/lock
|
|
$ sudo rm /var/lib/apt/lists/*
$ sudo rm /var/lib/dpkg/lock
$ sudo rm /var/cache/apt/archives/lock
|
Now we should force package to reconfig
|
|
$ sudo dpkg --configure -a
|
Now you can try to update your Ubuntu system or run Synaptic without “could not get lock” error.
No comments:
Post a Comment