Fix: waiting for cache lock ubuntu var/lib/dpkg/lock-frontend

The dpkg is a utility to download or install any applications from the Debian repository. The “.deb” package is utilized for downloading any application by specifying the package name. An error “waiting for cache lock ubuntu var/lib/dpkg/lock-frontend” comes across during the installation of the package. The purpose of this guide is to explain all possible solutions to encounter the above-mentioned error.

The content of this article is as below:  

Reason: Package Manager dpkg Already Used

The package manager executes some configuration files while installing or removing some packages from the operating system. If dpkg does not properly compile required files due to involvement in installing any other application, the error will generate.

Solution 1: Wait for Running Process

One of the best solutions is to just wait for the execution of processes that are currently run. After the completion, you can execute the required command in the terminal.

Solution 2: Kill Running Process

An alternative solution is also available to stop the running process from generating the error. To display the list of the running processes is possible by following the below procedure:

Display Running Process

The “ps” command is utilized to display the running processes by utilizing the “grep” that matches the pattern which is executing with “apt”. For this, execute the below script:

$ ps aux | grep -i apt

In our case, you can visualize the list of running processes such as “VLC” has process id “3770” that causes the waiting error. 


Also, you can find out the running dpkg packages by following the below script:

$ ps aux | grep -i dpkg


Another way to locate the running process id is possible through the “lsof” command. It displays the list of the open files on which the particular process is running:

$ sudo lsof /var/lib/dpkg/lock

Kill Specific Process via ID

To kill the “vlc” process, the “kill” command is utilized with the “-9” signal that kills the running process whose id is “3770”:

$ sudo kill -9 3770

You can verify that the “vlc” process whose id “3770” has been successfully killed as seen below:

$ ps aux | grep -i apt

Solution 3: Remove the Lock File

One of the solutions to tackle the error is possible to remove the “lock-frontend” file that generates the error. These files do not permit change of the system files during the execution of any process (installing or uninstalling packages). To remove the “lock-frontend”, the “rm” command is utilized specifying the path directory:

$ sudo rm /var/lib/dpkg/lock-frontend

Update Debian Package Manager

To apply the changes, execute the below script for updating the Debian package as below:

$ sudo dpkg --configure -a

After executing the above process, update the repository using the root privilege “sudo” via the below command:

$ sudo apt update

That is all from the guide.


The error “waiting for cache lock ubuntu var/lib/dpkg/lock-frontend” occurs due to the involvement of the dpkg package manager in another running process. It can be resolved by waiting for the executing process or killing the running process via process name or PID. This guide will demonstrate all possible solutions to resolve errors in the Ubuntu operating system.