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

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

When dpkg is interrupted during package installation or upgrade, it locks the package manager. This guide shows how to resolve the error by running dpkg --configure -a and repairing the package database.

Symptoms

When running apt-get install, apt upgrade, or any package management command, you encounter an error similar to:

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

You may also see:

  • Package operations hang or fail
  • System update stalls
  • Cannot install or remove any packages
  • Package manager reports a lock file

Root Causes

This error occurs when the dpkg package manager is interrupted while processing packages. Common causes include:

  • System crash or power failure during installation
  • User terminates the process (Ctrl+C)
  • Network interruption during download
  • Conflicting package operations running simultaneously
  • Incomplete package scripts

When interrupted, dpkg leaves the package database in an inconsistent state, preventing further operations until it is reconfigured.

Step-by-Step Fix

Step 1: Check for Lock Files

First, ensure no other package manager process is running. Remove stale lock files if necessary:

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

Step 2: Run dpkg --configure -a

Execute the recommended command to reconfigure all unpacked but not configured packages:

sudo dpkg --configure -a

This processes all pending package configurations. It may take several minutes.

Step 3: Repair Broken Packages

After configuration, fix any broken dependencies:

sudo apt-get install -f

This will attempt to correct broken packages and complete installations.

Step 4: Update Package Lists

Refresh the package index:

sudo apt update

Step 5: Upgrade System

Perform a full upgrade to ensure consistency:

sudo apt upgrade

Alternative Fixes

Force Reconfigure All Packages

If the above fails, force reconfigure all packages:

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

Use apt-get clean

Clear the local repository of retrieved package files:

sudo apt-get clean
sudo apt-get autoclean

Manual Package Removal

If a specific package is problematic, remove it manually:

sudo dpkg --remove --force-remove-reinstreq <package-name>

Then reinstall it.

Check for Stuck Processes

Kill any stuck dpkg processes:

sudo killall dpkg
sudo killall apt-get

Prevention

  • Always allow package operations to complete fully
  • Use screen or tmux for long operations to avoid accidental disconnection
  • Ensure stable power and network connections
  • Do not run multiple package managers simultaneously
  • Regularly run sudo apt update && sudo apt upgrade to keep the system healthy
  • Back up the package list: dpkg --get-selections > package-list.txt

By following these steps, you can resolve the dpkg interruption error and restore normal package management functionality.

Was this solution helpful?