📖 ~1 min read
Table of contents
Symptom & Impact
Administrators observe: Ubuntu 26.04 LTS – apt update fails because dpkg lock is held by another process. Security updates are delayed, package operations stall, and deployment timelines slip.
Environment & Reproduction
Issue appears on Ubuntu 26.04 LTS systems where automatic updates overlap with manual apt operations.
# Baseline context
lsb_release -a
uname -r
ps -ef | grep -E 'apt|dpkg|unattended'
sudo systemctl status unattended-upgrades --no-pager
sudo journalctl -p err -n 50 --no-pager
Root Cause Analysis
The lock file under /var/lib/dpkg or /var/lib/apt/lists is typically owned by unattended-upgrades, apt.systemd.daily, or a stale process from an interrupted transaction.
Quick Triage
Confirm lock ownership and transaction health before forcing any cleanup.
# Quick triage
sudo fuser -v /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/lib/apt/lists/lock || true
sudo ps -fp $(pgrep -d ' ' -f 'apt|dpkg|unattended-upgrades') || true
sudo dpkg --audit
sudo apt-cache policy
Step-by-Step Diagnosis
Identify the active process and determine whether it is progressing or stuck.
# Detailed diagnosis
sudo systemctl list-timers --all | grep -E 'apt|unattended'
sudo tail -n 100 /var/log/apt/term.log
sudo tail -n 100 /var/log/dpkg.log
sudo lsof /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/lib/apt/lists/lock || true

Solution – Primary Fix
Allow active package jobs to finish, then complete pending dpkg configuration and refresh metadata.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
# Primary fix
sudo systemctl stop unattended-upgrades apt-daily.service apt-daily-upgrade.service
sudo dpkg --configure -a
sudo apt-get -f install -y
sudo apt-get update
sudo apt-get upgrade -y
sudo systemctl start unattended-upgrades

Solution – Alternative Approaches
If lock ownership is stale, remove only after confirming no package process is active.
# Alternative cleanup
pgrep -fa 'apt|dpkg|unattended-upgrades' || true
sudo rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/lib/apt/lists/lock
sudo dpkg --configure -a
sudo apt-get update
Verification & Acceptance Criteria
Package commands should complete without lock or broken dependency errors.
# Verify
sudo apt-get update
sudo apt-get -s upgrade
sudo dpkg --audit
systemctl is-active unattended-upgrades
Rollback Plan
If changes introduce regressions, revert package state using apt logs and snapshots.
# Rollback guidance
cat /var/log/apt/history.log | tail -n 80
sudo apt-get install --reinstall apt dpkg
# Restore VM or filesystem snapshot if available
Prevention & Hardening
Reduce overlap between automated and manual package operations.
# Hardening
sudo systemctl edit apt-daily.timer
sudo systemctl edit apt-daily-upgrade.timer
sudo systemctl restart apt-daily.timer apt-daily-upgrade.timer
sudo unattended-upgrade --dry-run --debug
Related Errors & Cross-Refs
Related messages include Could not get lock, dpkg was interrupted, and E: Unmet dependencies after partial upgrades.
Related tutorial: View the step-by-step tutorial for Ubuntu 26.04 LTS.
View all Ubuntu 26.04 LTS tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Ubuntu Server Guide for package management, apt and dpkg manuals, and unattended-upgrades 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.