The dpkg package manager encountered an interruption during installation. This typically happens when a previous apt/dpkg operation was forcibly stopped. Running 'dpkg --configure -a' will recover from this state.
This error occurs when the dpkg (Debian Package Manager) process is interrupted before it can complete its operations. The system is left with packages in an incomplete or half-configured state. Common causes include unexpected power loss, system shutdown during updates, accidental process termination, or background unattended upgrades being interrupted. The package manager cannot continue normal operations until these incomplete packages are properly configured.
Open a terminal and run this command to configure any packages left in an incomplete state:
sudo dpkg --configure -aThis command will attempt to finish configuring all packages that were interrupted. It will resolve any dependency issues automatically if possible.
This command can take a very long time, especially on slower systems like Raspberry Pi. Some users have reported wait times exceeding several hours when recompiling drivers or packages from source.
Do NOT interrupt this process again. Leave your system running and be patient. If you're concerned it has frozen, check system activity with:
# Check if dpkg is still running
ps aux | grep dpkg
# Check system load
topOnce dpkg --configure -a completes, clean and update your package cache:
sudo apt-get clean
sudo apt-get updateThis ensures your package lists are fresh and removes any partially downloaded packages.
If the above command hangs or reports unresolvable dependency errors, you may need to remove specific problematic packages. First, find which package is causing issues - dpkg output will show it.
Then remove it with:
sudo dpkg -r <package-name>After removing, try sudo dpkg --configure -a again. Handle dependencies carefully by removing packages in the correct order.
If none of the above steps work and your system is critically broken:
- If you use Timeshift (Ubuntu/Linux Mint): Restore a snapshot from before the interrupted operation occurred
- If you have another backup strategy: Restore from your most recent good state
This should only be done if the package manager is completely unable to recover, as it will undo all system changes since the backup point.
SELinux and AppArmor may occasionally interfere with dpkg operations. If you experience repeated interruptions even after running dpkg --configure -a, check your system security policies. On systems with persistent dpkg issues, check /var/lib/dpkg/status for corruption - in extreme cases, backing it up and restoring from /var/lib/dpkg/status-old can help. Different distributions (Ubuntu, Debian, Linux Mint, Raspberry Pi OS) may have slightly different package manager implementations, but dpkg --configure -a works consistently across all of them.
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Sub-process /usr/bin/dpkg returned an error code (2)
How to fix "Sub-process /usr/bin/dpkg returned an error code (2)" in APT
dpkg-divert: error: rename involves overwriting 'path' with different file
How to fix dpkg-divert rename conflicts in APT
E: Sub-process /usr/bin/dpkg returned an error code (1) during kernel installation
How to fix "dpkg returned an error code (1)" in APT kernel installation
dpkg: dependency problems prevent configuration of triggers
dpkg: dependency problems prevent configuration of triggers in apt