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

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

When dpkg is interrupted during a package operation, it locks the database. Run 'sudo dpkg --configure -a' to reconfigure all unpacked but not configured packages and clear the lock.

Symptoms

When using apt or dpkg on Debian-based Linux systems (e.g., Ubuntu, Mint), you may encounter an error message like:

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

  • Inability to install, remove, or update packages.
  • Lock file errors when running apt commands.
  • System hanging or crashing during a previous package operation.

Root Causes

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

  • Power failure or system crash during package installation.
  • User pressing Ctrl+C or closing the terminal during an apt/dpkg command.
  • Network interruption causing incomplete downloads.
  • Conflicting package operations running simultaneously.

When dpkg is interrupted, it leaves the package database in an inconsistent state, marking packages as unpacked but not configured. The lock file (/var/lib/dpkg/lock) may also remain, blocking new operations.

Step-by-Step Fix

Step 1: Run dpkg --configure -a

Open a terminal and execute:

sudo dpkg --configure -a

This command reconfigures all packages that were unpacked but not fully configured. It processes each package in the queue and completes the interrupted setup.

Step 2: Wait for Completion

Let the command run without interruption. It may take several minutes depending on the number of packages. Do not close the terminal or press Ctrl+C.

Step 3: Verify the Fix

After completion, test by running:

sudo apt update

If no error appears, the issue is resolved.

Step 4: Clean Up (if needed)

If the error persists, remove stale lock files:

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

Then run sudo dpkg --configure -a again.

Alternative Fixes

Force Reconfigure

If the standard command fails, use:

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

Reinstall the Package

Identify the problematic package from the error log and reinstall it:

sudo apt install --reinstall package-name

Use apt-get instead

Sometimes apt-get provides more detailed output:

sudo apt-get install -f

Prevention

  • Always allow package operations to complete fully before closing the terminal or shutting down.
  • Use a UPS to prevent power loss during updates.
  • Avoid running multiple package managers (apt, dpkg, synaptic) simultaneously.
  • Keep your system updated to reduce the risk of package conflicts.
  • If you need to cancel an operation, use Ctrl+C only as a last resort; instead, wait for it to finish.

By following these steps, you can quickly recover from a dpkg interruption and restore normal package management functionality.

Was this solution helpful?