/errors/apt/could-not-get-lock
apt: Could not get lock /var/lib/dpkg/lock-frontend
The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
- tool
- apt
- exit code
- 100
- versions
- Debian 10+, Ubuntu 18.04+
- os
- linux
apt and dpkg take a lock on /var/lib/dpkg/lock-frontend (and /var/lib/dpkg/lock) so that only one process changes the package database at a time. A second process stops with:
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1234 (unattended-upgr)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?The message names the process. Most often it is unattended-upgrades, which installs security updates shortly after boot.
Find the process and wait
sudo lsof /var/lib/dpkg/lock-frontend
ps -o pid,etime,cmd -C apt,apt-get,dpkg,unattended-upgrIn scripts and CI, let apt wait for the lock instead of failing:
sudo apt-get -o DPkg::Lock::Timeout=300 install -y curlIf dpkg was interrupted
When nothing holds the lock but apt says dpkg was interrupted, finish the pending configuration:
sudo dpkg --configure -a
sudo apt-get -f installSources
Related pages
errors · aptapt: E: Unable to locate packageapt install fails with E: Unable to locate package when package lists are outdated, the name is wrong, or the package is in a repository that is not enabled.compare · aptapt vs apt-get: which one to useapt is the friendlier front end for interactive use, with progress bars, apt list and search; apt-get keeps a stable interface, so scripts should use it.codes · aptdpkg -l status codes: ii, rc, un, iU, iF explainedThe status codes at the start of dpkg -l lines: desired action, then current state. ii means installed, rc removed with config left, iU unpacked, iF failed.