Sometimes, running the command above doesn't magically fix everything. Here are advanced steps to resolve stubborn locks or database issues.
While you now know how to fix the error, it's better to avoid it entirely. Here are best practices:
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
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.
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
sudo dpkg --configure -a
sudo apt update
sudo apt upgrade
sudo reboot
The dpkg was interrupted error looks scary, but it’s designed to protect your system. One command—sudo dpkg --configure -a—is usually all you need.
When in doubt, read the error message carefully. Often, Linux tells you exactly how to fix the problem.
Have you run into this error before? Let me know in the comments if the fix worked for you or if you hit another snag. Sometimes, running the command above doesn't magically fix
This error occurs when a package installation or update process is forcibly stopped—often due to a power outage, a manual interruption, or a system crash—leaving your package database in an inconsistent state Ask Ubuntu Primary Fix
The error message provides the direct solution. Open your terminal and run the following command to resume the interrupted configuration: sudo dpkg --configure -a Use code with caution. Copied to clipboard Wait for it to finish.
This process may take anywhere from a few seconds to over an hour depending on what was being installed (e.g., kernel updates or complex drivers). linux.brostrend.com Troubleshooting Steps
If the basic command fails or hangs, follow these steps in order: Fix Broken Dependencies cannot resolve the state on its own, use to force a fix for broken packages: sudo apt-get install -f Use code with caution. Copied to clipboard Clear Stale Update Files
: Sometimes corrupted files in the update directory block the process. Clearing them can help: sudo rm /var/lib/dpkg/updates/* sudo apt-get update Use code with caution. Copied to clipboard Check for Locks
: If you get a "could not get lock" error, another process (like an automatic background update) might be using the database. Restart your computer to safely release these locks. Alternatively, check for and kill stuck processes: ps aux | grep -i apt
sudo kill -
: If the problem persists, clean out the local repository of retrieved package files: sudo apt-get clean sudo apt-get update sudo apt-get upgrade Use code with caution. Copied to clipboard Ask Ubuntu For persistent issues, reviewing system logs with sudo journalctl -xe
can reveal specific package conflicts. Detailed troubleshooting guides are available on Ask Ubuntu BigBearTechWorld sudo dpkg --configure -a command return a specific error message or just hang? E: dpkg was interrupted... run 'sudo dpkg --configure
"dpkg was interrupted, you must manually run sudo dpkg --configure -a"
occurs when a package installation or system update is forcibly stopped before completion
. This often happens due to a sudden power failure, an unexpected reboot, or manually closing the terminal during an active process. Ask Ubuntu Primary Solution
To fix this, run the command exactly as suggested in the error message to resume the configuration of pending packages: Open your terminal (typically Ctrl + Alt + T Type or paste the following command and press sudo dpkg --configure -a Enter your password when prompted. Ask Ubuntu Troubleshooting Further Issues
If the primary command fails or hangs, you can try these additional steps to clear the package manager: Fix Broken Dependencies : If there are unmet requirements, use the Debian/Ubuntu fix-broken command sudo apt-get install -f Clear Lock Files
: If you see an error like "Could not get lock," another process might be using the package manager. Close other installers (like Synaptic or Update Manager) or manually remove the locks as suggested on BigBearTechWorld sudo rm /var/lib/dpkg/lock Remove Pending Updates
: As a last resort, if the configuration continues to hang, some users on Ask Ubuntu recommend clearing the update folder: sudo rm /var/lib/dpkg/updates/* Ask Ubuntu Once the issue is resolved, it is recommended to run sudo apt update sudo apt upgrade to ensure your system is fully synchronized and stable. Did you encounter a specific error message system hang when you tried running the suggested dpkg --configure -a E: dpkg was interrupted... run 'sudo dpkg --configure 13 Jul 2012 —
The error message "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem" is a safety mechanism in Debian-based systems (like Ubuntu, Kali, and Linux Mint) indicating that a package installation or update process was stopped before it could finish. What the Error Means The error message "dpkg was interrupted, you must
The dpkg (Debian Package) tool is a medium-level manager that handles the actual installation of .deb files. When it starts a process, it creates "lock" files to prevent other programs from interfering. If the process is killed (via Ctrl+C, power failure, or a system crash), these packages are left in a "half-installed" or "unconfigured" state, and the lock files may remain, preventing further updates. Primary Solution: Reconfigure Packages
The error usually provides the exact solution you need to run in your terminal: sudo dpkg --configure -a Use code with caution. Copied to clipboard
--configure: This tells dpkg to finish the setup for packages that have been unpacked but not yet fully configured.
-a (or --pending): Instead of targeting a specific package, this flag tells dpkg to process all pending packages that were interrupted. Troubleshooting Persistent Issues
If the standard command doesn't work or returns further errors, try these advanced recovery steps:
Fix Broken Dependencies: Sometimes the interruption leaves missing pieces. Run this to let the system fetch what is needed:sudo apt-get install -f
Clear Lock Files: If the system says another process is using dpkg, ensure no other update windows are open, then manually remove the locks:sudo rm /var/lib/dpkg/lock-frontendsudo rm /var/lib/apt/lists/lock
Clear Update Cache: If the error persists, you may need to clear the specific update records that are causing the hang:cd /var/lib/dpkg/updatessudo rm *sudo apt-get update
Recovery Mode: If your system is frozen or won't boot past the error, you can run the command from the Root prompt in Ubuntu Recovery Mode. Common Causes to Avoid
what does "sudo dpkg --configure -a" do exactly? - Ask Ubuntu
How to Fix "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem"
If you’re a Linux user—specifically on Debian-based systems like Ubuntu, Linux Mint, or Kali—you’ve likely encountered the dreaded "dpkg was interrupted" error. This usually happens when a system update or software installation is cut short by a power failure, a lost internet connection, or a forced restart.
Because the Package Manager (dpkg) was in the middle of writing files to your system when it stopped, it locks itself to prevent further corruption. Here is how to fix it and get your system back on track. The Quick Fix: The Command in the Error Message
The error message itself actually contains the solution. Open your terminal (Ctrl+Alt+T) and run: sudo dpkg --configure -a Use code with caution. What this does: sudo: Runs the command with administrative privileges. dpkg: The underlying engine that handles .deb packages.
--configure -a: Tells the system to look for all packages that were unpacked but not yet fully configured and finish the job. What to do if the Quick Fix fails
Sometimes, simply running the configure command isn't enough, especially if a specific package is "stuck" or the lock files are still active. If the command above hangs or throws another error, follow these steps in order: 1. Clear the Lock Files sudo apt update sudo apt upgrade
If the system thinks another process is still using the package manager, it will block you. Remove the manual locks with:
sudo rm /var/lib/dpkg/lock-frontend sudo rm /var/lib/dpkg/lock Use code with caution. 2. Update your Package List
Once the locks are gone, refresh your local database of available software: sudo apt update Use code with caution. 3. Fix Broken Dependencies
If dpkg finished configuring but some software is still acting "broken," use the apt fix-broken tool: sudo apt install -f Use code with caution. 4. Clean up and Upgrade
To ensure everything is synced up, finish with a clean-up and a full upgrade: sudo apt autoremove sudo apt upgrade Use code with caution. Why did this happen?
To prevent this error in the future, avoid the following during an update:
Closing the Terminal: Never close the window while a process is running.
Losing Power: If you’re on a laptop, ensure you’re plugged in before starting a large dist-upgrade.
Force Quitting: If an installation seems "stuck" at 99%, give it a few minutes. Some packages (like kernel updates) take a long time to build in the background.
In 99% of cases, sudo dpkg --configure -a is the only command you need. It safely resumes the interrupted process and fixes the database. If you see this error, don't panic—your system isn't broken; it's just waiting for your permission to finish the job.
Are you running into a specific error code or a package name that refuses to clear after running these commands?
The error means dpkg (Debian package manager—the low-level tool behind apt, apt-get, and the Software Center) was interrupted during a previous operation. Interruptions can happen for several reasons:
When this happens, dpkg leaves itself in a locked or unfinished state. Instead of risking corruption, it refuses to run new commands until you clean up the previous one.
Any attempt to install, remove, or update packages (using apt install, apt upgrade, dpkg -i, etc.) fails with the exact message above. The system refuses to proceed until the interrupted transaction is resolved.
Type the following command exactly as shown and press Enter:
sudo dpkg --configure -a
Breaking down the command: