Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I just wondered if somebody could tell me what this means:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
reidsr@ubuntu:~$ sudo dpkg --configure -a
dpkg: error: dpkg status database is locked by another process

How do I run sudo dpkg --configure -a manually?

share|improve this question
Is this machine important, that is to say, can you reboot it? Should resolve this real quick – Huckle Nov 20 '12 at 0:19
possible duplicate of How do I fix dpkg errors after a failed upgrade? – Raja Mar 15 '13 at 13:19

3 Answers 3

First run:

lsof /var/lib/dpkg/lock

Then make sure that process isn't running:

ps cax | grep PID

If it is running:

kill PID
kill -9 PID

Make sure process is done:

ps cax | grep PID

Then remove the lock file:

sudo rm /var/lib/dpkg/lock

Let dpkg fix itself:

sudo dpkg --configure -a

You should be fine afterwards :)

share|improve this answer
One should never remove lockfiles manually. They're there for a reason. Please, only use this as a very last resort. First try to identify and close other applications using the package management. – gertvdijk May 6 '13 at 16:06
If there is a process actually using the lock file, it would probably be better to kill that process instead of just removing the lock file. You should be able to find the process with lsof /var/lib/dpkg/lock. – Abe Voelker May 27 '14 at 15:34
A strong +1 for Abe's comment. Never remove a lockfile without killing all processes that have open file descriptors to it. – Pooyan Khosravi Jan 20 at 6:48
@PooyanKhosravi That should probably be your own answer, I'd upvote it instead – Xen2050 Jan 20 at 8:06
@Xen2050 IMO a new answer adds unnecessary clutter. If you think a bash script that does same thing automatically is usable I'll write it as another answer. – Pooyan Khosravi Jan 20 at 8:13

You can not run several packages applications/commands/tools at the same time. Sometimes, it means that synaptic, apt-get or the package update tool are running in the backgroung. Just close other package tools, or wait for them to be finished. And dpkg will run.

share|improve this answer

One could also try:

sudo apt-get install -f

To fix any broken packages:

Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. If packages are specified, these have to completely correct the problem. The option is sometimes necessary when running APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system's dependency structure can be so corrupt as to require manual intervention (which usually means using dselect(1) or dpkg --remove to eliminate some of the offending packages). Use of this option together with -m may produce an error in some situations. Configuration Item: APT::Get::Fix-Broken.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.