The Problem
Broken package dependencies occur when packages require other packages that are missing, have incompatible versions, or cannot be installed. This commonly happens after interrupted updates, manual .deb installations, or mixing repositories. On your Breeze, fixing broken packages quickly is important to keep the system updatable and secure.
Recognizing Broken Dependencies
Typical error messages include:
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages
dpkg: error processing package foo (--configure):
dependency problems - leaving unconfigured
The following packages have unmet dependencies:
nginx : Depends: libnginx-mod-http (= 1.24.0-1) but it is not installable
Step 1: Try Automatic Fix
# The first thing to try — fixes most issues
sudo apt --fix-broken install
# Or equivalently
sudo apt -f install
Step 2: Reconfigure Pending Packages
# Configure all unpacked but unconfigured packages
sudo dpkg --configure -a
# Then try the fix again
sudo apt --fix-broken install
Step 3: Update Package Lists
# Refresh package lists — stale lists cause version mismatches
sudo apt update
# Then try installing again
sudo apt upgrade
Step 4: Force Remove Problematic Package
# Identify the broken package
dpkg --audit
# Force remove it (use with caution)
sudo dpkg --remove --force-remove-reinstreq package-name
# Clean up
sudo apt --fix-broken install
sudo apt autoremove
Step 5: Check for Repository Issues
# List all configured repositories
grep -r "^deb " /etc/apt/sources.list /etc/apt/sources.list.d/
# Check for mixed release repositories (e.g., mixing stable and testing)
apt-cache policy package-name
# Remove problematic third-party repositories
sudo rm /etc/apt/sources.list.d/problematic-repo.list
sudo apt update
Step 6: Clean Package Cache
# Remove cached package files
sudo apt clean
# Remove packages that are no longer needed
sudo apt autoremove
# Purge removed packages (delete config files too)
dpkg --list | grep "^rc" | awk '{print $2}' | xargs sudo dpkg --purge
Step 7: Reinstall a Package
# Download and reinstall a specific package
sudo apt install --reinstall package-name
# If that fails, download the .deb manually
apt download package-name
sudo dpkg -i package-name_version.deb
sudo apt --fix-broken install
Nuclear Option: Reset dpkg Database
Only use this as a last resort:
# Backup the dpkg database
sudo cp -r /var/lib/dpkg /var/lib/dpkg.backup
# Clear the dpkg lock files
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
# Reconfigure
sudo dpkg --configure -a
sudo apt --fix-broken install
Handling Held Packages
# Check for held packages
dpkg --get-selections | grep hold
apt-mark showhold
# Unhold a package
sudo apt-mark unhold package-name
# Then upgrade
sudo apt upgrade
Prevention
- Never interrupt
apt upgradeordpkgoperations - Avoid mixing repositories from different Ubuntu releases
- Be cautious with third-party PPAs — they can introduce version conflicts
- Run
sudo apt update && sudo apt upgraderegularly - Use
apt-mark hold package-nameintentionally to prevent specific packages from upgrading - Always review what
aptplans to do before confirming withy