Usually, this error means the packages manager is being used by another process, probably stuck. The error may return an output like
But the same cause may generate different error messages like the shown in the screenshot below.
Other symptoms of the same cause may include the following message.
Or the error is shown below.
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.
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.
You also can run the command below to identify the PID number.
Another way to identify the PID process and print information on its use is using the ps command with grep, as shown below.
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.
The previously used dpkg –configure -a command is used to fix dependency problems.
The command below can also be used to fix dependency problems.
To clean useless dependencies, you can run:
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 https://www.debian.org/doc/manuals/debian-faq/pkgtools.en.html#pkgprogs
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.