📖 ~1 min read
Table of contents
Symptom & Impact
Command output states ‘dpkg was interrupted, you must manually run sudo dpkg –configure -a’, blocking software updates.
Environment & Reproduction
Ubuntu 20.04 machine after power loss, terminal closure, or forced stop during apt/dpkg transaction.
Root Cause Analysis
Package configuration scripts were not completed, leaving dpkg status entries in half-configured state.
Quick Triage
Check current state with ‘sudo dpkg –audit’ and confirm free disk space in ‘/var’ and root filesystem.
Step-by-Step Diagnosis
Review ‘/var/log/dpkg.log’ for failing package, then inspect postinst script failures and dependency chain.

Solution – Primary Fix
Run ‘sudo dpkg –configure -a’, then ‘sudo apt -f install’ and repeat until no broken packages remain.
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
Reinstall offending package with ‘sudo apt install –reinstall ‘ or purge/reinstall if script corruption persists.
Verification & Acceptance Criteria
‘sudo dpkg –audit’ returns clean, apt operations succeed, and no packages are left half-installed.
Rollback Plan
Restore from VM snapshot or filesystem backup if core package set becomes unrecoverable.
Prevention & Hardening
Avoid forced reboot during upgrades and use UPS on servers to reduce abrupt transaction interruption.
Related Errors & Cross-Refs
E: Sub-process /usr/bin/dpkg returned an error code, lock errors, and unmet dependency loops.
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
man dpkg, man apt-get, and Ubuntu community guides for broken package recovery.
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.