π ~1 min read
Table of contents
Symptom & Impact
Scheduled patching fails with could not get lock errors. Critical updates remain unapplied and compliance reporting marks hosts as stale.
Environment & Reproduction
Ubuntu 22.04 LTS with unattended-upgrades and external automation both invoking apt/dpkg. Reproduce by running apt command while unattended-upgrades timer is active.
Root Cause Analysis
dpkg lock files enforce transaction exclusivity. Concurrent package operations collide, and forced lock removal without process checks can corrupt package database state.
Quick Triage
Identify lock holder process and wait for legitimate transaction completion whenever possible. Avoid deleting lock files before confirming process state.
Step-by-Step Diagnosis
Inspect apt and dpkg logs to determine interrupted transactions and whether package configuration is incomplete after previous forced termination.

Solution – Primary Fix
Stop conflicting automation temporarily, complete pending package configuration, then run update and upgrade in a controlled sequence.
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
Use flock wrappers around custom patch scripts, standardize to unattended-upgrades only, or orchestrate updates centrally to avoid overlapping executions.
Verification & Acceptance Criteria
No lock errors in scheduled runs, package database remains consistent, and all pending security updates install successfully within maintenance window.
Rollback Plan
Revert timer changes, restore prior automation schedule, and recover dpkg state from backup if package metadata corruption is detected.
Prevention & Hardening
Serialize package operations with orchestration locks, monitor timer overlap, and alert on repeated lock-contention events before they affect patch SLAs.
Related Errors & Cross-Refs
Connected to interrupted dpkg triggers, half-installed kernel packages, and stale unattended-upgrades jobs that never exited cleanly.
Related tutorial: View the step-by-step tutorial for Ubuntu 22.04 LTS.
View all Ubuntu 22.04 LTS tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Read apt and dpkg manuals, Ubuntu unattended-upgrades docs, and best practices for safe package transaction orchestration.
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.