The "dpkg was interrupted" error on Linux occurs when package installation is halted, often requiring the command sudo dpkg --configure -a to fix broken installations and reconfigure pending packages. Additional steps, such as sudo apt install -f or removing lock files, may be needed to fully resolve package database locks. Read the full guide on Ask Ubuntu at Ask Ubuntu. E: dpkg was interrupted... run 'sudo dpkg --configure
The error message itself is unusually helpful. It literally tells you what command to run: The "dpkg was interrupted" error on Linux occurs
sudo dpkg --configure -a
Here is what that command does:
sudo : Runs the command as superuser (required for system-level changes).dpkg : Invokes the Debian package manager.--configure : Tells dpkg to reconfigure any unpacked but unconfigured packages.-a : Stands for "all" – meaning, reconfigure every package that was left in an unfinished state.tmux or screen session – Resists terminal closure.apt instead of direct dpkg – APT adds safety checks./var can cause silent failures.ps aux | grep -E 'apt|dpkg|apt-get|unattended-upgrade' | grep -v grep
sudo kill <PID>
sudo kill -9 <PID> # only if gentle kill fails
sudo rm /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/cache/apt/archives/lock
Then rerun:
sudo dpkg --configure -a