This error occurs when apt encounters conflicting or unresolvable package dependencies during installation or upgrade. Your system cannot install required packages because their versions conflict with existing installations or aren't available in your repositories.
When you install a software package, it often requires specific versions of libraries and dependencies to function properly. The apt package manager automatically tries to resolve these dependencies by finding compatible versions in your system's repositories. This error means apt has encountered a situation where it cannot find or install the required dependencies—either because they don't exist in your available repositories, there are version conflicts with already-installed packages, or there are circular dependency issues that prevent resolution.
First, refresh apt's local package list to ensure it has the latest version information:
sudo apt updateSometimes the issue is simply that your system doesn't know about newer compatible versions of packages that were recently made available.
Try to automatically fix broken dependencies using apt's built-in repair functionality:
sudo apt install --fix-brokenOr the older dpkg method:
sudo apt-get install -fThis tells apt to attempt to find compatible versions that satisfy all dependency constraints.
Remove partially installed packages and reconfigure the package database:
sudo dpkg --configure -aThen clean up your apt cache:
sudo apt clean
sudo apt autoclean
sudo apt autoremoveThese commands remove cached package files and packages that are no longer needed, which can resolve conflicts.
List any packages marked as 'held' that might be preventing dependency resolution:
dpkg --get-selections | grep holdIf you find held packages, you can unhold them:
sudo apt-mark unhold package_nameThen retry your apt command. Be cautious though—packages are often held for a reason.
If the error coincides with adding a new PPA or third-party repository, that's often the culprit. List your PPAs:
add-apt-repository --listRemove the suspect PPA:
sudo add-apt-repository --remove ppa:username/ppa-nameThen run sudo apt update again.
If standard apt fails, aptitude often has a better dependency resolver:
sudo apt install aptitude
sudo aptitude install package_nameWhen prompted about dependency conflicts, aptitude will suggest resolution options you can select interactively.
As a last resort, completely remove the package causing the issue:
sudo apt remove --purge package_nameThen clean up:
sudo apt autoremove
sudo apt updateAfter this, you may be able to install a compatible version or a different package.
For persistent issues, you can examine what apt is trying to do in detail. Run apt install package_name (without sudo) to see detailed error messages about which specific dependencies conflict. If you're on Ubuntu/Debian with a graphical environment, Synaptic Package Manager provides a GUI tool (Edit > Fix Broken Packages) that visually shows dependency conflicts. In some cases, you may need to downgrade a package to an earlier version that has compatible dependencies, though this is risky. Consider using alternatives like Snap or Flatpak for problematic packages, as they bundle their own dependencies and avoid system-wide conflicts. For critical systems, you may want to revert to a known-good snapshot or reinstall the system cleanly rather than attempt complex dependency fixes.
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