Package Manager Lock Error

Hey Linux enthusiastsđź‘‹,

I recently ran into an issue while trying to install packages on my Linux system. The error message I encountered was:

Error: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1234 (apt).

When I search about this, I came across these resources, ruby on rails interview questions Unable to use package manager due to "exclusive lock" error - Ask Ubuntu, and as per them I tried the following:

I made initial checks by identifying if another package management process is currently running by using the following commend:

ps aux | grep -i apt

In addition, I also checked my previous package management process as It can also be the reason behind the error.

But all these didn’t help to get of this issue.

Kindly provide solution.


The error you showed provides a process ID right, did you check that? Don’t know if that will help, but may be it will help.

$ ps -p 1234

This will show what command started the process 1234.


This is a common error when there’s an automatic update check going on, usually short after the computer starts up. It’s telling that there’s already another process running, as pointed out by Nettmann above. It’d be better to wait and let it finish to prevent any misconfiguration from happening.


When you get the lock error on dpkg, that means something else is accessing dpkg, like mentioned by others, typically apt being ran automatically by something else (like an updater or update-checker). You also can’t run “apt install” at the same time you executed an “apt upgrade,” as an example.

1 Like