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

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

When dpkg is interrupted during a package operation, it locks and prevents further installs. Run 'sudo dpkg --configure -a' to reconfigure all unpacked packages and clear the lock.

Symptoms

When running apt-get install, apt upgrade, or dpkg commands, you encounter an error similar to:

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

Other symptoms include:

  • Package manager hangs or freezes during installation.
  • Error messages about lock files (e.g., Could not get lock /var/lib/dpkg/lock-frontend).
  • Inability to install, remove, or update any packages.
  • Partial package configurations left incomplete.

Root Causes

This error occurs when dpkg (Debian package manager) is interrupted while processing a package. Common causes include:

  • Terminal session closed during an installation or upgrade.
  • Power failure or system crash while dpkg was running.
  • Another package management process (like apt-get or aptitude) was killed abruptly.
  • Running multiple package managers simultaneously (e.g., apt and dpkg at the same time).
  • Network interruption during package download that left dpkg in an inconsistent state.

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 not yet configured packages. It will also clear the lock that prevents other operations.

Step 2: Wait for completion

The process may take a few seconds to several minutes depending on the number of packages. Do not interrupt it. You will see output like:

Setting up package-name (version) ...

Step 3: Verify the fix

After completion, test with:

sudo apt-get check

If no errors appear, the issue is resolved. You can now run normal package operations.

Step 4: (If still failing) Remove lock files manually

If the error persists, remove stale lock files:

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

Then reconfigure again:

sudo dpkg --configure -a

Step 5: Force reconfigure (if needed)

If packages remain broken, force reconfiguration:

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

Then update package lists:

sudo apt-get update

Alternative Fixes

Fix broken packages with apt

sudo apt-get install -f

This attempts to fix broken dependencies and complete interrupted installations.

Use dpkg --audit

sudo dpkg --audit

Lists packages in inconsistent states. You can then manually configure or remove them.

Purge and reinstall problematic package

If a specific package is causing issues, identify it with dpkg -l | grep ^..R and then:

sudo dpkg --purge --force-depends package-name
sudo apt-get install package-name

Prevention

  • Always let package operations complete fully before closing the terminal.
  • Use screen or tmux for long-running installations to protect against session drops.
  • Avoid running multiple package managers at the same time.
  • Ensure stable power and network connectivity during updates.
  • Regularly run sudo apt-get update && sudo apt-get upgrade to keep the system in good shape.
  • If using automated scripts, add error handling to detect and restart interrupted dpkg processes.

By following these steps, you can quickly resolve the dpkg interrupted error and restore normal package management functionality on your Linux system.

Was this solution helpful?