Resolve dpkg status database is locked by another process

This tutorial explains how to fix the error “dpkg status database is locked by another process” in Debian-based Linux distributions.

Usually, this error means the packages manager is being used by another process, probably stuck. The error may return an output like

dpkg status database is locked by another process

But the same cause may generate different error messages like the shown in the screenshot below.

dpkg: error: dpkg frontend lock is locked by another process

Other symptoms of the same cause may include the following message.

Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 2839 (apt)... 30s

Or the error is shown below.

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

In most cases, previous examples are reporting you are already installing, upgrading, or removing packages. In some cases, multiple administrators may be managing software through packages manager, or a process may block the application (dpkg), and killing that process as explained below solves the problem.

Note: Always remember to use dpkg and apt with sudo.

How to fix dpkg or apt locked or temporarily unavailable:

You need to identify the process occupying dpkg or apt to kill it. To identify the process, you can use the command below.

sudo lsof /var/lib/dpkg/lock

As you can see, the process ID (PID) is 16386. To kill it, run the command below, replacing 16386 for the actual PID using the packages manager.

sudo kill -9 16386

You also can run the command below to identify the PID number.

sudo lsof /var/cache/apt/archives/lock

Then run:

sudo dpkg --configure -a

Another way to identify the PID process and print information on its use is using the ps command with grep, as shown below.

ps aux | grep apt

Fixing other dpkg and apt errors

In this section, you can find some command combinations to fix several apt and dpkg problems.

The first command you should run before problems is apt-update, as shown below. This command updates apt repositories.

sudo apt-get update

The previously used dpkg –configure -a command is used to fix dependency problems.

sudo dpkg --configure -a

The command below can also be used to fix dependency problems.

sudo apt-get -f install

To clean useless dependencies, you can run:

sudo apt-get clean

About Debian package managers

Debian’s available package managers include dpkg, apt, apt-get, aptitude, synaptic, and dpkg-deb.

  • dpkg: Dpkg is the main package manager for Debian and its based distributions.
  • apt: is a frontend for dpkg capable of fetching packages and resolving dependencies.
  • aptitude: An interactive frontend for apt.
  • Synaptics: Graphical packages manager.
  • dpkg-deb: Another command to install .deb packages.

You can find additional information on all Debian package managers at


As you can see, fixing dpkg or apt issues is pretty easy, and most errors have known causes. The commands explained above can fix almost all issues related to broken packages or interrupted procedures. Since apt and aptitude are dpkg frontends, usually measures to fix problems are the same. If all steps described, don’t work and your error is taking place on a desktop computer, restarting your computer must release the packages manager. But all steps above, if applied correctly, must do the work.

I hope this article explaining how to resolve the “dpkg status database is locked by another process” error was useful.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.