In most cases, a simple sudo dpkg --configure -a resolves everything and takes only a few seconds to run.
The error message provides the exact command needed to fix the package database. This command resumes and finishes the interrupted configurations. Open your terminal ( Ctrl + Alt + T ). Type the following command and press Enter: sudo dpkg --configure -a Use code with caution. Enter your administrator password when prompted.
This will list processes using apt . If you see a process ID (PID) that looks stuck (like an automatic update), you can kill it: In most cases, a simple sudo dpkg --configure
| Error Message | Likely Solution | |---------------|----------------| | Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? | Remove lock files (as shown above) or kill other apt processes. | | E: Sub-process /usr/bin/dpkg returned an error code (1) | Run sudo dpkg --configure -a , then sudo apt --fix-broken install . | | dpkg: error: parsing file '/var/lib/dpkg/status' near line ... | Restore a backup of the status file or regenerate from logs. | | Could not get lock /var/lib/apt/lists/lock | Remove the lock with sudo rm /var/lib/apt/lists/lock . |
: 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 Open your terminal ( Ctrl + Alt + T )
: If you see an error about a "lock" file (e.g., Could not get lock /var/lib/dpkg/lock ), another process may be using the database. First, try restarting your computer.
You accidentally closed the terminal window or pressed Ctrl + C while an installation was running. This will list processes using apt
The error occurs when dpkg was running a transaction (e.g., configuring a package or running triggers) and was killed by:
If the standard command freezes, errors out, or fails to run, use these advanced steps to clear out the corruption. Fix 1: Clear the Package Manager Lock Files