How to fix E: Sub-process /usr/bin/dpkg returned an error code (1) in APT

APTINTERMEDIATEHIGHUpdated Apr 19, 2026· 351 views

This error occurs when the dpkg package manager encounters a failure during installation, removal, or configuration of packages. It's usually caused by interrupted installations, broken dependencies, or corrupted package databases.

Quick fix

Fixes 1

sudo dpkg --configure -a
  1. Reconfigure pending packages with dpkg
  2. Fix broken dependencies
  3. Update package lists
  4. Check and free disk space
apt — error
sudo dpkg --configure -a
E: Sub-process /usr/bin/dpkg returned an error code (1)

What this error means

The dpkg (Debian Package) subsystem is the core package management tool on Debian-based systems (Ubuntu, Debian, Linux Mint, etc.). When apt runs dpkg to install or remove packages, dpkg returns error code 1 to indicate that something went wrong. This is a generic error code that can have multiple root causes - from interrupted installations that left the system in an inconsistent state, to missing dependencies, corrupted package metadata, or even disk space issues preventing completion of the operation.

Typical symptoms

  • apt install/upgrade/remove commands fail with the dpkg error message
  • Package installation fails midway through the process
  • apt commands hang or take unusually long to fail
  • Error appears when running apt update, apt install, or apt upgrade
  • Unable to install any new packages on the system

Common causes

  1. Interrupted package installation from previous attempt (power failure, process killed, etc.)
  2. Broken package dependencies or conflicting package versions
  3. Corrupted dpkg database or package metadata files
  4. Insufficient disk space to complete package operations
  5. Another apt/dpkg process is running simultaneously
  6. Stale lock files from crashed package manager processes
  7. Problematic third-party PPA (Personal Package Archive) causing conflicts

How to fix "E: Sub-process /usr/bin/dpkg returned an error code (1)"

1Reconfigure pending packages with dpkg

The first and most common fix is to reconfigure packages that dpkg couldn't fully process:

bash
sudo dpkg --configure -a

This command tells dpkg to configure all packages that are currently installed but haven't been fully configured yet. The -a flag means "all". This resolves the error in most cases where a previous installation was interrupted.

2Fix broken dependencies

If dpkg configuration didn't resolve it, fix broken dependencies next:

bash
sudo apt --fix-broken install

Or the older syntax:

bash
sudo apt-get install -f

The -f flag stands for "fix broken". This will attempt to install missing dependencies or remove conflicting packages.

3Update package lists

Clear the package cache and refresh your package lists:

bash
sudo apt clean
sudo apt update

The apt clean command removes old cached package files, and apt update refreshes the list of available packages from repositories. This resolves issues caused by corrupted or outdated package metadata.

4Check and free disk space

Verify you have sufficient disk space:

bash
df -h

If any partition (especially /, /var, or /home) shows 100% or near capacity, you need to free space before package operations can complete. Remove old files or uninstall unnecessary packages:

bash
sudo apt autoremove
sudo apt autoclean
5Remove the problematic package (if identified)

If you've identified which specific package is causing the issue, remove it:

bash
sudo apt remove --purge PACKAGE_NAME

Replace PACKAGE_NAME with the actual package name. The --purge flag removes configuration files as well, giving you a clean slate. You can find the problem package name in the apt error output.

6Manually fix lock files (if nothing else works)

As a last resort, if lock files are preventing operations:

bash
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*

Then update your package lists:

bash
sudo apt update

Be careful with this approach as it removes lock files that coordinate package operations.

Advanced notes

If the standard fixes don't work, check the detailed dpkg and apt logs for specific error messages:

bash
# View recent apt operations
sudo nano /var/log/apt/history.log

# View dpkg status
sudo cat /var/log/apt/term.log

For corrupted package configuration, you can manually remove problematic package info:

bash
sudo ls -l /var/lib/dpkg/info | grep PACKAGE_NAME
sudo rm /var/lib/dpkg/info/PACKAGE_NAME.*

Avoiding PPA Issues: If this error started after adding a third-party PPA, the PPA may have broken dependencies. Remove it with:

bash
sudo add-apt-repository --remove ppa:username/ppa-name
sudo apt update

For production systems, always test package changes in a staging environment first. Keep regular backups before major system updates.

Frequently asked questions

What does "1" mean?
). When apt runs dpkg to install or remove packages, dpkg returns error code 1 to indicate that something went wrong. This is a generic error code that can have multiple root causes - from interrupted installations that left the system in an inconsistent state, to missing dependencies, corrupted package metadata, or even disk space issues preventing completion of the operation.
How do I fix "1"?
This error occurs when the dpkg package manager encounters a failure during installation, removal, or configuration of packages. It's usually caused by interrupted installations, broken dependencies, or corrupted package databases.
What causes "1"?
Interrupted package installation from previous attempt (power failure, process killed, etc.) Broken package dependencies or conflicting package versions Corrupted dpkg database or package metadata files
Is the "1" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading