How to Fix ‘apt-get install -f’ Broken Dependencies in Ubuntu

Installing software or updating packages in Ubuntu can be abruptly halted by an APT dependency deadlock: You have held broken packages or Unmet dependencies. Try ‘apt –fix-broken install’ (or ‘apt-get install -f’) with no packages. When this condition occurs, the Advanced Package Tool (APT) refuses to install new software, remove packages, or process system upgrades. In severe situations, running apt-get install -f itself returns failure codes due to half-installed package scripts or package architecture conflicts.

Restoring a clean APT package management state requires reconfiguring unconfigured packages with dpkg, removing orphaned lock files, and clearing conflicting third-party PPA packages.

What Causes Broken Dependencies in Ubuntu Linux?

Ubuntu enforces strict package version requirements declared in package control manifests. Broken dependencies occur when:

  • Interrupted Package Installation: System restarts, power loss, or pressing Ctrl + C during an ongoing installation leaves dpkg status records in a half-configured state.
  • Incompatible Third-Party PPAs: Adding repositories configured for a different Ubuntu release (e.g. attempting to install Noble Numbat packages on Jammy Jellyfish) requesting missing shared library versions.
  • Manual .deb Installations via dpkg: Installing packages directly via sudo dpkg -i package.deb without pulling the required upstream dependencies.
  • Corrupted APT Cache Lists: Truncated or fragmented package lists inside /var/lib/apt/lists/ leading to version mismatch calculations.
  • Conflicting Multi-Arch Libraries: Parallel installations of 32-bit (i386) and 64-bit (amd64) packages demanding diverging glibc or runtime dependencies.

Step 1: Execute the Standard Broken Install Repair Command

APT includes an automated dependency resolver designed to download and install missing prerequisite packages:

  1. Open a terminal window.
  2. Execute the fix-broken command:
    sudo apt --fix-broken install
    (or the legacy syntax: sudo apt-get install -f)
  3. Review the proposed solutions. If APT offers to install missing dependencies cleanly, press Y and hit Enter.
  4. If the command completes successfully, run sudo apt update && sudo apt upgrade to confirm normal package servicing is restored.

Step 2: Reconfigure Unfinished Packages with dpkg

If APT cannot run because a package was left half-installed or post-install scripts failed:

  1. Reconfigure all unpacked but unconfigured packages:
    sudo dpkg --configure -a
  2. If an error indicates that a lock file is preventing execution, verify no other package manager is active (e.g. Software Updater), then remove stale locks:
    sudo rm -f /var/lib/dpkg/lock-frontend
    sudo rm -f /var/lib/dpkg/lock
    sudo rm -f /var/lib/apt/lists/lock
    sudo dpkg --configure -a

Step 3: Force Remove the Offending Package

If a specific manual .deb package is causing an unresolvable conflict, remove it directly using dpkg:

  1. Identify the problematic package name from the terminal error output (e.g. package-name).
  2. Force remove the package ignoring dependency checks:
    sudo dpkg -r --force-depends package-name
  3. Once removed, run the fix-broken command again to satisfy remaining system libraries:
    sudo apt --fix-broken install

Step 4: Clean and Regenerate APT Cache Lists

Corrupted local repository indices frequently misreport package availability:

  1. Purge the local package download archive:
    sudo apt clean
    sudo apt autoclean
  2. Delete all cached package lists:
    sudo rm -rf /var/lib/apt/lists/*
  3. Re-download pristine package manifests from Ubuntu repositories:
    sudo apt update

Step 5: Purge Problematic PPAs with ppa-purge

If the broken dependencies originated from an incompatible third-party PPA:

  1. Install the PPA purge utility:
    sudo apt install ppa-purge
  2. Downgrade all packages from the problematic PPA back to standard official Ubuntu repository versions:
    sudo ppa-purge ppa:problematic-repository/ppa
  3. Execute a system upgrade to verify dependency tree integrity:
    sudo apt update && sudo apt dist-upgrade

Get the best tech tips delivered straight to your inbox.

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