Understanding the Error
dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
Fix 1: Run the Recommended Command
sudo dpkg --configure -a
Fix 2: If Still Failing, Clean Up
# Remove problematic package
sudo dpkg --remove --force-remove-reinstreq package_name
# Or purge
sudo dpkg --purge package_name
# Then reconfigure
sudo dpkg --configure -a
sudo apt --fix-broken install -f
Fix 3: Fix Dependencies
sudo apt update
sudo apt --fix-broken install -y
sudo apt autoremove -y
sudo apt autoclean
Fix 4: Force Reinstall
# Reinstall all packages (extreme)
sudo apt install --reinstall $(dpkg --get-selections | grep -v deinstall | cut -f1) -y
Fix 5: Remove Lock Files
sudo rm /var/lib/dpkg/updates/*
sudo dpkg --configure -a
Fix 6: Check Disk Space
df -h
# Full disk can cause dpkg errors
After fixing, always run:
sudo apt update
sudo apt upgrade -y