Docs / Troubleshooting / Fixing Broken Package Dependencies on Ubuntu

Fixing Broken Package Dependencies on Ubuntu

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 43 views · 1 min read

Symptoms

  • apt install fails with dependency errors
  • Packages stuck in "half-installed" state
  • "Unmet dependencies" errors
  • dpkg errors during installation

Fix Broken Packages

# Attempt to fix broken installs
sudo apt --fix-broken install

# Force configure pending packages
sudo dpkg --configure -a

# Clean package cache
sudo apt clean
sudo apt autoclean

Force Remove a Problem Package

# Remove without running scripts
sudo dpkg --remove --force-remove-reinstreq package-name

# Then clean up
sudo apt --fix-broken install
sudo apt autoremove

Reset apt State

# Remove apt lists and rebuild
sudo rm -rf /var/lib/apt/lists/*
sudo apt update

Held Packages

# Check for held packages
apt-mark showhold

# Unhold a package
sudo apt-mark unhold package-name

# Then upgrade
sudo apt upgrade

PPA Conflicts

# List installed PPAs
grep -r "^deb " /etc/apt/sources.list.d/

# Remove a problematic PPA
sudo add-apt-repository --remove ppa:name/ppa
sudo apt update

Nuclear Option (Last Resort)

# Reconfigure all packages
sudo dpkg --configure -a
sudo apt install -f
sudo apt full-upgrade

Prevention

  • Avoid mixing repositories from different sources
  • Be cautious with third-party PPAs
  • Don't interrupt apt or dpkg operations
  • Keep your system updated regularly

Was this article helpful?