Linux Error: dpkg was interrupted, you must manually run dpkg --configure -a — Cause, Fix, and Troubleshooting Guide
How to fix the Linux 'dpkg was interrupted, you must manually run dpkg --configure -a' error: recover a half-configured package database on Debian and Ubuntu safely.
- #linux
- #troubleshooting
- #ubuntu
- #apt
- #package-management
Summary
dpkg was interrupted, you must manually run dpkg --configure -a to correct the problem means a previous package transaction was cut off before dpkg finished configuring one or more packages. The dpkg database is now in a half-configured state, and apt refuses to do anything else until you resolve it. On Debian/Ubuntu the fix is usually a single command — but a failing dpkg --configure -a points at a deeper problem (a broken maintainer script, disk full, or a package conflict) that needs diagnosis.
Common Symptoms
- Every apt command aborts with
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. apt-get install/apt-get upgraderefuse to proceed.- Packages appear “half-configured” or “half-installed” in
dpkg -l(statusiForiU). - Follows a power loss, an OOM kill, a killed apt process, or a disk-full event mid-upgrade.
Most Likely Causes of the ‘dpkg was interrupted’ Error
The most common production cause is an upgrade interrupted by a reboot, an OOM kill, or an operator sending kill -9 to apt/dpkg. Other causes:
/,/var, or/bootfilled up mid-transaction (kernel installs are a frequent trigger).- A package’s
postinst/preinstmaintainer script exited non-zero. - A debconf prompt was never answered and the process was terminated.
- A dependency or version conflict left one package unconfigured.
Quick Triage
# Confirm the interrupted state and see what is half-done
sudo dpkg --audit
# Find packages not in the fully-installed 'ii' state
dpkg -l | grep -vE '^ii' | grep -E '^.[FUH]'
# Make sure you are not simply out of disk
df -h / /var /boot
Diagnostic Commands
# The canonical repair — also surfaces the real underlying error if it fails
sudo dpkg --configure -a
# List half-configured / half-installed packages explicitly
dpkg --get-selections | grep -v install
sudo dpkg --audit
# If a maintainer script is failing, run apt with full output to see which one
sudo apt-get -f install
# Check space and inodes — a full disk causes silent config failures
df -h
df -i
Read the output of dpkg --configure -a carefully: the last package it names before the error is the one blocking recovery.
Fix / Remediation
-
Run the recommended command first. In most cases this fully recovers the system:
sudo dpkg --configure -a -
Resolve broken dependencies that the interrupted run left behind:
sudo apt-get -f install sudo apt-get update -
If
dpkg --configure -afails on a specific package, free disk space or fix the cause it reports, then retry. For a full disk:sudo apt-get clean # reclaim /var/cache/apt/archives sudo journalctl --vacuum-size=200M sudo apt-get autoremove --purge -
If a single package’s maintainer script is broken, reconfigure or reinstall just that package:
sudo dpkg --configure <pkg> sudo apt-get install --reinstall <pkg> -
As a last resort for a package whose script cannot succeed, force-remove and reinstall it:
sudo dpkg --remove --force-remove-reinstreq <pkg> sudo apt-get install <pkg>
Warning: Do not delete files under
/var/lib/dpkg/(such asstatusorinfo/) to “fix” this. Editing the dpkg state by hand can permanently corrupt the package database. Letdpkg --configure -aand apt do the repair.
Validation
# Should report nothing pending
sudo dpkg --audit
# A clean run of these confirms recovery
sudo apt-get -f install
sudo apt-get update
sudo apt-get -s upgrade # simulate; should plan without errors
Prevention
- Never
kill -9apt/dpkg — send SIGINT and let the transaction unwind. - Keep headroom on
/,/var, and/boot; kernel upgrades fail loudly when/bootis full. - On cloud instances, avoid rebooting while
unattended-upgradesmay be running. - Monitor disk and inode usage so upgrades never run into a full filesystem.
- On RHEL/Rocky/Alma the equivalent recovery for a broken transaction is
dnf historyplusrpm --rebuilddb; the principle — let the package manager repair its own state — is identical.
Related Errors
- Could not get lock /var/lib/dpkg/lock-frontend
- The following packages have unmet dependencies
- No space left on device
- rpmdb BDB0113 thread/process failed
Final Notes
dpkg --configure -a is designed exactly for this situation and resolves it most of the time. When it does not, treat its error message as the real incident — usually disk space or a failing maintainer script — and fix that before retrying. Avoid hand-editing dpkg state; the tooling is the safest path back to a consistent database.
Want faster Linux incident response? Use DevOps AI Toolkit to turn production errors into clear diagnostics, remediation steps, and reusable runbooks.
Download the Free 500-Prompt DevOps AI Toolkit
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.