Skip to content
DevOps AI ToolKit
Newsletter
All guides
AI for Linux Admins By James Joyner IV · · 10 min read

Linux Error: The following packages have unmet dependencies — Cause, Fix, and Troubleshooting Guide

How to fix the Linux 'The following packages have unmet dependencies' error on Ubuntu and Debian: resolve held, broken, and conflicting apt packages step by step.

  • #linux
  • #troubleshooting
  • #ubuntu
  • #apt
  • #package-management

Summary

The following packages have unmet dependencies means apt cannot install or upgrade a package because a required dependency is missing, held back, or in conflict with something already installed. On Debian/Ubuntu this is a resolver problem, not corruption — apt is telling you it refuses to break the system to satisfy your request. The fix is to read exactly which dependency is unmet and why, then correct the cause (a bad PPA, a held package, or a partial upgrade).

Common Symptoms

  • apt-get install <pkg> fails with The following packages have unmet dependencies: followed by a list.
  • Lines such as Depends: libfoo1 (>= 2.0) but 1.9 is to be installed or but it is not going to be installed.
  • E: Unable to correct problems, you have held broken packages.
  • Upgrades stall with The following packages have been kept back.
  • Common after adding a third-party PPA or mixing repositories/releases.

Most Likely Causes of the ‘The following packages have unmet dependencies’ Error

The most common production cause is a third-party PPA or external repo providing a package version that conflicts with the base distro. Other causes:

  • A partial or interrupted apt-get upgrade (dist-upgrade needed instead).
  • A package pinned or held (apt-mark hold) that blocks a required newer version.
  • Mixing packages from different Ubuntu/Debian releases.
  • A manually installed .deb whose dependencies were never satisfied.
  • A stale package cache pointing at versions no longer on the mirror.

Quick Triage

# Re-read the full dependency error and let apt propose a fix
sudo apt-get -f install

# See which packages are held or broken
sudo apt-mark showhold
dpkg -l | grep -E '^rc|^iU|^iF'

# Refresh metadata in case the cache is stale
sudo apt-get update

Diagnostic Commands

# Show what a package depends on and which candidate apt would pick
apt-cache policy <pkg>
apt-cache depends <pkg>
apt-cache rdepends --installed <pkg>

# Ask apt to attempt automatic repair of broken deps
sudo apt-get -f install

# Simulate the install to see the full conflict chain without changing anything
sudo apt-get install <pkg> --simulate

# Identify which repo/PPA is offering a conflicting version
apt-cache policy <conflicting-pkg>
grep -R "" /etc/apt/sources.list /etc/apt/sources.list.d/

Focus on the first unmet Depends: line — later lines are usually downstream fallout from that one conflict.

Fix / Remediation

  1. Refresh and let apt self-heal (safest):

    sudo apt-get update
    sudo apt-get -f install
  2. Use dist-upgrade when packages are “kept back” because new dependencies must be added:

    sudo apt-get dist-upgrade
    # or
    sudo apt full-upgrade
  3. Release a held package that is blocking the resolver:

    sudo apt-mark showhold
    sudo apt-mark unhold <pkg>
    sudo apt-get install <pkg>
  4. Install the exact dependency version apt is asking for:

    apt-cache policy libfoo1
    sudo apt-get install libfoo1=<version>
  5. Remove the offending third-party repo/PPA if it ships an incompatible version, then re-resolve:

    sudo add-apt-repository --remove ppa:example/bad
    sudo apt-get update
    sudo apt-get -f install
  6. As a controlled last resort, use aptitude, which offers alternative resolutions interactively:

    sudo apt-get install aptitude
    sudo aptitude install <pkg>

Warning: Avoid --force, dpkg -i --force-depends, or removing core libraries to silence the error. Forcing past a real conflict can uninstall critical packages and break the system; correct the source of the conflict instead.

Validation

# No broken packages should remain
sudo apt-get -f install
sudo apt-get check

# The target package now installs cleanly
sudo apt-get install <pkg>
dpkg -l <pkg>

Prevention

  • Pin third-party PPAs with apt preferences so they cannot override base-distro packages unexpectedly.
  • Prefer full-upgrade/dist-upgrade for release upgrades so new dependencies are pulled in.
  • Track what you apt-mark hold; stale holds are a frequent cause of unmet dependencies later.
  • Avoid mixing packages across Ubuntu/Debian releases on one host.
  • On RHEL/Rocky/Alma the analog is dnf’s Error: package requires ... / nothing provides; dnf install --best --allowerasing and module streams play the role held packages and PPAs do here.

Final Notes

Unmet dependencies are the resolver protecting the system, not a failure. Read the first unmet Depends: line, identify the repo or hold behind it, and correct that source. Reach for -f install, dist-upgrade, and repo cleanup before ever forcing dpkg — forcing turns a solvable conflict into a broken system.

Want faster Linux incident response? Use DevOps AI Toolkit to turn production errors into clear diagnostics, remediation steps, and reusable runbooks.

Free download · 368-page PDF

Download the Free 500-Prompt DevOps AI Toolkit

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.