Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?
I get this error when trying to use apt-get
:
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?
How can I fix this?
apt package-management dpkg
|
show 13 more comments
I get this error when trying to use apt-get
:
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?
How can I fix this?
apt package-management dpkg
15
This is also true if you reboot? Maybe some old apt thread is locking the file, you need to find out which and kill it or just rebooting will do it.
– Bruno Pereira
Jan 29 '12 at 11:19
4
This procedure almost always fixes this problem, and when it doesn't, its output (the text from the Terminal) is sometimes useful. If you decide to do it, you can add this text to your question.
– Eliah Kagan
Jun 6 '12 at 9:10
1
I would suggest one more thing that you may note when faced with this issue. Do check if your disk drives are mounted. If they are not, you may not be able to acquire the lock as the package installer will not be able to access the filesystem. Hope this helps. :)
– Hari
Apr 6 '13 at 12:23
48
You can usesudo lsof /var/lib/dpkg/lock
to find the process that owns the lock file (if empty, assume the lock is left over from a previous boot and can besudo rm
d), then consider doing asudo kill -9 <PID>
(get <PID> fromlsof
output.
– waltinator
Mar 17 '14 at 22:01
9
This can be a sign that something else is installing or removing software and has locked the apt database while it performs the actions.
– Foreever
Feb 3 '15 at 4:32
|
show 13 more comments
I get this error when trying to use apt-get
:
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?
How can I fix this?
apt package-management dpkg
I get this error when trying to use apt-get
:
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?
How can I fix this?
apt package-management dpkg
apt package-management dpkg
edited Jul 2 '16 at 10:33
Volker Siegel
8,94043349
8,94043349
asked Nov 30 '10 at 2:12
La Ode Adam SaputraLa Ode Adam Saputra
4,7883128
4,7883128
15
This is also true if you reboot? Maybe some old apt thread is locking the file, you need to find out which and kill it or just rebooting will do it.
– Bruno Pereira
Jan 29 '12 at 11:19
4
This procedure almost always fixes this problem, and when it doesn't, its output (the text from the Terminal) is sometimes useful. If you decide to do it, you can add this text to your question.
– Eliah Kagan
Jun 6 '12 at 9:10
1
I would suggest one more thing that you may note when faced with this issue. Do check if your disk drives are mounted. If they are not, you may not be able to acquire the lock as the package installer will not be able to access the filesystem. Hope this helps. :)
– Hari
Apr 6 '13 at 12:23
48
You can usesudo lsof /var/lib/dpkg/lock
to find the process that owns the lock file (if empty, assume the lock is left over from a previous boot and can besudo rm
d), then consider doing asudo kill -9 <PID>
(get <PID> fromlsof
output.
– waltinator
Mar 17 '14 at 22:01
9
This can be a sign that something else is installing or removing software and has locked the apt database while it performs the actions.
– Foreever
Feb 3 '15 at 4:32
|
show 13 more comments
15
This is also true if you reboot? Maybe some old apt thread is locking the file, you need to find out which and kill it or just rebooting will do it.
– Bruno Pereira
Jan 29 '12 at 11:19
4
This procedure almost always fixes this problem, and when it doesn't, its output (the text from the Terminal) is sometimes useful. If you decide to do it, you can add this text to your question.
– Eliah Kagan
Jun 6 '12 at 9:10
1
I would suggest one more thing that you may note when faced with this issue. Do check if your disk drives are mounted. If they are not, you may not be able to acquire the lock as the package installer will not be able to access the filesystem. Hope this helps. :)
– Hari
Apr 6 '13 at 12:23
48
You can usesudo lsof /var/lib/dpkg/lock
to find the process that owns the lock file (if empty, assume the lock is left over from a previous boot and can besudo rm
d), then consider doing asudo kill -9 <PID>
(get <PID> fromlsof
output.
– waltinator
Mar 17 '14 at 22:01
9
This can be a sign that something else is installing or removing software and has locked the apt database while it performs the actions.
– Foreever
Feb 3 '15 at 4:32
15
15
This is also true if you reboot? Maybe some old apt thread is locking the file, you need to find out which and kill it or just rebooting will do it.
– Bruno Pereira
Jan 29 '12 at 11:19
This is also true if you reboot? Maybe some old apt thread is locking the file, you need to find out which and kill it or just rebooting will do it.
– Bruno Pereira
Jan 29 '12 at 11:19
4
4
This procedure almost always fixes this problem, and when it doesn't, its output (the text from the Terminal) is sometimes useful. If you decide to do it, you can add this text to your question.
– Eliah Kagan
Jun 6 '12 at 9:10
This procedure almost always fixes this problem, and when it doesn't, its output (the text from the Terminal) is sometimes useful. If you decide to do it, you can add this text to your question.
– Eliah Kagan
Jun 6 '12 at 9:10
1
1
I would suggest one more thing that you may note when faced with this issue. Do check if your disk drives are mounted. If they are not, you may not be able to acquire the lock as the package installer will not be able to access the filesystem. Hope this helps. :)
– Hari
Apr 6 '13 at 12:23
I would suggest one more thing that you may note when faced with this issue. Do check if your disk drives are mounted. If they are not, you may not be able to acquire the lock as the package installer will not be able to access the filesystem. Hope this helps. :)
– Hari
Apr 6 '13 at 12:23
48
48
You can use
sudo lsof /var/lib/dpkg/lock
to find the process that owns the lock file (if empty, assume the lock is left over from a previous boot and can be sudo rm
d), then consider doing a sudo kill -9 <PID>
(get <PID> from lsof
output.– waltinator
Mar 17 '14 at 22:01
You can use
sudo lsof /var/lib/dpkg/lock
to find the process that owns the lock file (if empty, assume the lock is left over from a previous boot and can be sudo rm
d), then consider doing a sudo kill -9 <PID>
(get <PID> from lsof
output.– waltinator
Mar 17 '14 at 22:01
9
9
This can be a sign that something else is installing or removing software and has locked the apt database while it performs the actions.
– Foreever
Feb 3 '15 at 4:32
This can be a sign that something else is installing or removing software and has locked the apt database while it performs the actions.
– Foreever
Feb 3 '15 at 4:32
|
show 13 more comments
21 Answers
21
active
oldest
votes
This should be used as last resort. If you use this carelessly you can end up with a broken system. Please try the other answers first before doing this.
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
After that, try opening Synaptic again.
10
ok... but why happened this?
– Jaime Hablutzel
May 26 '12 at 22:40
36
@jaime: probably apt-get (or some GUI frontend to it) was halted while executing, leaving apt in a locked state.
– bouke
Sep 13 '12 at 12:15
10
I would accept this as the best answer. correct one.
– Anwar
Apr 6 '13 at 14:37
9
@AnwarShah no, there are other considerations before going around removing files of the system.
– Braiam
Dec 31 '13 at 14:47
20
rm /var/lib/dpkg/lock; dpkg --configure -a:
– WitchCraft
Jan 15 '14 at 15:07
|
show 6 more comments
I see pretty much all the answers recommend deleting the lock. I don't recommend doing that as a first measure; maybe if there is no alternative. The lock is placed when an apt process is running, and is removed when the process completes. If there is a lock with no apparent process running, this may mean the process got stuck for some reason.
If you try
ps aux | grep apt
that will catch processes containing the word apt
, at least. If you see an apt-get
process or an aptitude
process that looks stuck, you can try
kill processnumber
and if that doesn't work try
kill -9 processnumber
This should kill the process and may remove the lock. Killing an apt
or aptitude
process is harmless unless it is actually in the middle of package installation. In any case, if the process got stuck, you probably don't have a choice but to kill it.
Killing a dpkg
process directly, if present, is not a good idea, because if dpkg
is active, it is probably manipulating the package database, and killing it may leave the package database in an inconsistent state; i.e. corrupted.
Killing an apt-get
or aptitude
process is in general much safer.
16
@Link I don't think killingdpkg
is a good idea, because usuallydpkg
is manipulating the package database directly, and this could cause corruption.
– Faheem Mitha
Sep 14 '13 at 20:17
16
If killing dpkg can corrupt its database, dpkg was badly designed. Period.
– Jay Sullivan
Nov 18 '14 at 3:36
10
for me, this resulted in an errordpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
when runningsudo apt-get dist-upgrade
again. Running the command then resolved the issue. I love Nix!
– Wayne Phipps
Jun 26 '15 at 13:17
4
Note,killall apt-get
does the same thing as yourps
/kill
combo.
– Cerin
Jan 15 '16 at 22:09
3
Note that I found that I needed to runsudo dkpg --configure -a
after killing the rogue apt process in order for things to return back to normal.
– starbeamrainbowlabs
Oct 17 '16 at 18:35
|
show 16 more comments
Remove your /var/lib/dpkg/lock
file and force package reconfiguration.
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
It should work after this.
these commands helped, but now when I tried to install again, got this reply : Could not get lock /var/cache/apt/archives/lock - open. I think I would have to do like previous unlocking problem, but please tell me the exact keywords for command. I'm an absolute beginner.
– kern
Jan 29 '12 at 11:38
1
sudo
- execute command as root,rm
- remove file. Maybe trysudo rm /var/cache/apt/archives/lock
– kubahaha
Sep 24 '12 at 13:56
4
This is not a good suggestion: blindly removing the luck may corrupt dpkg's state.
– poolie
Feb 2 '15 at 18:09
4
Why won´t it fix itself nowadays?
– Marian Klühspies
Nov 1 '16 at 12:19
2
This worked for me. The aws above didn't.
– 1rq3fea324wre
May 1 '17 at 22:53
|
show 3 more comments
You will get this message if you forget to use sudo
when executing an apt command.
Otherwise this is a sign that something else is installing or removing software and has locked the apt database while it performs the actions. The programs that can do this are:
- The Software Center
- The Update Manager
- The apt link installer (I think this now goes through SC)
- The apt-get or aptitude command line utilities.
- The Synaptic Package Manager
IMPORTANT: only try the below as a last resort since it can crash your system. First try killing any running instance of apt
or aptitude
as described in Faheem's answer.
You can force the lock off by removing the file, but it's not recommended without first closing the program that's holding the lock safely, since you could cause corruption or interrupt an installation (bad). The command provided by João should close the program that holds the lock and then remove the lock but won't protect you from install interruption:
sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock
And the same command can be used for the apt cache lock:
sudo fuser -cuk /var/cache/apt/archives/lock; sudo rm -f /var/cache/apt/archives/lock
5
I was updating my software when I got the error message.
– raindrop
Aug 16 '13 at 22:04
19
This crashed for me-
– umpirsky
Sep 21 '14 at 17:33
5
sudo fuser -cuk /var/cache/apt/archives/lock
directly rebooted my computer.apt-get
is now unlocked.
– Maxime R.
Dec 4 '14 at 21:47
14
This crashed my entire server.
– 에이바
Jan 5 '15 at 21:28
5
Killing apt or dpkg half way through is not a great idea.
– poolie
Feb 2 '15 at 18:12
|
show 10 more comments
The most likely way to hit this is:
- boot Ubuntu
- start a terminal
- type
sudo apt-get install whatever
and the command-line apt
overlaps with update-manager
automatically polling.
So if you try again in a few minutes that should fix it.
18
Great hint in contrast to the half-dozen replies suggesting to just remove the file ;-) I randomly ran in the issue and most likely this is it!
– Alex
Jan 21 '14 at 16:14
1
Safe enough, had to wait a little beforesudo apt-get install
could work.
– sargas
May 11 '15 at 17:56
Well This is not working always, yes I have used reboot many times. If it's not suitable try this askubuntu.com/a/315791/378845 before you remove locks
– Menuka Ishan
Oct 23 '16 at 7:03
@menuka, why not just let it finish.
– poolie
Dec 24 '16 at 14:38
@poolie Because there are other constraints which are stopping the process from finishing
– Menuka Ishan
Dec 24 '16 at 15:17
|
show 3 more comments
Only one program can hold the lock. Make sure that you are not running aptitude, synaptic or adept. Close the program and run it again it should work.You may either have synaptic open, or have another terminal window open running apt-get, or have the update manager running.Check it and see if any of those are running,if any of them is running close it and try again.
Try this command in terminal to find what is running
ps -e | grep -e apt -e adept | grep -v grep
Note:
If that doesn’t print anything, type the following in terminal to remove the lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
Now you can install any Packages.
9
Deleting the lock file is, what I would consider, a dangerous thing to do. If another process is locking for a valid reason - and you remove that lock file and force an install with what you were doing prior - you could seriously, in a negative way, affect your system.
– Marco Ceppi♦
Nov 30 '10 at 5:49
4
That's why i have given that in Note.If all the above fails the only way is to remove the lock.It wont cause any problem as long as dpkg and apt-get/aptitude processes aren't running
– karthick87
Nov 30 '10 at 5:55
pgrep -f 'apt|adept|dpkg'
is a lot shorter.
– Barry
Sep 12 '17 at 21:38
Thx! this works. pgrep -f 'apt|adept|dpkg' and then sudo skill (number) , kill all number and then install works!
– creator
Mar 6 '18 at 0:22
add a comment |
So far the best way to get it working without breaking a possible background running installation ( as it could happen by removing the lock file), is stopping the service using apt:
Error:
# sudo apt-get upgrade
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?`
Solution:
sudo systemctl stop apt-daily.timer
After upgrading the system I suggest re-enabling it, as the bug locking it could be fixed with the upgrade.
sudo systemctl start apt-daily.timer
I haven't verified this error gets fixed after upgrading. I'll add a new comment once I have that verified
After upgrading the system and starting the apt-daily.timer service again I'm not facing this issue so far.
– Jairelee
Feb 2 '17 at 10:41
This solved my issue, thank you.
– inkredibl
Jun 29 '17 at 9:15
This is probably the cleanest method compared to all those higher voted answers above. It worked in my case flawlessly, thank you!
– CygnusX1
Oct 25 '17 at 19:45
This worked flawlessly on 17.10 as well
– Elder Geek
Dec 6 '17 at 4:59
2
Working fine in 18.04. :)
– Naveen Kumar V
Jun 7 '18 at 2:56
|
show 1 more comment
First of all we should check what process created the lock file using lsof
:
sudo lsof /var/lib/dpkg/lock
or in another situation where /var/lib/apt/lists/lock
is problematic:
sudo lsof /var/lib/apt/lists/lock
The output will be close to something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apt-get 12127 root 4uW REG 252,1 0 86 /var/lib/apt/lists/lock
Then we should check what the commad is doing, we can find it out using ps
, pgrep
etc; the command is apt-get
so I run:
pgrep apt-get -a
The -a
switch lists the full command for me, in my case it's:
pgrep -a apt-get
12127 apt-get update
we can see that it's running update
subcommand, I could run something like this too:
ps -f 12127
which produces:
UID PID PPID C STIME TTY STAT TIME CMD
root 12127 12126 0 09:39 pts/0 S+ 0:00 apt-get update
In this case I would wait for some minute for resource to be freed and if after 2 or 3 minute problem still exist or the command was something that I didn't care about or was not harmful for system (like this apt-get update
) I send a SIGTERM
to the process:
sudo kill -15 12127
It should do the work, If it didn't I'm going to send SIGINT
this time (It's like pressing CTRL+C):
sudo kill -2 12127
If it didn't work too, we should send an SIGHUP
(kill -1
), and finally if nothing works I simply kill the process:
sudo kill -9 12127
or
sudo pkill -9 apt-get
Then I remove busy resources:
sudo rm /var/lib/apt/lists/lock
One small thing is that/var/lib/dpkg/lock
rather than/var/lib/apt/lists/lock
is the file in the question.
– Chai T. Rex
Apr 24 '17 at 21:12
@ChaiT.Rex thanks, did an update ;)
– Ravexina
Apr 24 '17 at 21:16
1
Thank the root gods that someone finally mentionspgrep
andpkill
.
– Barry
Sep 12 '17 at 21:39
1
This should be the accepted answer.
– Marwan Nabil
Jul 10 '18 at 10:31
add a comment |
This will happen if you have 'Update Manager' running in parallel for any update check or install as install process places Lock. If you're facing the same error without 'Update Manager' running you have to remove it from /var/lib/dgkg/lock
, which definitely you can't do it manually
sudo fuser -cuk /var/lib/dpkg/lock
sudo rm -f /var/lib/dpkg/lock
works fine. Taken from: https://askubuntu.com/a/15469/68707
1
This was the problem in my case!
– LondonRob
Sep 19 '14 at 13:12
1
Better solution since fuser command used to track down other process (if still alive)
– Lars Nordin
Mar 18 '15 at 11:50
add a comment |
This error may be caused by the Update Manager trying to automatically refresh the list of packages in background, usually right after your login, thus locking the directory.
In this case just wait few seconds (or more, if your last update was long ago) for it to complete or launch Update Manager to check the status.
I had this right after installing Ubuntu 16.04. Turns out that there was a background process in the Ubuntu Software Center that was waiting for me to manually install some updates.
– jvriesem
May 12 '16 at 21:16
Ditto after a fresh install of 16.04. It too much longer than "a few seconds" in my case (I had time to read this whole Q&A page!) but after refreshingps
a few times I could seedpkg
was updating a whole load of stuff and I waited patiently for it all to finish. I then ran Software Updater until everything was up-to-date before trying to install anything new.
– Charlie Joynt
Mar 2 '17 at 21:51
add a comment |
Don't be so fast to remove something, it may totally damage your system; rather wait until the currently installing or uninstalling program finishes its task and after that you will get access. If you think that there is nothing currently installing or uninstalling, then just reboot your system with the command sudo reboot
.
1
This looks like a comment rather than an answer. Could you move this instead as a comment to the answer it was responding to?
– jvriesem
May 12 '16 at 21:15
4
@jvriesem I think this is a very important answer, because the point he's making is what is missing from many other answers!
– Volker Siegel
Jul 2 '16 at 10:31
add a comment |
If you have security updates set to auto-install this will happen frequently. I literally wait 30 seconds and it fixes the issue. Just throwing this out there in case anyone else encounters this issue.
add a comment |
Just sudo rm -f /var/lib/apt/lists/lock
and try again.
apt-fast MAY be responsible for not unlocking properly; this happens sometimes when you abort apt-get
or dpkg
too.
add a comment |
In my case I just waited for several minutes and the lock has been released (looks like aptd
used to hold it). This all happened right after system boot.
add a comment |
I have had this issue numerous times. For me, it was almost always caused by apt-get or some GUI that called it getting hung for some reason. I had to kill it which left various locks in place.
The other answers bring up very good points about making sure no updates are currently running before doing anything drastic like removing lock files. However, once you are sure that's not the case, the following usually works for me. I got it by reading many answers to questions like this one.
While most or all of this is presented in the other answers, this distills the fix down to a few commands.
sudo fuser -vki /var/lib/dpkg/lock
sudo fuser -vki /var/cache/apt/archives/lock
sudo fuser -vki /var/cache/debconf/config.dat
sudo dpkg --configure -a
Use for unlocking the package system after an update of some kind crashed or terminated without finishing in some other way. These commands should be run in the order presented.
add a comment |
I don't see this answer anywhere above but on Ubuntu 16.04, I encountered this problem as well. The cause was the time on my computer was set into the future. (This is because I'm on a Windows+Ubuntu dual boot system and I guess I have messed up local time vs UTC time.)
One odd thing was that the locked file's date and time was the exact date and time that I ran the program.
I then used "fuser" as described in earlier posts and apt worked, but I was getting complaints about needing to run dpkg -a -reconfigure
. When I did that, I got errors like:
newline in field name #padding
in files like '/var/lib/dpkg/updates/0003'.
All of this was very strange as I've never seen it before. So, I thought these were symptoms and changed my data and time manually. I knew there was a problem with the date/time when I logged in, but was ignoring it. (Previously, it was setting it automatically via the Internet and NTP).
Then, all of the above problems were fixed... Hopefully, this helps someone else! The most notable symptom is perhaps the date/time of the lock file being the exact date/time that you are trying to run the command.
add a comment |
In my case, X crashed while apt-get
was still removing old kernels. I used the System Monitor to confirm it was still running and not stuck. Everything was fine once the process finished.
add a comment |
In my case I was getting the same message by not realizing I had switched to root user and was trying sudo apt-get. Once I realized this I just ran apt-get, and it worked. Silly, but it might still explain the error for some.
2
That's not the cause of the issue, since you can runsudo
as root (and even if you couldn't, it wouldn't produce this error message). More likely what happened was that the other process finished while you were writing the next command.
– wjandrea
Oct 24 '17 at 5:06
Sometimes it does produce that same error message.
– karel
Dec 23 '17 at 0:31
add a comment |
Check the Launcher to see if Software Updater
is running. If so maximize it and have a look at what it is doing. If it is still checking, then wait for it to complete. When it completes it might tell you the software is up-to-date so close the app. If it says there are updates available, either do the update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
If Software Updater
is not running, just use the Dash to invoke it and the wait for completion and then decide if you want to update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
add a comment |
sudo killall -9 apt && sudo killall -9 dpkg
Use at your own risk
add a comment |
in my case, after:
- Open Firefox.
- Open terminal
I typed
sudo apt update
sudp apt upgrade
then I get that problems
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
I fixed that, running the command that was showed me after run
sudo apt update
apt list --upgradable
This command will show you a list of programs in my case only Firefox, I closed Firefox, then could ran the command again without problems.
sudo apt upgrade
add a comment |
protected by muru Feb 2 '17 at 10:09
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
21 Answers
21
active
oldest
votes
21 Answers
21
active
oldest
votes
active
oldest
votes
active
oldest
votes
This should be used as last resort. If you use this carelessly you can end up with a broken system. Please try the other answers first before doing this.
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
After that, try opening Synaptic again.
10
ok... but why happened this?
– Jaime Hablutzel
May 26 '12 at 22:40
36
@jaime: probably apt-get (or some GUI frontend to it) was halted while executing, leaving apt in a locked state.
– bouke
Sep 13 '12 at 12:15
10
I would accept this as the best answer. correct one.
– Anwar
Apr 6 '13 at 14:37
9
@AnwarShah no, there are other considerations before going around removing files of the system.
– Braiam
Dec 31 '13 at 14:47
20
rm /var/lib/dpkg/lock; dpkg --configure -a:
– WitchCraft
Jan 15 '14 at 15:07
|
show 6 more comments
This should be used as last resort. If you use this carelessly you can end up with a broken system. Please try the other answers first before doing this.
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
After that, try opening Synaptic again.
10
ok... but why happened this?
– Jaime Hablutzel
May 26 '12 at 22:40
36
@jaime: probably apt-get (or some GUI frontend to it) was halted while executing, leaving apt in a locked state.
– bouke
Sep 13 '12 at 12:15
10
I would accept this as the best answer. correct one.
– Anwar
Apr 6 '13 at 14:37
9
@AnwarShah no, there are other considerations before going around removing files of the system.
– Braiam
Dec 31 '13 at 14:47
20
rm /var/lib/dpkg/lock; dpkg --configure -a:
– WitchCraft
Jan 15 '14 at 15:07
|
show 6 more comments
This should be used as last resort. If you use this carelessly you can end up with a broken system. Please try the other answers first before doing this.
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
After that, try opening Synaptic again.
This should be used as last resort. If you use this carelessly you can end up with a broken system. Please try the other answers first before doing this.
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
After that, try opening Synaptic again.
edited Dec 6 '17 at 5:01
Elder Geek
26.5k952126
26.5k952126
answered Feb 7 '12 at 2:22
zurdozurdo
8,92111621
8,92111621
10
ok... but why happened this?
– Jaime Hablutzel
May 26 '12 at 22:40
36
@jaime: probably apt-get (or some GUI frontend to it) was halted while executing, leaving apt in a locked state.
– bouke
Sep 13 '12 at 12:15
10
I would accept this as the best answer. correct one.
– Anwar
Apr 6 '13 at 14:37
9
@AnwarShah no, there are other considerations before going around removing files of the system.
– Braiam
Dec 31 '13 at 14:47
20
rm /var/lib/dpkg/lock; dpkg --configure -a:
– WitchCraft
Jan 15 '14 at 15:07
|
show 6 more comments
10
ok... but why happened this?
– Jaime Hablutzel
May 26 '12 at 22:40
36
@jaime: probably apt-get (or some GUI frontend to it) was halted while executing, leaving apt in a locked state.
– bouke
Sep 13 '12 at 12:15
10
I would accept this as the best answer. correct one.
– Anwar
Apr 6 '13 at 14:37
9
@AnwarShah no, there are other considerations before going around removing files of the system.
– Braiam
Dec 31 '13 at 14:47
20
rm /var/lib/dpkg/lock; dpkg --configure -a:
– WitchCraft
Jan 15 '14 at 15:07
10
10
ok... but why happened this?
– Jaime Hablutzel
May 26 '12 at 22:40
ok... but why happened this?
– Jaime Hablutzel
May 26 '12 at 22:40
36
36
@jaime: probably apt-get (or some GUI frontend to it) was halted while executing, leaving apt in a locked state.
– bouke
Sep 13 '12 at 12:15
@jaime: probably apt-get (or some GUI frontend to it) was halted while executing, leaving apt in a locked state.
– bouke
Sep 13 '12 at 12:15
10
10
I would accept this as the best answer. correct one.
– Anwar
Apr 6 '13 at 14:37
I would accept this as the best answer. correct one.
– Anwar
Apr 6 '13 at 14:37
9
9
@AnwarShah no, there are other considerations before going around removing files of the system.
– Braiam
Dec 31 '13 at 14:47
@AnwarShah no, there are other considerations before going around removing files of the system.
– Braiam
Dec 31 '13 at 14:47
20
20
rm /var/lib/dpkg/lock; dpkg --configure -a:
– WitchCraft
Jan 15 '14 at 15:07
rm /var/lib/dpkg/lock; dpkg --configure -a:
– WitchCraft
Jan 15 '14 at 15:07
|
show 6 more comments
I see pretty much all the answers recommend deleting the lock. I don't recommend doing that as a first measure; maybe if there is no alternative. The lock is placed when an apt process is running, and is removed when the process completes. If there is a lock with no apparent process running, this may mean the process got stuck for some reason.
If you try
ps aux | grep apt
that will catch processes containing the word apt
, at least. If you see an apt-get
process or an aptitude
process that looks stuck, you can try
kill processnumber
and if that doesn't work try
kill -9 processnumber
This should kill the process and may remove the lock. Killing an apt
or aptitude
process is harmless unless it is actually in the middle of package installation. In any case, if the process got stuck, you probably don't have a choice but to kill it.
Killing a dpkg
process directly, if present, is not a good idea, because if dpkg
is active, it is probably manipulating the package database, and killing it may leave the package database in an inconsistent state; i.e. corrupted.
Killing an apt-get
or aptitude
process is in general much safer.
16
@Link I don't think killingdpkg
is a good idea, because usuallydpkg
is manipulating the package database directly, and this could cause corruption.
– Faheem Mitha
Sep 14 '13 at 20:17
16
If killing dpkg can corrupt its database, dpkg was badly designed. Period.
– Jay Sullivan
Nov 18 '14 at 3:36
10
for me, this resulted in an errordpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
when runningsudo apt-get dist-upgrade
again. Running the command then resolved the issue. I love Nix!
– Wayne Phipps
Jun 26 '15 at 13:17
4
Note,killall apt-get
does the same thing as yourps
/kill
combo.
– Cerin
Jan 15 '16 at 22:09
3
Note that I found that I needed to runsudo dkpg --configure -a
after killing the rogue apt process in order for things to return back to normal.
– starbeamrainbowlabs
Oct 17 '16 at 18:35
|
show 16 more comments
I see pretty much all the answers recommend deleting the lock. I don't recommend doing that as a first measure; maybe if there is no alternative. The lock is placed when an apt process is running, and is removed when the process completes. If there is a lock with no apparent process running, this may mean the process got stuck for some reason.
If you try
ps aux | grep apt
that will catch processes containing the word apt
, at least. If you see an apt-get
process or an aptitude
process that looks stuck, you can try
kill processnumber
and if that doesn't work try
kill -9 processnumber
This should kill the process and may remove the lock. Killing an apt
or aptitude
process is harmless unless it is actually in the middle of package installation. In any case, if the process got stuck, you probably don't have a choice but to kill it.
Killing a dpkg
process directly, if present, is not a good idea, because if dpkg
is active, it is probably manipulating the package database, and killing it may leave the package database in an inconsistent state; i.e. corrupted.
Killing an apt-get
or aptitude
process is in general much safer.
16
@Link I don't think killingdpkg
is a good idea, because usuallydpkg
is manipulating the package database directly, and this could cause corruption.
– Faheem Mitha
Sep 14 '13 at 20:17
16
If killing dpkg can corrupt its database, dpkg was badly designed. Period.
– Jay Sullivan
Nov 18 '14 at 3:36
10
for me, this resulted in an errordpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
when runningsudo apt-get dist-upgrade
again. Running the command then resolved the issue. I love Nix!
– Wayne Phipps
Jun 26 '15 at 13:17
4
Note,killall apt-get
does the same thing as yourps
/kill
combo.
– Cerin
Jan 15 '16 at 22:09
3
Note that I found that I needed to runsudo dkpg --configure -a
after killing the rogue apt process in order for things to return back to normal.
– starbeamrainbowlabs
Oct 17 '16 at 18:35
|
show 16 more comments
I see pretty much all the answers recommend deleting the lock. I don't recommend doing that as a first measure; maybe if there is no alternative. The lock is placed when an apt process is running, and is removed when the process completes. If there is a lock with no apparent process running, this may mean the process got stuck for some reason.
If you try
ps aux | grep apt
that will catch processes containing the word apt
, at least. If you see an apt-get
process or an aptitude
process that looks stuck, you can try
kill processnumber
and if that doesn't work try
kill -9 processnumber
This should kill the process and may remove the lock. Killing an apt
or aptitude
process is harmless unless it is actually in the middle of package installation. In any case, if the process got stuck, you probably don't have a choice but to kill it.
Killing a dpkg
process directly, if present, is not a good idea, because if dpkg
is active, it is probably manipulating the package database, and killing it may leave the package database in an inconsistent state; i.e. corrupted.
Killing an apt-get
or aptitude
process is in general much safer.
I see pretty much all the answers recommend deleting the lock. I don't recommend doing that as a first measure; maybe if there is no alternative. The lock is placed when an apt process is running, and is removed when the process completes. If there is a lock with no apparent process running, this may mean the process got stuck for some reason.
If you try
ps aux | grep apt
that will catch processes containing the word apt
, at least. If you see an apt-get
process or an aptitude
process that looks stuck, you can try
kill processnumber
and if that doesn't work try
kill -9 processnumber
This should kill the process and may remove the lock. Killing an apt
or aptitude
process is harmless unless it is actually in the middle of package installation. In any case, if the process got stuck, you probably don't have a choice but to kill it.
Killing a dpkg
process directly, if present, is not a good idea, because if dpkg
is active, it is probably manipulating the package database, and killing it may leave the package database in an inconsistent state; i.e. corrupted.
Killing an apt-get
or aptitude
process is in general much safer.
edited Feb 13 '16 at 14:04
answered Jul 3 '13 at 9:01
Faheem MithaFaheem Mitha
6,15411013
6,15411013
16
@Link I don't think killingdpkg
is a good idea, because usuallydpkg
is manipulating the package database directly, and this could cause corruption.
– Faheem Mitha
Sep 14 '13 at 20:17
16
If killing dpkg can corrupt its database, dpkg was badly designed. Period.
– Jay Sullivan
Nov 18 '14 at 3:36
10
for me, this resulted in an errordpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
when runningsudo apt-get dist-upgrade
again. Running the command then resolved the issue. I love Nix!
– Wayne Phipps
Jun 26 '15 at 13:17
4
Note,killall apt-get
does the same thing as yourps
/kill
combo.
– Cerin
Jan 15 '16 at 22:09
3
Note that I found that I needed to runsudo dkpg --configure -a
after killing the rogue apt process in order for things to return back to normal.
– starbeamrainbowlabs
Oct 17 '16 at 18:35
|
show 16 more comments
16
@Link I don't think killingdpkg
is a good idea, because usuallydpkg
is manipulating the package database directly, and this could cause corruption.
– Faheem Mitha
Sep 14 '13 at 20:17
16
If killing dpkg can corrupt its database, dpkg was badly designed. Period.
– Jay Sullivan
Nov 18 '14 at 3:36
10
for me, this resulted in an errordpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
when runningsudo apt-get dist-upgrade
again. Running the command then resolved the issue. I love Nix!
– Wayne Phipps
Jun 26 '15 at 13:17
4
Note,killall apt-get
does the same thing as yourps
/kill
combo.
– Cerin
Jan 15 '16 at 22:09
3
Note that I found that I needed to runsudo dkpg --configure -a
after killing the rogue apt process in order for things to return back to normal.
– starbeamrainbowlabs
Oct 17 '16 at 18:35
16
16
@Link I don't think killing
dpkg
is a good idea, because usually dpkg
is manipulating the package database directly, and this could cause corruption.– Faheem Mitha
Sep 14 '13 at 20:17
@Link I don't think killing
dpkg
is a good idea, because usually dpkg
is manipulating the package database directly, and this could cause corruption.– Faheem Mitha
Sep 14 '13 at 20:17
16
16
If killing dpkg can corrupt its database, dpkg was badly designed. Period.
– Jay Sullivan
Nov 18 '14 at 3:36
If killing dpkg can corrupt its database, dpkg was badly designed. Period.
– Jay Sullivan
Nov 18 '14 at 3:36
10
10
for me, this resulted in an error
dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
when running sudo apt-get dist-upgrade
again. Running the command then resolved the issue. I love Nix!– Wayne Phipps
Jun 26 '15 at 13:17
for me, this resulted in an error
dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
when running sudo apt-get dist-upgrade
again. Running the command then resolved the issue. I love Nix!– Wayne Phipps
Jun 26 '15 at 13:17
4
4
Note,
killall apt-get
does the same thing as your ps
/kill
combo.– Cerin
Jan 15 '16 at 22:09
Note,
killall apt-get
does the same thing as your ps
/kill
combo.– Cerin
Jan 15 '16 at 22:09
3
3
Note that I found that I needed to run
sudo dkpg --configure -a
after killing the rogue apt process in order for things to return back to normal.– starbeamrainbowlabs
Oct 17 '16 at 18:35
Note that I found that I needed to run
sudo dkpg --configure -a
after killing the rogue apt process in order for things to return back to normal.– starbeamrainbowlabs
Oct 17 '16 at 18:35
|
show 16 more comments
Remove your /var/lib/dpkg/lock
file and force package reconfiguration.
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
It should work after this.
these commands helped, but now when I tried to install again, got this reply : Could not get lock /var/cache/apt/archives/lock - open. I think I would have to do like previous unlocking problem, but please tell me the exact keywords for command. I'm an absolute beginner.
– kern
Jan 29 '12 at 11:38
1
sudo
- execute command as root,rm
- remove file. Maybe trysudo rm /var/cache/apt/archives/lock
– kubahaha
Sep 24 '12 at 13:56
4
This is not a good suggestion: blindly removing the luck may corrupt dpkg's state.
– poolie
Feb 2 '15 at 18:09
4
Why won´t it fix itself nowadays?
– Marian Klühspies
Nov 1 '16 at 12:19
2
This worked for me. The aws above didn't.
– 1rq3fea324wre
May 1 '17 at 22:53
|
show 3 more comments
Remove your /var/lib/dpkg/lock
file and force package reconfiguration.
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
It should work after this.
these commands helped, but now when I tried to install again, got this reply : Could not get lock /var/cache/apt/archives/lock - open. I think I would have to do like previous unlocking problem, but please tell me the exact keywords for command. I'm an absolute beginner.
– kern
Jan 29 '12 at 11:38
1
sudo
- execute command as root,rm
- remove file. Maybe trysudo rm /var/cache/apt/archives/lock
– kubahaha
Sep 24 '12 at 13:56
4
This is not a good suggestion: blindly removing the luck may corrupt dpkg's state.
– poolie
Feb 2 '15 at 18:09
4
Why won´t it fix itself nowadays?
– Marian Klühspies
Nov 1 '16 at 12:19
2
This worked for me. The aws above didn't.
– 1rq3fea324wre
May 1 '17 at 22:53
|
show 3 more comments
Remove your /var/lib/dpkg/lock
file and force package reconfiguration.
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
It should work after this.
Remove your /var/lib/dpkg/lock
file and force package reconfiguration.
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
It should work after this.
answered Jan 29 '12 at 11:27
Bruno PereiraBruno Pereira
59.7k26179206
59.7k26179206
these commands helped, but now when I tried to install again, got this reply : Could not get lock /var/cache/apt/archives/lock - open. I think I would have to do like previous unlocking problem, but please tell me the exact keywords for command. I'm an absolute beginner.
– kern
Jan 29 '12 at 11:38
1
sudo
- execute command as root,rm
- remove file. Maybe trysudo rm /var/cache/apt/archives/lock
– kubahaha
Sep 24 '12 at 13:56
4
This is not a good suggestion: blindly removing the luck may corrupt dpkg's state.
– poolie
Feb 2 '15 at 18:09
4
Why won´t it fix itself nowadays?
– Marian Klühspies
Nov 1 '16 at 12:19
2
This worked for me. The aws above didn't.
– 1rq3fea324wre
May 1 '17 at 22:53
|
show 3 more comments
these commands helped, but now when I tried to install again, got this reply : Could not get lock /var/cache/apt/archives/lock - open. I think I would have to do like previous unlocking problem, but please tell me the exact keywords for command. I'm an absolute beginner.
– kern
Jan 29 '12 at 11:38
1
sudo
- execute command as root,rm
- remove file. Maybe trysudo rm /var/cache/apt/archives/lock
– kubahaha
Sep 24 '12 at 13:56
4
This is not a good suggestion: blindly removing the luck may corrupt dpkg's state.
– poolie
Feb 2 '15 at 18:09
4
Why won´t it fix itself nowadays?
– Marian Klühspies
Nov 1 '16 at 12:19
2
This worked for me. The aws above didn't.
– 1rq3fea324wre
May 1 '17 at 22:53
these commands helped, but now when I tried to install again, got this reply : Could not get lock /var/cache/apt/archives/lock - open. I think I would have to do like previous unlocking problem, but please tell me the exact keywords for command. I'm an absolute beginner.
– kern
Jan 29 '12 at 11:38
these commands helped, but now when I tried to install again, got this reply : Could not get lock /var/cache/apt/archives/lock - open. I think I would have to do like previous unlocking problem, but please tell me the exact keywords for command. I'm an absolute beginner.
– kern
Jan 29 '12 at 11:38
1
1
sudo
- execute command as root, rm
- remove file. Maybe try sudo rm /var/cache/apt/archives/lock
– kubahaha
Sep 24 '12 at 13:56
sudo
- execute command as root, rm
- remove file. Maybe try sudo rm /var/cache/apt/archives/lock
– kubahaha
Sep 24 '12 at 13:56
4
4
This is not a good suggestion: blindly removing the luck may corrupt dpkg's state.
– poolie
Feb 2 '15 at 18:09
This is not a good suggestion: blindly removing the luck may corrupt dpkg's state.
– poolie
Feb 2 '15 at 18:09
4
4
Why won´t it fix itself nowadays?
– Marian Klühspies
Nov 1 '16 at 12:19
Why won´t it fix itself nowadays?
– Marian Klühspies
Nov 1 '16 at 12:19
2
2
This worked for me. The aws above didn't.
– 1rq3fea324wre
May 1 '17 at 22:53
This worked for me. The aws above didn't.
– 1rq3fea324wre
May 1 '17 at 22:53
|
show 3 more comments
You will get this message if you forget to use sudo
when executing an apt command.
Otherwise this is a sign that something else is installing or removing software and has locked the apt database while it performs the actions. The programs that can do this are:
- The Software Center
- The Update Manager
- The apt link installer (I think this now goes through SC)
- The apt-get or aptitude command line utilities.
- The Synaptic Package Manager
IMPORTANT: only try the below as a last resort since it can crash your system. First try killing any running instance of apt
or aptitude
as described in Faheem's answer.
You can force the lock off by removing the file, but it's not recommended without first closing the program that's holding the lock safely, since you could cause corruption or interrupt an installation (bad). The command provided by João should close the program that holds the lock and then remove the lock but won't protect you from install interruption:
sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock
And the same command can be used for the apt cache lock:
sudo fuser -cuk /var/cache/apt/archives/lock; sudo rm -f /var/cache/apt/archives/lock
5
I was updating my software when I got the error message.
– raindrop
Aug 16 '13 at 22:04
19
This crashed for me-
– umpirsky
Sep 21 '14 at 17:33
5
sudo fuser -cuk /var/cache/apt/archives/lock
directly rebooted my computer.apt-get
is now unlocked.
– Maxime R.
Dec 4 '14 at 21:47
14
This crashed my entire server.
– 에이바
Jan 5 '15 at 21:28
5
Killing apt or dpkg half way through is not a great idea.
– poolie
Feb 2 '15 at 18:12
|
show 10 more comments
You will get this message if you forget to use sudo
when executing an apt command.
Otherwise this is a sign that something else is installing or removing software and has locked the apt database while it performs the actions. The programs that can do this are:
- The Software Center
- The Update Manager
- The apt link installer (I think this now goes through SC)
- The apt-get or aptitude command line utilities.
- The Synaptic Package Manager
IMPORTANT: only try the below as a last resort since it can crash your system. First try killing any running instance of apt
or aptitude
as described in Faheem's answer.
You can force the lock off by removing the file, but it's not recommended without first closing the program that's holding the lock safely, since you could cause corruption or interrupt an installation (bad). The command provided by João should close the program that holds the lock and then remove the lock but won't protect you from install interruption:
sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock
And the same command can be used for the apt cache lock:
sudo fuser -cuk /var/cache/apt/archives/lock; sudo rm -f /var/cache/apt/archives/lock
5
I was updating my software when I got the error message.
– raindrop
Aug 16 '13 at 22:04
19
This crashed for me-
– umpirsky
Sep 21 '14 at 17:33
5
sudo fuser -cuk /var/cache/apt/archives/lock
directly rebooted my computer.apt-get
is now unlocked.
– Maxime R.
Dec 4 '14 at 21:47
14
This crashed my entire server.
– 에이바
Jan 5 '15 at 21:28
5
Killing apt or dpkg half way through is not a great idea.
– poolie
Feb 2 '15 at 18:12
|
show 10 more comments
You will get this message if you forget to use sudo
when executing an apt command.
Otherwise this is a sign that something else is installing or removing software and has locked the apt database while it performs the actions. The programs that can do this are:
- The Software Center
- The Update Manager
- The apt link installer (I think this now goes through SC)
- The apt-get or aptitude command line utilities.
- The Synaptic Package Manager
IMPORTANT: only try the below as a last resort since it can crash your system. First try killing any running instance of apt
or aptitude
as described in Faheem's answer.
You can force the lock off by removing the file, but it's not recommended without first closing the program that's holding the lock safely, since you could cause corruption or interrupt an installation (bad). The command provided by João should close the program that holds the lock and then remove the lock but won't protect you from install interruption:
sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock
And the same command can be used for the apt cache lock:
sudo fuser -cuk /var/cache/apt/archives/lock; sudo rm -f /var/cache/apt/archives/lock
You will get this message if you forget to use sudo
when executing an apt command.
Otherwise this is a sign that something else is installing or removing software and has locked the apt database while it performs the actions. The programs that can do this are:
- The Software Center
- The Update Manager
- The apt link installer (I think this now goes through SC)
- The apt-get or aptitude command line utilities.
- The Synaptic Package Manager
IMPORTANT: only try the below as a last resort since it can crash your system. First try killing any running instance of apt
or aptitude
as described in Faheem's answer.
You can force the lock off by removing the file, but it's not recommended without first closing the program that's holding the lock safely, since you could cause corruption or interrupt an installation (bad). The command provided by João should close the program that holds the lock and then remove the lock but won't protect you from install interruption:
sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock
And the same command can be used for the apt cache lock:
sudo fuser -cuk /var/cache/apt/archives/lock; sudo rm -f /var/cache/apt/archives/lock
edited Jan 16 '18 at 0:28
wjandrea
8,50742259
8,50742259
answered Nov 30 '10 at 2:17
Martin Owens -doctormo-Martin Owens -doctormo-
17.6k45296
17.6k45296
5
I was updating my software when I got the error message.
– raindrop
Aug 16 '13 at 22:04
19
This crashed for me-
– umpirsky
Sep 21 '14 at 17:33
5
sudo fuser -cuk /var/cache/apt/archives/lock
directly rebooted my computer.apt-get
is now unlocked.
– Maxime R.
Dec 4 '14 at 21:47
14
This crashed my entire server.
– 에이바
Jan 5 '15 at 21:28
5
Killing apt or dpkg half way through is not a great idea.
– poolie
Feb 2 '15 at 18:12
|
show 10 more comments
5
I was updating my software when I got the error message.
– raindrop
Aug 16 '13 at 22:04
19
This crashed for me-
– umpirsky
Sep 21 '14 at 17:33
5
sudo fuser -cuk /var/cache/apt/archives/lock
directly rebooted my computer.apt-get
is now unlocked.
– Maxime R.
Dec 4 '14 at 21:47
14
This crashed my entire server.
– 에이바
Jan 5 '15 at 21:28
5
Killing apt or dpkg half way through is not a great idea.
– poolie
Feb 2 '15 at 18:12
5
5
I was updating my software when I got the error message.
– raindrop
Aug 16 '13 at 22:04
I was updating my software when I got the error message.
– raindrop
Aug 16 '13 at 22:04
19
19
This crashed for me-
– umpirsky
Sep 21 '14 at 17:33
This crashed for me-
– umpirsky
Sep 21 '14 at 17:33
5
5
sudo fuser -cuk /var/cache/apt/archives/lock
directly rebooted my computer. apt-get
is now unlocked.– Maxime R.
Dec 4 '14 at 21:47
sudo fuser -cuk /var/cache/apt/archives/lock
directly rebooted my computer. apt-get
is now unlocked.– Maxime R.
Dec 4 '14 at 21:47
14
14
This crashed my entire server.
– 에이바
Jan 5 '15 at 21:28
This crashed my entire server.
– 에이바
Jan 5 '15 at 21:28
5
5
Killing apt or dpkg half way through is not a great idea.
– poolie
Feb 2 '15 at 18:12
Killing apt or dpkg half way through is not a great idea.
– poolie
Feb 2 '15 at 18:12
|
show 10 more comments
The most likely way to hit this is:
- boot Ubuntu
- start a terminal
- type
sudo apt-get install whatever
and the command-line apt
overlaps with update-manager
automatically polling.
So if you try again in a few minutes that should fix it.
18
Great hint in contrast to the half-dozen replies suggesting to just remove the file ;-) I randomly ran in the issue and most likely this is it!
– Alex
Jan 21 '14 at 16:14
1
Safe enough, had to wait a little beforesudo apt-get install
could work.
– sargas
May 11 '15 at 17:56
Well This is not working always, yes I have used reboot many times. If it's not suitable try this askubuntu.com/a/315791/378845 before you remove locks
– Menuka Ishan
Oct 23 '16 at 7:03
@menuka, why not just let it finish.
– poolie
Dec 24 '16 at 14:38
@poolie Because there are other constraints which are stopping the process from finishing
– Menuka Ishan
Dec 24 '16 at 15:17
|
show 3 more comments
The most likely way to hit this is:
- boot Ubuntu
- start a terminal
- type
sudo apt-get install whatever
and the command-line apt
overlaps with update-manager
automatically polling.
So if you try again in a few minutes that should fix it.
18
Great hint in contrast to the half-dozen replies suggesting to just remove the file ;-) I randomly ran in the issue and most likely this is it!
– Alex
Jan 21 '14 at 16:14
1
Safe enough, had to wait a little beforesudo apt-get install
could work.
– sargas
May 11 '15 at 17:56
Well This is not working always, yes I have used reboot many times. If it's not suitable try this askubuntu.com/a/315791/378845 before you remove locks
– Menuka Ishan
Oct 23 '16 at 7:03
@menuka, why not just let it finish.
– poolie
Dec 24 '16 at 14:38
@poolie Because there are other constraints which are stopping the process from finishing
– Menuka Ishan
Dec 24 '16 at 15:17
|
show 3 more comments
The most likely way to hit this is:
- boot Ubuntu
- start a terminal
- type
sudo apt-get install whatever
and the command-line apt
overlaps with update-manager
automatically polling.
So if you try again in a few minutes that should fix it.
The most likely way to hit this is:
- boot Ubuntu
- start a terminal
- type
sudo apt-get install whatever
and the command-line apt
overlaps with update-manager
automatically polling.
So if you try again in a few minutes that should fix it.
edited Dec 24 '16 at 14:37
answered Nov 30 '10 at 3:08
pooliepoolie
7,18823158
7,18823158
18
Great hint in contrast to the half-dozen replies suggesting to just remove the file ;-) I randomly ran in the issue and most likely this is it!
– Alex
Jan 21 '14 at 16:14
1
Safe enough, had to wait a little beforesudo apt-get install
could work.
– sargas
May 11 '15 at 17:56
Well This is not working always, yes I have used reboot many times. If it's not suitable try this askubuntu.com/a/315791/378845 before you remove locks
– Menuka Ishan
Oct 23 '16 at 7:03
@menuka, why not just let it finish.
– poolie
Dec 24 '16 at 14:38
@poolie Because there are other constraints which are stopping the process from finishing
– Menuka Ishan
Dec 24 '16 at 15:17
|
show 3 more comments
18
Great hint in contrast to the half-dozen replies suggesting to just remove the file ;-) I randomly ran in the issue and most likely this is it!
– Alex
Jan 21 '14 at 16:14
1
Safe enough, had to wait a little beforesudo apt-get install
could work.
– sargas
May 11 '15 at 17:56
Well This is not working always, yes I have used reboot many times. If it's not suitable try this askubuntu.com/a/315791/378845 before you remove locks
– Menuka Ishan
Oct 23 '16 at 7:03
@menuka, why not just let it finish.
– poolie
Dec 24 '16 at 14:38
@poolie Because there are other constraints which are stopping the process from finishing
– Menuka Ishan
Dec 24 '16 at 15:17
18
18
Great hint in contrast to the half-dozen replies suggesting to just remove the file ;-) I randomly ran in the issue and most likely this is it!
– Alex
Jan 21 '14 at 16:14
Great hint in contrast to the half-dozen replies suggesting to just remove the file ;-) I randomly ran in the issue and most likely this is it!
– Alex
Jan 21 '14 at 16:14
1
1
Safe enough, had to wait a little before
sudo apt-get install
could work.– sargas
May 11 '15 at 17:56
Safe enough, had to wait a little before
sudo apt-get install
could work.– sargas
May 11 '15 at 17:56
Well This is not working always, yes I have used reboot many times. If it's not suitable try this askubuntu.com/a/315791/378845 before you remove locks
– Menuka Ishan
Oct 23 '16 at 7:03
Well This is not working always, yes I have used reboot many times. If it's not suitable try this askubuntu.com/a/315791/378845 before you remove locks
– Menuka Ishan
Oct 23 '16 at 7:03
@menuka, why not just let it finish.
– poolie
Dec 24 '16 at 14:38
@menuka, why not just let it finish.
– poolie
Dec 24 '16 at 14:38
@poolie Because there are other constraints which are stopping the process from finishing
– Menuka Ishan
Dec 24 '16 at 15:17
@poolie Because there are other constraints which are stopping the process from finishing
– Menuka Ishan
Dec 24 '16 at 15:17
|
show 3 more comments
Only one program can hold the lock. Make sure that you are not running aptitude, synaptic or adept. Close the program and run it again it should work.You may either have synaptic open, or have another terminal window open running apt-get, or have the update manager running.Check it and see if any of those are running,if any of them is running close it and try again.
Try this command in terminal to find what is running
ps -e | grep -e apt -e adept | grep -v grep
Note:
If that doesn’t print anything, type the following in terminal to remove the lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
Now you can install any Packages.
9
Deleting the lock file is, what I would consider, a dangerous thing to do. If another process is locking for a valid reason - and you remove that lock file and force an install with what you were doing prior - you could seriously, in a negative way, affect your system.
– Marco Ceppi♦
Nov 30 '10 at 5:49
4
That's why i have given that in Note.If all the above fails the only way is to remove the lock.It wont cause any problem as long as dpkg and apt-get/aptitude processes aren't running
– karthick87
Nov 30 '10 at 5:55
pgrep -f 'apt|adept|dpkg'
is a lot shorter.
– Barry
Sep 12 '17 at 21:38
Thx! this works. pgrep -f 'apt|adept|dpkg' and then sudo skill (number) , kill all number and then install works!
– creator
Mar 6 '18 at 0:22
add a comment |
Only one program can hold the lock. Make sure that you are not running aptitude, synaptic or adept. Close the program and run it again it should work.You may either have synaptic open, or have another terminal window open running apt-get, or have the update manager running.Check it and see if any of those are running,if any of them is running close it and try again.
Try this command in terminal to find what is running
ps -e | grep -e apt -e adept | grep -v grep
Note:
If that doesn’t print anything, type the following in terminal to remove the lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
Now you can install any Packages.
9
Deleting the lock file is, what I would consider, a dangerous thing to do. If another process is locking for a valid reason - and you remove that lock file and force an install with what you were doing prior - you could seriously, in a negative way, affect your system.
– Marco Ceppi♦
Nov 30 '10 at 5:49
4
That's why i have given that in Note.If all the above fails the only way is to remove the lock.It wont cause any problem as long as dpkg and apt-get/aptitude processes aren't running
– karthick87
Nov 30 '10 at 5:55
pgrep -f 'apt|adept|dpkg'
is a lot shorter.
– Barry
Sep 12 '17 at 21:38
Thx! this works. pgrep -f 'apt|adept|dpkg' and then sudo skill (number) , kill all number and then install works!
– creator
Mar 6 '18 at 0:22
add a comment |
Only one program can hold the lock. Make sure that you are not running aptitude, synaptic or adept. Close the program and run it again it should work.You may either have synaptic open, or have another terminal window open running apt-get, or have the update manager running.Check it and see if any of those are running,if any of them is running close it and try again.
Try this command in terminal to find what is running
ps -e | grep -e apt -e adept | grep -v grep
Note:
If that doesn’t print anything, type the following in terminal to remove the lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
Now you can install any Packages.
Only one program can hold the lock. Make sure that you are not running aptitude, synaptic or adept. Close the program and run it again it should work.You may either have synaptic open, or have another terminal window open running apt-get, or have the update manager running.Check it and see if any of those are running,if any of them is running close it and try again.
Try this command in terminal to find what is running
ps -e | grep -e apt -e adept | grep -v grep
Note:
If that doesn’t print anything, type the following in terminal to remove the lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
Now you can install any Packages.
edited Dec 31 '13 at 8:16
kiri
18.9k1258104
18.9k1258104
answered Nov 30 '10 at 4:55
karthick87karthick87
48.1k53166217
48.1k53166217
9
Deleting the lock file is, what I would consider, a dangerous thing to do. If another process is locking for a valid reason - and you remove that lock file and force an install with what you were doing prior - you could seriously, in a negative way, affect your system.
– Marco Ceppi♦
Nov 30 '10 at 5:49
4
That's why i have given that in Note.If all the above fails the only way is to remove the lock.It wont cause any problem as long as dpkg and apt-get/aptitude processes aren't running
– karthick87
Nov 30 '10 at 5:55
pgrep -f 'apt|adept|dpkg'
is a lot shorter.
– Barry
Sep 12 '17 at 21:38
Thx! this works. pgrep -f 'apt|adept|dpkg' and then sudo skill (number) , kill all number and then install works!
– creator
Mar 6 '18 at 0:22
add a comment |
9
Deleting the lock file is, what I would consider, a dangerous thing to do. If another process is locking for a valid reason - and you remove that lock file and force an install with what you were doing prior - you could seriously, in a negative way, affect your system.
– Marco Ceppi♦
Nov 30 '10 at 5:49
4
That's why i have given that in Note.If all the above fails the only way is to remove the lock.It wont cause any problem as long as dpkg and apt-get/aptitude processes aren't running
– karthick87
Nov 30 '10 at 5:55
pgrep -f 'apt|adept|dpkg'
is a lot shorter.
– Barry
Sep 12 '17 at 21:38
Thx! this works. pgrep -f 'apt|adept|dpkg' and then sudo skill (number) , kill all number and then install works!
– creator
Mar 6 '18 at 0:22
9
9
Deleting the lock file is, what I would consider, a dangerous thing to do. If another process is locking for a valid reason - and you remove that lock file and force an install with what you were doing prior - you could seriously, in a negative way, affect your system.
– Marco Ceppi♦
Nov 30 '10 at 5:49
Deleting the lock file is, what I would consider, a dangerous thing to do. If another process is locking for a valid reason - and you remove that lock file and force an install with what you were doing prior - you could seriously, in a negative way, affect your system.
– Marco Ceppi♦
Nov 30 '10 at 5:49
4
4
That's why i have given that in Note.If all the above fails the only way is to remove the lock.It wont cause any problem as long as dpkg and apt-get/aptitude processes aren't running
– karthick87
Nov 30 '10 at 5:55
That's why i have given that in Note.If all the above fails the only way is to remove the lock.It wont cause any problem as long as dpkg and apt-get/aptitude processes aren't running
– karthick87
Nov 30 '10 at 5:55
pgrep -f 'apt|adept|dpkg'
is a lot shorter.– Barry
Sep 12 '17 at 21:38
pgrep -f 'apt|adept|dpkg'
is a lot shorter.– Barry
Sep 12 '17 at 21:38
Thx! this works. pgrep -f 'apt|adept|dpkg' and then sudo skill (number) , kill all number and then install works!
– creator
Mar 6 '18 at 0:22
Thx! this works. pgrep -f 'apt|adept|dpkg' and then sudo skill (number) , kill all number and then install works!
– creator
Mar 6 '18 at 0:22
add a comment |
So far the best way to get it working without breaking a possible background running installation ( as it could happen by removing the lock file), is stopping the service using apt:
Error:
# sudo apt-get upgrade
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?`
Solution:
sudo systemctl stop apt-daily.timer
After upgrading the system I suggest re-enabling it, as the bug locking it could be fixed with the upgrade.
sudo systemctl start apt-daily.timer
I haven't verified this error gets fixed after upgrading. I'll add a new comment once I have that verified
After upgrading the system and starting the apt-daily.timer service again I'm not facing this issue so far.
– Jairelee
Feb 2 '17 at 10:41
This solved my issue, thank you.
– inkredibl
Jun 29 '17 at 9:15
This is probably the cleanest method compared to all those higher voted answers above. It worked in my case flawlessly, thank you!
– CygnusX1
Oct 25 '17 at 19:45
This worked flawlessly on 17.10 as well
– Elder Geek
Dec 6 '17 at 4:59
2
Working fine in 18.04. :)
– Naveen Kumar V
Jun 7 '18 at 2:56
|
show 1 more comment
So far the best way to get it working without breaking a possible background running installation ( as it could happen by removing the lock file), is stopping the service using apt:
Error:
# sudo apt-get upgrade
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?`
Solution:
sudo systemctl stop apt-daily.timer
After upgrading the system I suggest re-enabling it, as the bug locking it could be fixed with the upgrade.
sudo systemctl start apt-daily.timer
I haven't verified this error gets fixed after upgrading. I'll add a new comment once I have that verified
After upgrading the system and starting the apt-daily.timer service again I'm not facing this issue so far.
– Jairelee
Feb 2 '17 at 10:41
This solved my issue, thank you.
– inkredibl
Jun 29 '17 at 9:15
This is probably the cleanest method compared to all those higher voted answers above. It worked in my case flawlessly, thank you!
– CygnusX1
Oct 25 '17 at 19:45
This worked flawlessly on 17.10 as well
– Elder Geek
Dec 6 '17 at 4:59
2
Working fine in 18.04. :)
– Naveen Kumar V
Jun 7 '18 at 2:56
|
show 1 more comment
So far the best way to get it working without breaking a possible background running installation ( as it could happen by removing the lock file), is stopping the service using apt:
Error:
# sudo apt-get upgrade
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?`
Solution:
sudo systemctl stop apt-daily.timer
After upgrading the system I suggest re-enabling it, as the bug locking it could be fixed with the upgrade.
sudo systemctl start apt-daily.timer
I haven't verified this error gets fixed after upgrading. I'll add a new comment once I have that verified
So far the best way to get it working without breaking a possible background running installation ( as it could happen by removing the lock file), is stopping the service using apt:
Error:
# sudo apt-get upgrade
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?`
Solution:
sudo systemctl stop apt-daily.timer
After upgrading the system I suggest re-enabling it, as the bug locking it could be fixed with the upgrade.
sudo systemctl start apt-daily.timer
I haven't verified this error gets fixed after upgrading. I'll add a new comment once I have that verified
edited Feb 2 '17 at 10:31
answered Feb 2 '17 at 10:01
JaireleeJairelee
51134
51134
After upgrading the system and starting the apt-daily.timer service again I'm not facing this issue so far.
– Jairelee
Feb 2 '17 at 10:41
This solved my issue, thank you.
– inkredibl
Jun 29 '17 at 9:15
This is probably the cleanest method compared to all those higher voted answers above. It worked in my case flawlessly, thank you!
– CygnusX1
Oct 25 '17 at 19:45
This worked flawlessly on 17.10 as well
– Elder Geek
Dec 6 '17 at 4:59
2
Working fine in 18.04. :)
– Naveen Kumar V
Jun 7 '18 at 2:56
|
show 1 more comment
After upgrading the system and starting the apt-daily.timer service again I'm not facing this issue so far.
– Jairelee
Feb 2 '17 at 10:41
This solved my issue, thank you.
– inkredibl
Jun 29 '17 at 9:15
This is probably the cleanest method compared to all those higher voted answers above. It worked in my case flawlessly, thank you!
– CygnusX1
Oct 25 '17 at 19:45
This worked flawlessly on 17.10 as well
– Elder Geek
Dec 6 '17 at 4:59
2
Working fine in 18.04. :)
– Naveen Kumar V
Jun 7 '18 at 2:56
After upgrading the system and starting the apt-daily.timer service again I'm not facing this issue so far.
– Jairelee
Feb 2 '17 at 10:41
After upgrading the system and starting the apt-daily.timer service again I'm not facing this issue so far.
– Jairelee
Feb 2 '17 at 10:41
This solved my issue, thank you.
– inkredibl
Jun 29 '17 at 9:15
This solved my issue, thank you.
– inkredibl
Jun 29 '17 at 9:15
This is probably the cleanest method compared to all those higher voted answers above. It worked in my case flawlessly, thank you!
– CygnusX1
Oct 25 '17 at 19:45
This is probably the cleanest method compared to all those higher voted answers above. It worked in my case flawlessly, thank you!
– CygnusX1
Oct 25 '17 at 19:45
This worked flawlessly on 17.10 as well
– Elder Geek
Dec 6 '17 at 4:59
This worked flawlessly on 17.10 as well
– Elder Geek
Dec 6 '17 at 4:59
2
2
Working fine in 18.04. :)
– Naveen Kumar V
Jun 7 '18 at 2:56
Working fine in 18.04. :)
– Naveen Kumar V
Jun 7 '18 at 2:56
|
show 1 more comment
First of all we should check what process created the lock file using lsof
:
sudo lsof /var/lib/dpkg/lock
or in another situation where /var/lib/apt/lists/lock
is problematic:
sudo lsof /var/lib/apt/lists/lock
The output will be close to something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apt-get 12127 root 4uW REG 252,1 0 86 /var/lib/apt/lists/lock
Then we should check what the commad is doing, we can find it out using ps
, pgrep
etc; the command is apt-get
so I run:
pgrep apt-get -a
The -a
switch lists the full command for me, in my case it's:
pgrep -a apt-get
12127 apt-get update
we can see that it's running update
subcommand, I could run something like this too:
ps -f 12127
which produces:
UID PID PPID C STIME TTY STAT TIME CMD
root 12127 12126 0 09:39 pts/0 S+ 0:00 apt-get update
In this case I would wait for some minute for resource to be freed and if after 2 or 3 minute problem still exist or the command was something that I didn't care about or was not harmful for system (like this apt-get update
) I send a SIGTERM
to the process:
sudo kill -15 12127
It should do the work, If it didn't I'm going to send SIGINT
this time (It's like pressing CTRL+C):
sudo kill -2 12127
If it didn't work too, we should send an SIGHUP
(kill -1
), and finally if nothing works I simply kill the process:
sudo kill -9 12127
or
sudo pkill -9 apt-get
Then I remove busy resources:
sudo rm /var/lib/apt/lists/lock
One small thing is that/var/lib/dpkg/lock
rather than/var/lib/apt/lists/lock
is the file in the question.
– Chai T. Rex
Apr 24 '17 at 21:12
@ChaiT.Rex thanks, did an update ;)
– Ravexina
Apr 24 '17 at 21:16
1
Thank the root gods that someone finally mentionspgrep
andpkill
.
– Barry
Sep 12 '17 at 21:39
1
This should be the accepted answer.
– Marwan Nabil
Jul 10 '18 at 10:31
add a comment |
First of all we should check what process created the lock file using lsof
:
sudo lsof /var/lib/dpkg/lock
or in another situation where /var/lib/apt/lists/lock
is problematic:
sudo lsof /var/lib/apt/lists/lock
The output will be close to something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apt-get 12127 root 4uW REG 252,1 0 86 /var/lib/apt/lists/lock
Then we should check what the commad is doing, we can find it out using ps
, pgrep
etc; the command is apt-get
so I run:
pgrep apt-get -a
The -a
switch lists the full command for me, in my case it's:
pgrep -a apt-get
12127 apt-get update
we can see that it's running update
subcommand, I could run something like this too:
ps -f 12127
which produces:
UID PID PPID C STIME TTY STAT TIME CMD
root 12127 12126 0 09:39 pts/0 S+ 0:00 apt-get update
In this case I would wait for some minute for resource to be freed and if after 2 or 3 minute problem still exist or the command was something that I didn't care about or was not harmful for system (like this apt-get update
) I send a SIGTERM
to the process:
sudo kill -15 12127
It should do the work, If it didn't I'm going to send SIGINT
this time (It's like pressing CTRL+C):
sudo kill -2 12127
If it didn't work too, we should send an SIGHUP
(kill -1
), and finally if nothing works I simply kill the process:
sudo kill -9 12127
or
sudo pkill -9 apt-get
Then I remove busy resources:
sudo rm /var/lib/apt/lists/lock
One small thing is that/var/lib/dpkg/lock
rather than/var/lib/apt/lists/lock
is the file in the question.
– Chai T. Rex
Apr 24 '17 at 21:12
@ChaiT.Rex thanks, did an update ;)
– Ravexina
Apr 24 '17 at 21:16
1
Thank the root gods that someone finally mentionspgrep
andpkill
.
– Barry
Sep 12 '17 at 21:39
1
This should be the accepted answer.
– Marwan Nabil
Jul 10 '18 at 10:31
add a comment |
First of all we should check what process created the lock file using lsof
:
sudo lsof /var/lib/dpkg/lock
or in another situation where /var/lib/apt/lists/lock
is problematic:
sudo lsof /var/lib/apt/lists/lock
The output will be close to something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apt-get 12127 root 4uW REG 252,1 0 86 /var/lib/apt/lists/lock
Then we should check what the commad is doing, we can find it out using ps
, pgrep
etc; the command is apt-get
so I run:
pgrep apt-get -a
The -a
switch lists the full command for me, in my case it's:
pgrep -a apt-get
12127 apt-get update
we can see that it's running update
subcommand, I could run something like this too:
ps -f 12127
which produces:
UID PID PPID C STIME TTY STAT TIME CMD
root 12127 12126 0 09:39 pts/0 S+ 0:00 apt-get update
In this case I would wait for some minute for resource to be freed and if after 2 or 3 minute problem still exist or the command was something that I didn't care about or was not harmful for system (like this apt-get update
) I send a SIGTERM
to the process:
sudo kill -15 12127
It should do the work, If it didn't I'm going to send SIGINT
this time (It's like pressing CTRL+C):
sudo kill -2 12127
If it didn't work too, we should send an SIGHUP
(kill -1
), and finally if nothing works I simply kill the process:
sudo kill -9 12127
or
sudo pkill -9 apt-get
Then I remove busy resources:
sudo rm /var/lib/apt/lists/lock
First of all we should check what process created the lock file using lsof
:
sudo lsof /var/lib/dpkg/lock
or in another situation where /var/lib/apt/lists/lock
is problematic:
sudo lsof /var/lib/apt/lists/lock
The output will be close to something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apt-get 12127 root 4uW REG 252,1 0 86 /var/lib/apt/lists/lock
Then we should check what the commad is doing, we can find it out using ps
, pgrep
etc; the command is apt-get
so I run:
pgrep apt-get -a
The -a
switch lists the full command for me, in my case it's:
pgrep -a apt-get
12127 apt-get update
we can see that it's running update
subcommand, I could run something like this too:
ps -f 12127
which produces:
UID PID PPID C STIME TTY STAT TIME CMD
root 12127 12126 0 09:39 pts/0 S+ 0:00 apt-get update
In this case I would wait for some minute for resource to be freed and if after 2 or 3 minute problem still exist or the command was something that I didn't care about or was not harmful for system (like this apt-get update
) I send a SIGTERM
to the process:
sudo kill -15 12127
It should do the work, If it didn't I'm going to send SIGINT
this time (It's like pressing CTRL+C):
sudo kill -2 12127
If it didn't work too, we should send an SIGHUP
(kill -1
), and finally if nothing works I simply kill the process:
sudo kill -9 12127
or
sudo pkill -9 apt-get
Then I remove busy resources:
sudo rm /var/lib/apt/lists/lock
edited Apr 25 '17 at 7:44
answered Apr 24 '17 at 7:29
RavexinaRavexina
32k1482112
32k1482112
One small thing is that/var/lib/dpkg/lock
rather than/var/lib/apt/lists/lock
is the file in the question.
– Chai T. Rex
Apr 24 '17 at 21:12
@ChaiT.Rex thanks, did an update ;)
– Ravexina
Apr 24 '17 at 21:16
1
Thank the root gods that someone finally mentionspgrep
andpkill
.
– Barry
Sep 12 '17 at 21:39
1
This should be the accepted answer.
– Marwan Nabil
Jul 10 '18 at 10:31
add a comment |
One small thing is that/var/lib/dpkg/lock
rather than/var/lib/apt/lists/lock
is the file in the question.
– Chai T. Rex
Apr 24 '17 at 21:12
@ChaiT.Rex thanks, did an update ;)
– Ravexina
Apr 24 '17 at 21:16
1
Thank the root gods that someone finally mentionspgrep
andpkill
.
– Barry
Sep 12 '17 at 21:39
1
This should be the accepted answer.
– Marwan Nabil
Jul 10 '18 at 10:31
One small thing is that
/var/lib/dpkg/lock
rather than /var/lib/apt/lists/lock
is the file in the question.– Chai T. Rex
Apr 24 '17 at 21:12
One small thing is that
/var/lib/dpkg/lock
rather than /var/lib/apt/lists/lock
is the file in the question.– Chai T. Rex
Apr 24 '17 at 21:12
@ChaiT.Rex thanks, did an update ;)
– Ravexina
Apr 24 '17 at 21:16
@ChaiT.Rex thanks, did an update ;)
– Ravexina
Apr 24 '17 at 21:16
1
1
Thank the root gods that someone finally mentions
pgrep
and pkill
.– Barry
Sep 12 '17 at 21:39
Thank the root gods that someone finally mentions
pgrep
and pkill
.– Barry
Sep 12 '17 at 21:39
1
1
This should be the accepted answer.
– Marwan Nabil
Jul 10 '18 at 10:31
This should be the accepted answer.
– Marwan Nabil
Jul 10 '18 at 10:31
add a comment |
This will happen if you have 'Update Manager' running in parallel for any update check or install as install process places Lock. If you're facing the same error without 'Update Manager' running you have to remove it from /var/lib/dgkg/lock
, which definitely you can't do it manually
sudo fuser -cuk /var/lib/dpkg/lock
sudo rm -f /var/lib/dpkg/lock
works fine. Taken from: https://askubuntu.com/a/15469/68707
1
This was the problem in my case!
– LondonRob
Sep 19 '14 at 13:12
1
Better solution since fuser command used to track down other process (if still alive)
– Lars Nordin
Mar 18 '15 at 11:50
add a comment |
This will happen if you have 'Update Manager' running in parallel for any update check or install as install process places Lock. If you're facing the same error without 'Update Manager' running you have to remove it from /var/lib/dgkg/lock
, which definitely you can't do it manually
sudo fuser -cuk /var/lib/dpkg/lock
sudo rm -f /var/lib/dpkg/lock
works fine. Taken from: https://askubuntu.com/a/15469/68707
1
This was the problem in my case!
– LondonRob
Sep 19 '14 at 13:12
1
Better solution since fuser command used to track down other process (if still alive)
– Lars Nordin
Mar 18 '15 at 11:50
add a comment |
This will happen if you have 'Update Manager' running in parallel for any update check or install as install process places Lock. If you're facing the same error without 'Update Manager' running you have to remove it from /var/lib/dgkg/lock
, which definitely you can't do it manually
sudo fuser -cuk /var/lib/dpkg/lock
sudo rm -f /var/lib/dpkg/lock
works fine. Taken from: https://askubuntu.com/a/15469/68707
This will happen if you have 'Update Manager' running in parallel for any update check or install as install process places Lock. If you're facing the same error without 'Update Manager' running you have to remove it from /var/lib/dgkg/lock
, which definitely you can't do it manually
sudo fuser -cuk /var/lib/dpkg/lock
sudo rm -f /var/lib/dpkg/lock
works fine. Taken from: https://askubuntu.com/a/15469/68707
edited Apr 13 '17 at 12:24
Community♦
1
1
answered Jun 6 '12 at 7:17
Nabeel AhmedNabeel Ahmed
48546
48546
1
This was the problem in my case!
– LondonRob
Sep 19 '14 at 13:12
1
Better solution since fuser command used to track down other process (if still alive)
– Lars Nordin
Mar 18 '15 at 11:50
add a comment |
1
This was the problem in my case!
– LondonRob
Sep 19 '14 at 13:12
1
Better solution since fuser command used to track down other process (if still alive)
– Lars Nordin
Mar 18 '15 at 11:50
1
1
This was the problem in my case!
– LondonRob
Sep 19 '14 at 13:12
This was the problem in my case!
– LondonRob
Sep 19 '14 at 13:12
1
1
Better solution since fuser command used to track down other process (if still alive)
– Lars Nordin
Mar 18 '15 at 11:50
Better solution since fuser command used to track down other process (if still alive)
– Lars Nordin
Mar 18 '15 at 11:50
add a comment |
This error may be caused by the Update Manager trying to automatically refresh the list of packages in background, usually right after your login, thus locking the directory.
In this case just wait few seconds (or more, if your last update was long ago) for it to complete or launch Update Manager to check the status.
I had this right after installing Ubuntu 16.04. Turns out that there was a background process in the Ubuntu Software Center that was waiting for me to manually install some updates.
– jvriesem
May 12 '16 at 21:16
Ditto after a fresh install of 16.04. It too much longer than "a few seconds" in my case (I had time to read this whole Q&A page!) but after refreshingps
a few times I could seedpkg
was updating a whole load of stuff and I waited patiently for it all to finish. I then ran Software Updater until everything was up-to-date before trying to install anything new.
– Charlie Joynt
Mar 2 '17 at 21:51
add a comment |
This error may be caused by the Update Manager trying to automatically refresh the list of packages in background, usually right after your login, thus locking the directory.
In this case just wait few seconds (or more, if your last update was long ago) for it to complete or launch Update Manager to check the status.
I had this right after installing Ubuntu 16.04. Turns out that there was a background process in the Ubuntu Software Center that was waiting for me to manually install some updates.
– jvriesem
May 12 '16 at 21:16
Ditto after a fresh install of 16.04. It too much longer than "a few seconds" in my case (I had time to read this whole Q&A page!) but after refreshingps
a few times I could seedpkg
was updating a whole load of stuff and I waited patiently for it all to finish. I then ran Software Updater until everything was up-to-date before trying to install anything new.
– Charlie Joynt
Mar 2 '17 at 21:51
add a comment |
This error may be caused by the Update Manager trying to automatically refresh the list of packages in background, usually right after your login, thus locking the directory.
In this case just wait few seconds (or more, if your last update was long ago) for it to complete or launch Update Manager to check the status.
This error may be caused by the Update Manager trying to automatically refresh the list of packages in background, usually right after your login, thus locking the directory.
In this case just wait few seconds (or more, if your last update was long ago) for it to complete or launch Update Manager to check the status.
edited Feb 5 '18 at 9:55
answered Oct 4 '13 at 12:39
BatsuBatsu
29924
29924
I had this right after installing Ubuntu 16.04. Turns out that there was a background process in the Ubuntu Software Center that was waiting for me to manually install some updates.
– jvriesem
May 12 '16 at 21:16
Ditto after a fresh install of 16.04. It too much longer than "a few seconds" in my case (I had time to read this whole Q&A page!) but after refreshingps
a few times I could seedpkg
was updating a whole load of stuff and I waited patiently for it all to finish. I then ran Software Updater until everything was up-to-date before trying to install anything new.
– Charlie Joynt
Mar 2 '17 at 21:51
add a comment |
I had this right after installing Ubuntu 16.04. Turns out that there was a background process in the Ubuntu Software Center that was waiting for me to manually install some updates.
– jvriesem
May 12 '16 at 21:16
Ditto after a fresh install of 16.04. It too much longer than "a few seconds" in my case (I had time to read this whole Q&A page!) but after refreshingps
a few times I could seedpkg
was updating a whole load of stuff and I waited patiently for it all to finish. I then ran Software Updater until everything was up-to-date before trying to install anything new.
– Charlie Joynt
Mar 2 '17 at 21:51
I had this right after installing Ubuntu 16.04. Turns out that there was a background process in the Ubuntu Software Center that was waiting for me to manually install some updates.
– jvriesem
May 12 '16 at 21:16
I had this right after installing Ubuntu 16.04. Turns out that there was a background process in the Ubuntu Software Center that was waiting for me to manually install some updates.
– jvriesem
May 12 '16 at 21:16
Ditto after a fresh install of 16.04. It too much longer than "a few seconds" in my case (I had time to read this whole Q&A page!) but after refreshing
ps
a few times I could see dpkg
was updating a whole load of stuff and I waited patiently for it all to finish. I then ran Software Updater until everything was up-to-date before trying to install anything new.– Charlie Joynt
Mar 2 '17 at 21:51
Ditto after a fresh install of 16.04. It too much longer than "a few seconds" in my case (I had time to read this whole Q&A page!) but after refreshing
ps
a few times I could see dpkg
was updating a whole load of stuff and I waited patiently for it all to finish. I then ran Software Updater until everything was up-to-date before trying to install anything new.– Charlie Joynt
Mar 2 '17 at 21:51
add a comment |
Don't be so fast to remove something, it may totally damage your system; rather wait until the currently installing or uninstalling program finishes its task and after that you will get access. If you think that there is nothing currently installing or uninstalling, then just reboot your system with the command sudo reboot
.
1
This looks like a comment rather than an answer. Could you move this instead as a comment to the answer it was responding to?
– jvriesem
May 12 '16 at 21:15
4
@jvriesem I think this is a very important answer, because the point he's making is what is missing from many other answers!
– Volker Siegel
Jul 2 '16 at 10:31
add a comment |
Don't be so fast to remove something, it may totally damage your system; rather wait until the currently installing or uninstalling program finishes its task and after that you will get access. If you think that there is nothing currently installing or uninstalling, then just reboot your system with the command sudo reboot
.
1
This looks like a comment rather than an answer. Could you move this instead as a comment to the answer it was responding to?
– jvriesem
May 12 '16 at 21:15
4
@jvriesem I think this is a very important answer, because the point he's making is what is missing from many other answers!
– Volker Siegel
Jul 2 '16 at 10:31
add a comment |
Don't be so fast to remove something, it may totally damage your system; rather wait until the currently installing or uninstalling program finishes its task and after that you will get access. If you think that there is nothing currently installing or uninstalling, then just reboot your system with the command sudo reboot
.
Don't be so fast to remove something, it may totally damage your system; rather wait until the currently installing or uninstalling program finishes its task and after that you will get access. If you think that there is nothing currently installing or uninstalling, then just reboot your system with the command sudo reboot
.
edited Oct 6 '15 at 6:40
kos
25.4k870120
25.4k870120
answered Jan 15 '15 at 9:54
WessiWessi
17123
17123
1
This looks like a comment rather than an answer. Could you move this instead as a comment to the answer it was responding to?
– jvriesem
May 12 '16 at 21:15
4
@jvriesem I think this is a very important answer, because the point he's making is what is missing from many other answers!
– Volker Siegel
Jul 2 '16 at 10:31
add a comment |
1
This looks like a comment rather than an answer. Could you move this instead as a comment to the answer it was responding to?
– jvriesem
May 12 '16 at 21:15
4
@jvriesem I think this is a very important answer, because the point he's making is what is missing from many other answers!
– Volker Siegel
Jul 2 '16 at 10:31
1
1
This looks like a comment rather than an answer. Could you move this instead as a comment to the answer it was responding to?
– jvriesem
May 12 '16 at 21:15
This looks like a comment rather than an answer. Could you move this instead as a comment to the answer it was responding to?
– jvriesem
May 12 '16 at 21:15
4
4
@jvriesem I think this is a very important answer, because the point he's making is what is missing from many other answers!
– Volker Siegel
Jul 2 '16 at 10:31
@jvriesem I think this is a very important answer, because the point he's making is what is missing from many other answers!
– Volker Siegel
Jul 2 '16 at 10:31
add a comment |
If you have security updates set to auto-install this will happen frequently. I literally wait 30 seconds and it fixes the issue. Just throwing this out there in case anyone else encounters this issue.
add a comment |
If you have security updates set to auto-install this will happen frequently. I literally wait 30 seconds and it fixes the issue. Just throwing this out there in case anyone else encounters this issue.
add a comment |
If you have security updates set to auto-install this will happen frequently. I literally wait 30 seconds and it fixes the issue. Just throwing this out there in case anyone else encounters this issue.
If you have security updates set to auto-install this will happen frequently. I literally wait 30 seconds and it fixes the issue. Just throwing this out there in case anyone else encounters this issue.
answered May 16 '16 at 22:02
Wh33tWh33t
12836
12836
add a comment |
add a comment |
Just sudo rm -f /var/lib/apt/lists/lock
and try again.
apt-fast MAY be responsible for not unlocking properly; this happens sometimes when you abort apt-get
or dpkg
too.
add a comment |
Just sudo rm -f /var/lib/apt/lists/lock
and try again.
apt-fast MAY be responsible for not unlocking properly; this happens sometimes when you abort apt-get
or dpkg
too.
add a comment |
Just sudo rm -f /var/lib/apt/lists/lock
and try again.
apt-fast MAY be responsible for not unlocking properly; this happens sometimes when you abort apt-get
or dpkg
too.
Just sudo rm -f /var/lib/apt/lists/lock
and try again.
apt-fast MAY be responsible for not unlocking properly; this happens sometimes when you abort apt-get
or dpkg
too.
answered Jun 11 '12 at 21:47
ishish
115k29265293
115k29265293
add a comment |
add a comment |
In my case I just waited for several minutes and the lock has been released (looks like aptd
used to hold it). This all happened right after system boot.
add a comment |
In my case I just waited for several minutes and the lock has been released (looks like aptd
used to hold it). This all happened right after system boot.
add a comment |
In my case I just waited for several minutes and the lock has been released (looks like aptd
used to hold it). This all happened right after system boot.
In my case I just waited for several minutes and the lock has been released (looks like aptd
used to hold it). This all happened right after system boot.
answered Sep 24 '16 at 11:19
Pavel VlasovPavel Vlasov
19818
19818
add a comment |
add a comment |
I have had this issue numerous times. For me, it was almost always caused by apt-get or some GUI that called it getting hung for some reason. I had to kill it which left various locks in place.
The other answers bring up very good points about making sure no updates are currently running before doing anything drastic like removing lock files. However, once you are sure that's not the case, the following usually works for me. I got it by reading many answers to questions like this one.
While most or all of this is presented in the other answers, this distills the fix down to a few commands.
sudo fuser -vki /var/lib/dpkg/lock
sudo fuser -vki /var/cache/apt/archives/lock
sudo fuser -vki /var/cache/debconf/config.dat
sudo dpkg --configure -a
Use for unlocking the package system after an update of some kind crashed or terminated without finishing in some other way. These commands should be run in the order presented.
add a comment |
I have had this issue numerous times. For me, it was almost always caused by apt-get or some GUI that called it getting hung for some reason. I had to kill it which left various locks in place.
The other answers bring up very good points about making sure no updates are currently running before doing anything drastic like removing lock files. However, once you are sure that's not the case, the following usually works for me. I got it by reading many answers to questions like this one.
While most or all of this is presented in the other answers, this distills the fix down to a few commands.
sudo fuser -vki /var/lib/dpkg/lock
sudo fuser -vki /var/cache/apt/archives/lock
sudo fuser -vki /var/cache/debconf/config.dat
sudo dpkg --configure -a
Use for unlocking the package system after an update of some kind crashed or terminated without finishing in some other way. These commands should be run in the order presented.
add a comment |
I have had this issue numerous times. For me, it was almost always caused by apt-get or some GUI that called it getting hung for some reason. I had to kill it which left various locks in place.
The other answers bring up very good points about making sure no updates are currently running before doing anything drastic like removing lock files. However, once you are sure that's not the case, the following usually works for me. I got it by reading many answers to questions like this one.
While most or all of this is presented in the other answers, this distills the fix down to a few commands.
sudo fuser -vki /var/lib/dpkg/lock
sudo fuser -vki /var/cache/apt/archives/lock
sudo fuser -vki /var/cache/debconf/config.dat
sudo dpkg --configure -a
Use for unlocking the package system after an update of some kind crashed or terminated without finishing in some other way. These commands should be run in the order presented.
I have had this issue numerous times. For me, it was almost always caused by apt-get or some GUI that called it getting hung for some reason. I had to kill it which left various locks in place.
The other answers bring up very good points about making sure no updates are currently running before doing anything drastic like removing lock files. However, once you are sure that's not the case, the following usually works for me. I got it by reading many answers to questions like this one.
While most or all of this is presented in the other answers, this distills the fix down to a few commands.
sudo fuser -vki /var/lib/dpkg/lock
sudo fuser -vki /var/cache/apt/archives/lock
sudo fuser -vki /var/cache/debconf/config.dat
sudo dpkg --configure -a
Use for unlocking the package system after an update of some kind crashed or terminated without finishing in some other way. These commands should be run in the order presented.
answered Oct 21 '16 at 19:59
JoeJoe
1,201821
1,201821
add a comment |
add a comment |
I don't see this answer anywhere above but on Ubuntu 16.04, I encountered this problem as well. The cause was the time on my computer was set into the future. (This is because I'm on a Windows+Ubuntu dual boot system and I guess I have messed up local time vs UTC time.)
One odd thing was that the locked file's date and time was the exact date and time that I ran the program.
I then used "fuser" as described in earlier posts and apt worked, but I was getting complaints about needing to run dpkg -a -reconfigure
. When I did that, I got errors like:
newline in field name #padding
in files like '/var/lib/dpkg/updates/0003'.
All of this was very strange as I've never seen it before. So, I thought these were symptoms and changed my data and time manually. I knew there was a problem with the date/time when I logged in, but was ignoring it. (Previously, it was setting it automatically via the Internet and NTP).
Then, all of the above problems were fixed... Hopefully, this helps someone else! The most notable symptom is perhaps the date/time of the lock file being the exact date/time that you are trying to run the command.
add a comment |
I don't see this answer anywhere above but on Ubuntu 16.04, I encountered this problem as well. The cause was the time on my computer was set into the future. (This is because I'm on a Windows+Ubuntu dual boot system and I guess I have messed up local time vs UTC time.)
One odd thing was that the locked file's date and time was the exact date and time that I ran the program.
I then used "fuser" as described in earlier posts and apt worked, but I was getting complaints about needing to run dpkg -a -reconfigure
. When I did that, I got errors like:
newline in field name #padding
in files like '/var/lib/dpkg/updates/0003'.
All of this was very strange as I've never seen it before. So, I thought these were symptoms and changed my data and time manually. I knew there was a problem with the date/time when I logged in, but was ignoring it. (Previously, it was setting it automatically via the Internet and NTP).
Then, all of the above problems were fixed... Hopefully, this helps someone else! The most notable symptom is perhaps the date/time of the lock file being the exact date/time that you are trying to run the command.
add a comment |
I don't see this answer anywhere above but on Ubuntu 16.04, I encountered this problem as well. The cause was the time on my computer was set into the future. (This is because I'm on a Windows+Ubuntu dual boot system and I guess I have messed up local time vs UTC time.)
One odd thing was that the locked file's date and time was the exact date and time that I ran the program.
I then used "fuser" as described in earlier posts and apt worked, but I was getting complaints about needing to run dpkg -a -reconfigure
. When I did that, I got errors like:
newline in field name #padding
in files like '/var/lib/dpkg/updates/0003'.
All of this was very strange as I've never seen it before. So, I thought these were symptoms and changed my data and time manually. I knew there was a problem with the date/time when I logged in, but was ignoring it. (Previously, it was setting it automatically via the Internet and NTP).
Then, all of the above problems were fixed... Hopefully, this helps someone else! The most notable symptom is perhaps the date/time of the lock file being the exact date/time that you are trying to run the command.
I don't see this answer anywhere above but on Ubuntu 16.04, I encountered this problem as well. The cause was the time on my computer was set into the future. (This is because I'm on a Windows+Ubuntu dual boot system and I guess I have messed up local time vs UTC time.)
One odd thing was that the locked file's date and time was the exact date and time that I ran the program.
I then used "fuser" as described in earlier posts and apt worked, but I was getting complaints about needing to run dpkg -a -reconfigure
. When I did that, I got errors like:
newline in field name #padding
in files like '/var/lib/dpkg/updates/0003'.
All of this was very strange as I've never seen it before. So, I thought these were symptoms and changed my data and time manually. I knew there was a problem with the date/time when I logged in, but was ignoring it. (Previously, it was setting it automatically via the Internet and NTP).
Then, all of the above problems were fixed... Hopefully, this helps someone else! The most notable symptom is perhaps the date/time of the lock file being the exact date/time that you are trying to run the command.
answered May 8 '16 at 1:17
RayRay
788520
788520
add a comment |
add a comment |
In my case, X crashed while apt-get
was still removing old kernels. I used the System Monitor to confirm it was still running and not stuck. Everything was fine once the process finished.
add a comment |
In my case, X crashed while apt-get
was still removing old kernels. I used the System Monitor to confirm it was still running and not stuck. Everything was fine once the process finished.
add a comment |
In my case, X crashed while apt-get
was still removing old kernels. I used the System Monitor to confirm it was still running and not stuck. Everything was fine once the process finished.
In my case, X crashed while apt-get
was still removing old kernels. I used the System Monitor to confirm it was still running and not stuck. Everything was fine once the process finished.
answered Dec 24 '16 at 1:37
wjandreawjandrea
8,50742259
8,50742259
add a comment |
add a comment |
In my case I was getting the same message by not realizing I had switched to root user and was trying sudo apt-get. Once I realized this I just ran apt-get, and it worked. Silly, but it might still explain the error for some.
2
That's not the cause of the issue, since you can runsudo
as root (and even if you couldn't, it wouldn't produce this error message). More likely what happened was that the other process finished while you were writing the next command.
– wjandrea
Oct 24 '17 at 5:06
Sometimes it does produce that same error message.
– karel
Dec 23 '17 at 0:31
add a comment |
In my case I was getting the same message by not realizing I had switched to root user and was trying sudo apt-get. Once I realized this I just ran apt-get, and it worked. Silly, but it might still explain the error for some.
2
That's not the cause of the issue, since you can runsudo
as root (and even if you couldn't, it wouldn't produce this error message). More likely what happened was that the other process finished while you were writing the next command.
– wjandrea
Oct 24 '17 at 5:06
Sometimes it does produce that same error message.
– karel
Dec 23 '17 at 0:31
add a comment |
In my case I was getting the same message by not realizing I had switched to root user and was trying sudo apt-get. Once I realized this I just ran apt-get, and it worked. Silly, but it might still explain the error for some.
In my case I was getting the same message by not realizing I had switched to root user and was trying sudo apt-get. Once I realized this I just ran apt-get, and it worked. Silly, but it might still explain the error for some.
answered Mar 31 '16 at 2:43
BluePythonBluePython
1475
1475
2
That's not the cause of the issue, since you can runsudo
as root (and even if you couldn't, it wouldn't produce this error message). More likely what happened was that the other process finished while you were writing the next command.
– wjandrea
Oct 24 '17 at 5:06
Sometimes it does produce that same error message.
– karel
Dec 23 '17 at 0:31
add a comment |
2
That's not the cause of the issue, since you can runsudo
as root (and even if you couldn't, it wouldn't produce this error message). More likely what happened was that the other process finished while you were writing the next command.
– wjandrea
Oct 24 '17 at 5:06
Sometimes it does produce that same error message.
– karel
Dec 23 '17 at 0:31
2
2
That's not the cause of the issue, since you can run
sudo
as root (and even if you couldn't, it wouldn't produce this error message). More likely what happened was that the other process finished while you were writing the next command.– wjandrea
Oct 24 '17 at 5:06
That's not the cause of the issue, since you can run
sudo
as root (and even if you couldn't, it wouldn't produce this error message). More likely what happened was that the other process finished while you were writing the next command.– wjandrea
Oct 24 '17 at 5:06
Sometimes it does produce that same error message.
– karel
Dec 23 '17 at 0:31
Sometimes it does produce that same error message.
– karel
Dec 23 '17 at 0:31
add a comment |
Check the Launcher to see if Software Updater
is running. If so maximize it and have a look at what it is doing. If it is still checking, then wait for it to complete. When it completes it might tell you the software is up-to-date so close the app. If it says there are updates available, either do the update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
If Software Updater
is not running, just use the Dash to invoke it and the wait for completion and then decide if you want to update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
add a comment |
Check the Launcher to see if Software Updater
is running. If so maximize it and have a look at what it is doing. If it is still checking, then wait for it to complete. When it completes it might tell you the software is up-to-date so close the app. If it says there are updates available, either do the update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
If Software Updater
is not running, just use the Dash to invoke it and the wait for completion and then decide if you want to update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
add a comment |
Check the Launcher to see if Software Updater
is running. If so maximize it and have a look at what it is doing. If it is still checking, then wait for it to complete. When it completes it might tell you the software is up-to-date so close the app. If it says there are updates available, either do the update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
If Software Updater
is not running, just use the Dash to invoke it and the wait for completion and then decide if you want to update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
Check the Launcher to see if Software Updater
is running. If so maximize it and have a look at what it is doing. If it is still checking, then wait for it to complete. When it completes it might tell you the software is up-to-date so close the app. If it says there are updates available, either do the update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
If Software Updater
is not running, just use the Dash to invoke it and the wait for completion and then decide if you want to update or click "remind me later". After this this app closes you can go back to using apt-get
or apt
.
answered Sep 10 '18 at 22:18
H2ONaClH2ONaCl
3,285204885
3,285204885
add a comment |
add a comment |
sudo killall -9 apt && sudo killall -9 dpkg
Use at your own risk
add a comment |
sudo killall -9 apt && sudo killall -9 dpkg
Use at your own risk
add a comment |
sudo killall -9 apt && sudo killall -9 dpkg
Use at your own risk
sudo killall -9 apt && sudo killall -9 dpkg
Use at your own risk
answered Sep 21 '18 at 5:36
noonenoone
894520
894520
add a comment |
add a comment |
in my case, after:
- Open Firefox.
- Open terminal
I typed
sudo apt update
sudp apt upgrade
then I get that problems
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
I fixed that, running the command that was showed me after run
sudo apt update
apt list --upgradable
This command will show you a list of programs in my case only Firefox, I closed Firefox, then could ran the command again without problems.
sudo apt upgrade
add a comment |
in my case, after:
- Open Firefox.
- Open terminal
I typed
sudo apt update
sudp apt upgrade
then I get that problems
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
I fixed that, running the command that was showed me after run
sudo apt update
apt list --upgradable
This command will show you a list of programs in my case only Firefox, I closed Firefox, then could ran the command again without problems.
sudo apt upgrade
add a comment |
in my case, after:
- Open Firefox.
- Open terminal
I typed
sudo apt update
sudp apt upgrade
then I get that problems
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
I fixed that, running the command that was showed me after run
sudo apt update
apt list --upgradable
This command will show you a list of programs in my case only Firefox, I closed Firefox, then could ran the command again without problems.
sudo apt upgrade
in my case, after:
- Open Firefox.
- Open terminal
I typed
sudo apt update
sudp apt upgrade
then I get that problems
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
I fixed that, running the command that was showed me after run
sudo apt update
apt list --upgradable
This command will show you a list of programs in my case only Firefox, I closed Firefox, then could ran the command again without problems.
sudo apt upgrade
answered Jan 5 '18 at 19:55
christianbueno.1christianbueno.1
10911
10911
add a comment |
add a comment |
protected by muru Feb 2 '17 at 10:09
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
15
This is also true if you reboot? Maybe some old apt thread is locking the file, you need to find out which and kill it or just rebooting will do it.
– Bruno Pereira
Jan 29 '12 at 11:19
4
This procedure almost always fixes this problem, and when it doesn't, its output (the text from the Terminal) is sometimes useful. If you decide to do it, you can add this text to your question.
– Eliah Kagan
Jun 6 '12 at 9:10
1
I would suggest one more thing that you may note when faced with this issue. Do check if your disk drives are mounted. If they are not, you may not be able to acquire the lock as the package installer will not be able to access the filesystem. Hope this helps. :)
– Hari
Apr 6 '13 at 12:23
48
You can use
sudo lsof /var/lib/dpkg/lock
to find the process that owns the lock file (if empty, assume the lock is left over from a previous boot and can besudo rm
d), then consider doing asudo kill -9 <PID>
(get <PID> fromlsof
output.– waltinator
Mar 17 '14 at 22:01
9
This can be a sign that something else is installing or removing software and has locked the apt database while it performs the actions.
– Foreever
Feb 3 '15 at 4:32