Fix 'dpkg was interrupted' Error on Debian/Ubuntu

Linux & Unix Intermediate 👁 14 views 📅 May 25, 2026

When dpkg is interrupted during package operations, it locks the package system. This guide provides steps to reconfigure and unlock dpkg to resume normal package management.

Symptoms

When running apt-get install or dpkg commands, you encounter an error message similar to:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
This prevents any package installation, removal, or update operations. The system may also show a lock file error indicating that another process is using the package database.

Root Causes

This error occurs when a dpkg operation (such as package installation, upgrade, or removal) is abruptly terminated. Common causes include:

  • Power failure or system crash during package operations
  • Killing the dpkg or apt process manually (e.g., Ctrl+C)
  • Network interruption during package downloads
  • Running multiple package management commands simultaneously
  • Corrupted package state database

Step-by-step Fix

  1. Run dpkg --configure -a
    Open a terminal and execute:
    sudo dpkg --configure -a
    This forces dpkg to reconfigure all partially installed packages. It may take several minutes. If it completes without errors, your package manager is restored.
  2. Check for lock files
    If the previous step fails with a lock error, remove stale lock files:
    sudo rm /var/lib/dpkg/lock-frontend
    sudo rm /var/lib/dpkg/lock
    sudo rm /var/cache/apt/archives/lock
    sudo rm /var/lib/apt/lists/lock
  3. Reconfigure again
    After removing locks, run:
    sudo dpkg --configure -a
  4. Fix broken packages
    If issues persist, use:
    sudo apt --fix-broken install
  5. Update package list
    Finally, update and upgrade:
    sudo apt update
    sudo apt upgrade

Alternative Fixes

Force reconfigure with verbose output

Use sudo dpkg --configure -a --force-depends to bypass dependency checks if needed.

Reinstall dpkg itself

If dpkg is corrupted, download and reinstall it manually from the Debian/Ubuntu repository using wget and dpkg -i.

Use apt-get clean

Clear the cache: sudo apt-get clean then retry.

Prevention

  • Always allow package operations to complete fully before closing the terminal or shutting down.
  • Use screen or tmux for long-running package updates to avoid accidental disconnection.
  • Avoid running multiple apt or dpkg commands at the same time.
  • Keep your system updated regularly to reduce the chance of large package sets being processed.
  • Use a UPS to prevent power loss during critical updates.

Conclusion

The 'dpkg was interrupted' error is common but easily fixed by reconfiguring dpkg and removing lock files. Following the steps above will restore normal package management functionality on Debian-based systems.

Was this solution helpful?