APT cannot resolve package dependencies because required packages are unavailable, have version conflicts, or are held. This typically occurs with conflicting PPAs, version mismatches, or incompatible repositories.
This error means APT's dependency resolver has detected that a package you're trying to install depends on another package that either: 1. **Doesn't exist** in your configured repositories 2. **Has a version conflict** with another installed package 3. **Is held** (marked as do-not-upgrade) 4. **Conflicts with** other packages that would be installed APT is informing you that it cannot complete the installation because the dependency chain is broken. The "not going to be installed" part indicates that APT has given up trying to automatically resolve this particular dependency.
Run this command to let APT attempt automatic dependency resolution:
sudo apt --fix-broken installIf that doesn't work, also try reconfiguring packages:
sudo dpkg --configure -aThis forces the package manager to verify all package relationships.
From the error message, identify which package cannot be installed. For example:
Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.3 is to be installedThe conflicting package is libc6 with a version mismatch. Note the exact package name and version requirement.
Some packages may be held (marked to not upgrade). List held packages:
apt-mark showholdIf a held package is causing the conflict, you can unhold it:
sudo apt-mark unhold package-nameThen try the install again.
If the error started after adding a PPA, disable it:
Using GUI (Ubuntu Desktop):
- Open "Software & Updates"
- Go to "Other Software" tab
- Find and uncheck the problematic PPA
Using command line:
sudo add-apt-repository --remove ppa:username/ppaname
sudo apt-get updateAfter removing the PPA, try installing again.
aptitude has better conflict resolution than apt. Install it:
sudo apt-get install aptitudeThen try installing your package with aptitude:
sudo aptitude install package-nameAptitude will often find solutions that apt cannot. If it offers alternative packages, review and accept them.
Ensure you are installing packages for your distribution. Check your Ubuntu/Debian version:
lsb_release -aor
cat /etc/os-releaseMake sure any packages or PPAs you add are compatible with your version. For example, don't install Ubuntu 22.04 packages on a 20.04 system.
Understanding Version Pinning: When a package specifies "Depends: libname (= exact.version)", it requires an exact version match. If your system has a different version installed, the dependency cannot be satisfied without downgrading or upgrading that library.
PPA Conflicts: PPAs (Personal Package Archives) often contain newer or different versions of packages than official repositories. Having multiple conflicting PPAs can cause version conflicts that APT cannot resolve. It's best to keep PPA use minimal and from trusted sources.
Rootless/Container Environments: In Docker containers or restricted environments, dependency resolution may fail differently. Ensure the base image has the correct repositories configured.
Repository Priority: If you have multiple repositories providing the same package, APT may select versions in unexpected ways. Use apt-cache policy package-name to see which version APT prefers and from which repository.
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