The "held broken packages" error occurs when APT cannot resolve package dependencies due to held packages or version conflicts. This typically happens after incomplete updates or installing packages from incompatible repositories, and can be resolved by updating package lists, checking held packages, or using dependency fixing tools.
This error means APT (the package manager in Debian and Ubuntu-based systems) has encountered one or more packages that have unmet dependencies. A package may be "held" because it was explicitly marked to not be automatically upgraded, or because a previous installation was interrupted. When APT tries to upgrade or install packages, it cannot find compatible versions of all required dependencies, creating a broken state that prevents further package operations. The error typically appears when you have packages from third-party repositories (PPAs) that conflict with official packages, or when a package installation or upgrade was interrupted and left the system in an inconsistent state. APT's dependency resolver cannot find a way to satisfy all package requirements simultaneously.
First, update your package lists to ensure APT has the latest information about available packages and their dependencies. This often resolves the issue if the problem is simply outdated package metadata.
sudo apt updateAfter running this, try your original command again (e.g., sudo apt upgrade or sudo apt install package-name). In many cases, this single step will resolve the issue by refreshing dependency information.
If the update didn't work, use APT's built-in dependency fixer to automatically resolve broken packages. This tool analyzes unmet dependencies and attempts to fix them.
sudo apt --fix-broken installThis command will show you what it plans to do and ask for confirmation before making changes. It works by either installing missing packages or removing conflicting ones to restore a consistent state.
If packages are stuck in a partially configured state, use dpkg to complete the configuration process. This is especially useful after interrupted installations.
sudo dpkg --configure -aThe -a flag tells dpkg to configure all unconfigured packages. This often resolves dependency issues that stem from incomplete package installations.
Some packages may be explicitly marked as "held" to prevent automatic upgrades. Check which packages are held on your system:
apt-mark showholdIf any held packages appear in the error message, you can unhold them to allow APT to manage them normally:
sudo apt-mark unhold package-nameReplace package-name with the actual package name. After unheld packages, try running sudo apt update and sudo apt upgrade again. Only unhold packages you're confident about updating.
If APT's resolver still cannot find a solution, try using aptitude, which has a more advanced dependency resolver that can find solutions APT may miss:
sudo apt install aptitude
sudo aptitude install package-nameAptitude will present multiple solutions if conflicts exist and ask which approach you prefer. This gives you more control over how dependencies are resolved compared to APT's automatic approach.
If a specific package is causing persistent conflicts, you may need to remove it completely and reinstall it or find an alternative. Use this as a last resort after trying the above steps:
sudo apt remove --purge package-name
sudo apt autoremove
sudo apt updateThe --purge flag removes the package and its configuration files. After removal, you can try reinstalling it with sudo apt install package-name, which will install the version that works with your current system state.
If the error mentions packages being held back from an upgrade, use dist-upgrade instead of the regular upgrade. This command handles changed dependencies that come with major version upgrades:
sudo apt-get dist-upgradeNote: dist-upgrade may remove some packages if necessary to resolve dependency conflicts, so review what it plans to remove before confirming.
Using Synaptic GUI: If you prefer a graphical interface, the Synaptic Package Manager (sudo apt install synaptic && sudo synaptic) provides a "Fix Broken Packages" option in the Edit menu.
Understanding Package Holds: A package hold is a deliberate action to prevent a package from being automatically upgraded. Check what's being held with apt-mark showhold and only unhold packages after understanding why they were held in the first place (sometimes packages are held to maintain compatibility with specific software versions).
PPAs and Third-Party Repos: If the error appeared after adding a PPA, the most robust solution is often to remove the PPA entirely (sudo add-apt-repository --remove ppa:username/ppa-name) and then run the fixes above. PPAs can create dependency conflicts with official repositories.
Distribution-Specific Issues: Different Ubuntu/Debian versions handle dependencies differently. If you're running an older system, some PPAs may not have packages built for your version, causing conflicts. Check if the PPA supports your distribution before adding it.
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Sub-process /usr/bin/dpkg returned an error code (2)
How to fix "Sub-process /usr/bin/dpkg returned an error code (2)" in APT
dpkg-divert: error: rename involves overwriting 'path' with different file
How to fix dpkg-divert rename conflicts in APT
E: Sub-process /usr/bin/dpkg returned an error code (1) during kernel installation
How to fix "dpkg returned an error code (1)" in APT kernel installation
dpkg: dependency problems prevent configuration of triggers
dpkg: dependency problems prevent configuration of triggers in apt