E: dpkg was interrupted

Fix dpkg Interrupted Error: Run dpkg --configure -a

When dpkg is interrupted during package installation or upgrade, it leaves the system in an inconsistent state. Running 'dpkg --configure -a' and then 'apt-get install -f' resolves the issue by completing pending configurations.

Symptoms

When running apt-get or apt commands on Debian-based Linux distributions (such as Ubuntu, Debian, or Kali), you may encounter the following error message:

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

This error prevents any package installation, removal, or upgrade operations. The system may also show a warning about a lock file or incomplete package status.

Root Causes

The error occurs when the dpkg package manager is interrupted while processing package configuration scripts. Common causes include:

  • Forced termination of an ongoing package installation or upgrade (e.g., Ctrl+C, system crash, power loss)
  • Network failure during a package download that leaves packages in a half-configured state
  • Running multiple package management commands simultaneously (e.g., two terminals running apt-get install)
  • Insufficient disk space during package installation

Step-by-Step Fix

Follow these steps to resolve the issue:

Step 1: Run dpkg --configure -a

Open a terminal and execute the following command to configure all unpacked but not yet configured packages:

sudo dpkg --configure -a

This command will attempt to complete any pending package configurations. It may prompt you for input (e.g., time zone, keyboard layout). Provide the appropriate responses.

Step 2: Fix Broken Dependencies

After the configuration completes, run the following command to fix any broken dependencies:

sudo apt-get install -f

The -f flag (short for --fix-broken) will attempt to correct any dependency issues and complete interrupted installations.

Step 3: Update Package Cache

Update the package list to ensure consistency:

sudo apt-get update

Step 4: Verify and Clean Up

Run a full upgrade to ensure all packages are up to date and no further issues exist:

sudo apt-get upgrade

If the upgrade completes without errors, the problem is resolved.

Alternative Fixes

If the standard fix does not work, try these alternatives:

Alternative 1: Remove Lock Files

If you see a lock file error, remove stale lock files:

sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock

Then retry sudo dpkg --configure -a and sudo apt-get install -f.

Alternative 2: Force Reconfigure

If a specific package is causing the issue, force reconfigure it:

sudo dpkg --configure -a --force-depends

Alternative 3: Check Disk Space

Ensure you have enough free space:

df -h

If /var is full, free up space by removing old package archives:

sudo apt-get clean

Prevention

To avoid this error in the future:

  • Never interrupt package operations (do not close terminal or press Ctrl+C during installation)
  • Ensure stable power and network connectivity before running updates
  • Run only one package management command at a time
  • Keep sufficient free disk space (at least 1 GB recommended for /var)
  • Regularly run sudo apt-get update and sudo apt-get upgrade to keep the system consistent

By following these steps, you will be able to recover from a dpkg interruption and restore normal package management functionality.

Related Errors in Linux & Unix
Fix 'bash: command not found' When Path Goes Wrong sudo: no tty present and no askpass program specified Fix sudo: no tty present and no askpass program specified Permission denied Fix 'Permission denied' when running sudo on Linux Permission denied (publickey) Fix 'Permission denied' (SSH public key) in Linux

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.