How to Fix ‘Broken Packages’ and Unmet Dependencies in Ubuntu

Installing software, libraries, and kernel updates on an Ubuntu Linux system relies on the Advanced Package Tool (APT) and the low-level Debian package manager (dpkg). However, attempting to install a package or upgrade the system only to have the terminal halt with errors such as “E: Unable to correct problems, you have held broken packages” or “dpkg was interrupted, you must manually run ‘sudo dpkg –configure -a'” brings all administrative operations to a complete standstill. In Ubuntu, broken packages and unmet dependencies arise when an installation is interrupted mid-stream, conflicting third-party PPA repositories introduce incompatible shared library versions, or multi-architecture packages clash. When APT's dependency graph encounters an irreconcilable conflict, it locks package management to prevent operating system corruption. This guide outlines how to repair broken package configurations and restore healthy package management in Ubuntu.

What Causes Broken Packages and Unmet Dependencies in Ubuntu?

The APT packaging framework enforces strict dependency trees where packages declare prerequisites, conflicts, and version boundaries. Broken states typically originate from:

  • Interrupted Package Installation: Power loss, terminal closure, or manual cancellation during a dpkg unpack or post-installation script execution.
  • Conflicting Third-Party Repositories: Adding unverified PPAs that provide newer, non-standard versions of core shared libraries (such as glibc or openssl) that clash with official Ubuntu repositories.
  • Held Packages: Packages marked as “held” by the administrator or automated scripts that prevent dependencies from upgrading.
  • Corrupted Package Cache: Incomplete binary .deb archives in /var/cache/apt/archives/ causing checksum failures during extraction.
  • Partial System Upgrades: Upgrading individual software packages without synchronizing the entire distribution baseline.

Method 1: Complete Interrupted Configurations with dpkg –configure -a

When an installation process is killed prematurely, half-configured packages block all subsequent APT operations.

  1. Open your Linux terminal.
  2. Execute the following command to process all unpacked but unconfigured packages:
    sudo dpkg --configure -a
  3. Allow dpkg to complete any pending configuration scripts, triggers, and initramfs updates.
  4. If the command completes without errors, test package management with sudo apt update.

Method 2: Force Resolution of Unmet Dependencies with apt –fix-broken install

APT features a dedicated corrective flag that automatically downloads missing dependencies or removes orphaned conflicting packages.

  1. Run the fix-broken installation command:
    sudo apt --fix-broken install
  2. (Alternatively, the shorthand sudo apt -f install can be used).
  3. Review the proposed solution presented by APT. It will list packages to be installed or removed to restore dependency graph integrity.
  4. Type Y and press Enter to commit the resolution.
  5. Once completed, run sudo apt update && sudo apt upgrade -y to bring the rest of your system up to date.

Method 3: Clean the Local Package Cache and Remove Obsolete Binaries

Purging partially downloaded .deb files from local disk storage eliminates corrupted archives.

  1. Clear the local repository buffer of retrieved package files:
    sudo apt clean
  2. Remove package files that can no longer be downloaded and are virtually useless:
    sudo apt autoclean
  3. Remove orphaned packages and libraries that were installed as dependencies but are no longer needed by any active software:
    sudo apt autoremove --purge -y

Method 4: Identify and Unhold Locked Packages

If packages have been placed on hold, APT will refuse to upgrade their dependencies, leading to the “held broken packages” error.

  1. List all packages currently placed on hold:
    apt-mark showhold
  2. If any packages are returned by this command, evaluate whether they are still required to remain locked.
  3. Release the hold on the package to allow APT to update its dependencies:
    sudo apt-mark unhold <package-name>
  4. Re-run sudo apt update && sudo apt dist-upgrade.

Method 5: Remove Corrupted Third-Party PPA Repositories

Third-party PPAs providing incompatible library versions are the leading cause of permanent dependency deadlocks.

  1. Navigate to the external sources directory:
    cd /etc/apt/sources.list.d/
    ls -l
  2. Identify the third-party PPA that introduced the conflicting package.
  3. Use ppa-purge to safely downgrade packages back to official Ubuntu versions:
    sudo apt install ppa-purge
    sudo ppa-purge ppa:<repository-name>/<ppa-name>
  4. If ppa-purge cannot be installed, manually remove the offending .list file:
    sudo rm /etc/apt/sources.list.d/<problematic-repo>.list
  5. Update your package catalog:
    sudo apt update

For more Ubuntu server administration tutorials and package troubleshooting solutions, visit the Digitash Ubuntu section.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.