The "E: dpkg was interrupted" error occurs on Debian-based systems when package installation or updates are terminated prematurely, leaving packages unconfigured. The standard solution is to run sudo dpkg --configure -a in the terminal to complete pending setups. For more details, visit Ask Ubuntu. E: dpkg was interrupted... run 'sudo dpkg --configure
The error message "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem" typically occurs when a package installation or system update is forcibly stopped. This can happen due to a power failure, manual interruption of the terminal (like pressing Ctrl+C), or an unexpected system reboot during an update. Primary Solution
The most direct way to resolve this is to run the command explicitly mentioned in the error: sudo dpkg --configure -a Use code with caution. Copied to clipboard
This command resumes the configuration of all unpacked but unconfigured packages currently in the system database. Extended Troubleshooting
If the standard command fails or the system remains stuck, follow these progressive steps:
Fix Broken DependenciesIf the interruption left dependencies in a messy state, use the APT repair tool: sudo apt-get install -f # OR sudo apt --fix-broken install Use code with caution. Copied to clipboard
This attempts to download and repair missing or broken package dependencies.
Clear Lock FilesIf you receive an error saying a lock file is held (e.g., Could not get lock /var/lib/dpkg/lock), rebooting your computer usually releases the lock. Alternatively, you can manually remove the lock files as a last resort: sudo rm /var/lib/dpkg/lock-frontend sudo rm /var/lib/apt/lists/lock.
Clear Corrupted Update FilesIf the error persists due to a corrupted package file, you may need to clear the updates directory: cd /var/lib/dpkg/updates sudo rm * sudo apt-get update Use code with caution. Copied to clipboard
Warning: Only perform this if the initial dpkg --configure -a command continues to fail.. Preventive Tips The "E: dpkg was interrupted" error occurs on
Avoid Shutdowns: Never turn off your machine during a package installation or a sudo apt upgrade.
Check Background Processes: On systems like Ubuntu, unattended-upgrades may be running in the background; check for active apt processes before rebooting.
Fixing the "dpkg was interrupted" Error in Linux If you’ve been managing a Debian-based system like Ubuntu, Linux Mint, or Kali, you’ve likely encountered this daunting terminal message:
"E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem."
This error usually pops up when a software installation, update, or removal process is forcefully stopped—perhaps due to a lost internet connection, a sudden power failure, or the user hitting Ctrl+C during a sensitive operation.
While it looks serious, it’s actually one of the most straightforward Linux package management issues to fix. Here is your step-by-step guide to getting your system back on track. 1. The Standard Fix
The error message itself provides the most common solution. Open your terminal and type: sudo dpkg --configure -a Use code with caution. What this does:
The dpkg command is the base package manager for Debian systems. The --configure flag tells it to look for packages that have been unpacked but not yet set up. The -a (or --pending) flag ensures it processes all currently unfinished packages. 2. If the Standard Fix Fails (Common Roadblocks)
Sometimes, running the command above results in another error, such as "Could not get lock." This happens because another process (like the Software Updater or an unattended upgrade) is still running in the background. Step A: Remove the Lock Files See dpkg status and errors:
If you are certain no other update is running, you may need to manually remove the lock files that are preventing dpkg from working:
sudo rm /var/lib/dpkg/lock-frontend sudo rm /var/lib/dpkg/lock Use code with caution. Step B: Force the Reconfiguration
After removing the locks, try the configuration command again: sudo dpkg --configure -a Use code with caution. 3. Dealing with Broken Dependencies
If dpkg finishes but you still can't install new software, you might have "broken dependencies." This happens when one package requires another that wasn't properly installed. Fix this using apt: sudo apt update sudo apt install -f Use code with caution.
The -f (or --fix-broken) flag tells APT to attempt to correct a system with broken dependencies in place. 4. The "Last Resort": Clearing the Package Cache
In rare cases, the downloaded package file itself is corrupted. If the errors persist, clear out your local repository of retrieved package files: sudo apt clean sudo apt update Use code with caution.
This forces the system to download fresh copies of the software next time you run an install command. Pro-Tip: Avoid the "Interruption" in the Future To prevent this error from happening again: Never close the terminal while an installation is running. Don't pull the plug or reboot during a system upgrade.
Check your battery: If you’re on a laptop, ensure you’re plugged into power before starting a large dist-upgrade.
The "dpkg was interrupted" error is essentially your system’s way of saying, "I started a job but didn't get to finish it." By running sudo dpkg --configure -a, you’re simply giving the system the green light to finish that work and clean up the mess. sudo dpkg --audit
sudo dpkg --configure -a
Are you still seeing a specific error code or package name after trying these commands?
The error message is actually giving you the exact command you need to fix the issue. However, just typing it in sometimes isn't enough if there are other locks on the system.
Follow these steps in order to get your system back to normal.
sudo dpkg --audit
sudo dpkg --configure -a
sudo lsof /var/lib/dpkg/lock /var/lib/dpkg/lock-frontend /var/lib/apt/lists/lock /var/cache/apt/archives/lock
sudo tail -n 200 /var/log/dpkg.log
sudo journalctl -u apt -n 200 # if systemd logs apt
df -h
df -i
mount | grep 'on / '
sudo dmesg | tail -n 50
It helps to understand the tools you are using so you feel more confident fixing the issue.
sudo: Gives you administrative (root) privileges. You need this to modify system software.dpkg: This is the backend package manager for Debian-based systems. apt is essentially a user-friendly frontend for dpkg.--configure: This flag tells dpkg to take a package that has been unpacked (files moved to the disk) but not yet set up, and finish configuring it. This sets up configuration files, starts services, and registers the package fully.-a: This stands for "all." It tells the system to apply the configuration action to all packages that currently need it.So, in plain English: "Hey system, please take administrative control, look at all the software that is currently stuck halfway through installation, and finish setting them up."
Common causes:
dpkg was running.In rare cases where a post-install script fails, one can:
sudo dpkg --configure -a --force-all
Or edit /var/lib/dpkg/status manually (advanced, not recommended).