Fix 'dpkg was interrupted' Error: Run dpkg --configure -a

Linux & Unix Beginner 👁 11 views 📅 May 25, 2026

This error occurs when dpkg is interrupted during package installation or removal. The fix involves running 'sudo dpkg --configure -a' to reconfigure all unpacked packages.

Symptoms

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

E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

Other symptoms include:
  • Inability to install, remove, or update packages.
  • Partial package installations leaving the system in an inconsistent state.
  • Lock files preventing other package operations.

Root Causes

The 'dpkg was interrupted' error typically occurs when:

  • A package installation or removal process is terminated prematurely (e.g., system crash, power failure, or user interruption with Ctrl+C).
  • A previous dpkg operation left packages in an unpacked but unconfigured state.
  • Another package manager process (like Software Center or unattended-upgrades) was running and was killed.
This leaves dpkg in a locked state, requiring manual intervention to complete the pending configuration tasks.

Step-by-Step Fix

Step 1: Run dpkg --configure -a

Open a terminal and execute:

sudo dpkg --configure -a

This command reconfigures all unpacked but unconfigured packages. Wait for it to complete without interruption.

Step 2: Verify Package System

After the command finishes, run:

sudo apt-get check

This checks for broken dependencies. If no errors appear, the fix is complete.

Step 3: Update Package Lists

Optionally, update your package lists:

sudo apt-get update

Step 4: Perform a Full Upgrade

To ensure all packages are up to date:

sudo apt-get upgrade

Alternative Fixes

If dpkg --configure -a fails or hangs, try these alternatives:

  • Remove lock files:
    sudo rm /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/cache/apt/archives/lock
    Then run sudo dpkg --configure -a again.
  • Force reconfigure:
    sudo dpkg --configure -a --force-depends
  • Reinstall broken packages:
    sudo apt-get install -f
  • Check for held packages:
    dpkg --get-selections | grep hold

Prevention

To avoid this error in the future:

  • Never interrupt package operations with Ctrl+C or by closing the terminal.
  • Ensure stable power and avoid system crashes during updates.
  • Use apt instead of apt-get for better error handling.
  • Run only one package manager instance at a time (avoid using Software Center and terminal simultaneously).
  • Regularly run sudo apt-get update && sudo apt-get upgrade to keep the system healthy.

CommandPurpose
sudo dpkg --configure -aReconfigure all unpacked packages
sudo apt-get checkVerify package dependencies
sudo apt-get install -fFix broken dependencies

Was this solution helpful?