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

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

When dpkg is interrupted during package installation or update, it locks the package manager. Running 'sudo dpkg --configure -a' completes pending configurations and restores normal operation.

Symptoms

When dpkg is interrupted, you may see errors like:

  • E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
  • E: Could not get lock /var/lib/dpkg/lock-frontend
  • E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

These messages appear when running apt install, apt upgrade, or dpkg commands. The system refuses to proceed until the interruption is resolved.

Root Causes

The dpkg package manager can be interrupted by:

  • Aborting an installation or upgrade with Ctrl+C or closing the terminal
  • Power failure or system crash during package operations
  • Running multiple package management commands simultaneously (e.g., two terminals running apt)
  • Network timeout causing partial download and configuration

When dpkg is interrupted, it leaves the package database in an inconsistent state. The lock files prevent concurrent modifications, and pending configuration scripts remain unexecuted.

Step-by-Step Fix

Step 1: Identify the Lock

First, check if any apt or dpkg process is still running:

ps aux | grep -E 'apt|dpkg'

If processes are active, wait for them to finish or kill them with sudo kill <PID>.

Step 2: Remove Stale Lock Files (If Necessary)

If no process is running but locks remain, remove them:

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

Warning: Only remove locks if you are certain no other package manager instance is active.

Step 3: Run dpkg --configure -a

This command reconfigures all partially installed packages:

sudo dpkg --configure -a

It will process any pending configurations. If it asks questions, answer them appropriately. This may take several minutes.

Step 4: Fix Broken Dependencies

After configuration, repair any broken dependencies:

sudo apt --fix-broken install

This will install missing dependencies and remove problematic packages if needed.

Step 5: Update Package Lists

Refresh the package index:

sudo apt update

Step 6: Upgrade System

Finally, upgrade all packages to ensure consistency:

sudo apt upgrade

Alternative Fixes

Force Reconfigure Specific Package

If you know which package caused the issue, reconfigure it individually:

sudo dpkg --configure <package-name>

Use apt-get Instead

Sometimes apt-get handles interruptions better:

sudo apt-get install -f

Purge and Reinstall

For stubborn packages, purge and reinstall:

sudo dpkg --purge --force-depends <package-name>
sudo apt install <package-name>

Prevention

  • Never interrupt package operations with Ctrl+C or by closing the terminal
  • Use screen or tmux for long-running updates to avoid accidental disconnection
  • Ensure stable power (use UPS) and network connection during updates
  • Avoid running multiple package management commands simultaneously
  • Regularly run sudo apt update && sudo apt upgrade to keep the system current
  • Before major upgrades, back up the dpkg database: sudo cp -r /var/lib/dpkg /var/lib/dpkg.backup

By following these steps, you can quickly recover from a dpkg interruption and prevent future occurrences. The key command sudo dpkg --configure -a is the standard fix recognized by all Debian-based distributions.

Was this solution helpful?