E: Could not get lock /var/lib/dpkg/lock-frontend — is another process using it?
apt can’t run because another package operation (often automatic updates) holds the dpkg lock.
Seen on:
Linux
Meaning
Only one apt/dpkg process may run at a time. On fresh servers, unattended-upgrades frequently runs right after boot. Deleting the lock files while a process is running can corrupt the package database.
Common causes
- unattended-upgrades / apt-daily running
- Another terminal or script running apt
- A previous apt run crashed and left dpkg half-configured
⚡ Quick fix
- Wait a few minutes and retry
- See what holds it:
sudo lsof /var/lib/dpkg/lock-frontend - If nothing runs:
sudo dpkg --configure -a - Never delete lock files while apt/dpkg is running
Detailed fix by platform
Linux
- Find the holder and recover:bash
ps aux | grep -E 'apt|dpkg|unattended' | grep -v grep sudo lsof /var/lib/dpkg/lock-frontend # only when no apt/dpkg process is running: sudo dpkg --configure -a sudo apt -f install
How to diagnose
- Holder — Which process owns the lock?
- State — Interrupted dpkg run?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026