📖 ~1 min read
Table of contents
Symptom & Impact
apt update fails with a lock error, delaying security patches and package installs.
Environment & Reproduction
Ubuntu 20.04 LTS server with unattended upgrades overlapping manual apt activity.
Root Cause Analysis
Another apt or dpkg process holds the package database lock to prevent concurrent writes.
Quick Triage
Check active package processes before removing stale lock files.
Step-by-Step Diagnosis
Inspect lock owners, process states, and apt logs to confirm contention source.

Solution – Primary Fix
Allow active process to finish or safely terminate stale process, then repair dpkg state.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Solution – Alternative Approaches
Temporarily stop unattended-upgrades and schedule maintenance windows for manual apt tasks.
Verification & Acceptance Criteria
apt update and apt upgrade complete without lock or dpkg errors.
Rollback Plan
Restore from snapshot if package state becomes inconsistent after manual recovery.
Prevention & Hardening
Avoid parallel package automation and monitor unattended-upgrades completion.
Related Errors & Cross-Refs
Commonly appears with interrupted dpkg configuration and unmet dependency errors.
Related tutorial: View the step-by-step tutorial for Ubuntu 20.04 LTS.
View all Ubuntu 20.04 LTS tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
See man apt, man dpkg, and Ubuntu package management documentation.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.