sudo dpkg --configure package-name
Sometimes the error persists even after running the suggested command. This can happen for several reasons:
The good news? It is surprisingly easy to fix. In this post, we will walk through the solution step-by-step and explain exactly what that command does. In this post, we will walk through the
: Grants administrative privileges required to modify system-level packages.
sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.bak After removing the locks, re-run the configuration fix:
To minimize the risk of encountering the "dpkg was interrupted" error in the future:
Run these commands sequentially to remove the stuck lock files: After removing the locks
sudo rm /var/lib/dpkg/lock-frontend sudo rm /var/lib/dpkg/lock sudo rm /var/cache/apt/archives/lock Use code with caution. After removing the locks, re-run the configuration fix: sudo dpkg --configure -a Use code with caution. Step 3: Force Clear Broken Packages
Power outages during package configuration are a common cause. When the system restarts, dpkg is left in a confused state. The fix: just run sudo dpkg --configure -a as soon as you can log back in.
Force the removal of the broken package (replace package_name with the actual name): sudo dpkg --remove --force-remove-reinstreq package_name Use code with caution. Clean up the package manager state: sudo apt-get update sudo apt-get autoremove Use code with caution. Best Practices to Prevent Future Interruptions
Sometimes, running the command above isn't enough. If dpkg finished configuring but your packages are still arguing with each other, run the following command to fix broken dependencies: