24 Aug 2024

Fix: Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend.

If you are getting error of process held or cache lock issue in linux while trying to install (sudo apt install example-package) or upgrade (sudo apt upgrade) another packages then you are in right place.

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

Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend.

Why: It is held by process?

This happens when we are trying to install/upgrade another package at the same time:

  1. If we are knowingly already installing or upgrading packages usingĀ Terminal or Package Manager/Software Updater and that process is still running
  2. There might be another process running in the background.

How to resolve Waiting for cache lock: Could not get lock?

To resolve the above issues please follow below steps:

  1. If you are knowingly installing/upgrading then wait for it to complete.
  2. If you don't know the reason then just reboot your system either using UI or using command (sudo reboot). It will terminate all incomplete processes.

You may also like

Python Concurrency: Threads, Processes, and Async

Python provides different ways to write concurrent code, including t...

Continue reading

Introduction to Natural Language Processing with Python

This blog provides a comprehensive introduction to Natural Language ...

Continue reading

Python Image Processing with Opencv and Libraries

Python Image Processing - Get a popular programming language for ima...

Continue reading