This error occurs when apt tries to install a package but cannot find compatible versions of its required dependencies. Common causes include incompatible package versions, corrupted package cache, or held packages. Resolving it typically involves updating repositories, fixing broken packages, or removing conflicting packages.
When apt encounters unmet dependencies, it means the package you are trying to install depends on other packages that either do not exist in your repositories, have incompatible versions, or have broken dependency chains. This can happen when upgrading a system with outdated packages, installing from third-party PPAs with conflicting versions, or when the package cache becomes corrupted. Apt refuses to proceed with the installation to prevent leaving your system in an inconsistent or broken state.
Start by refreshing your package lists to ensure apt has current information about available packages and versions:
sudo apt updateThis fetches the latest package metadata from your configured repositories. After running this, try your installation again, as the issue may have been caused by stale cache.
Upgrade your currently installed packages to their latest compatible versions, then attempt to fix any broken dependencies:
sudo apt upgrade
sudo apt --fix-broken installThe --fix-broken option tells apt to resolve dependency issues by removing conflicting packages if necessary. This often resolves unmet dependencies caused by partial upgrades.
If regular upgrade does not work, use dist-upgrade, which performs a more aggressive upgrade and is better at resolving dependency conflicts:
sudo apt dist-upgradeNote that dist-upgrade may remove packages to resolve conflicts, so review the output carefully before confirming. For production systems, test this on a non-critical environment first.
Held packages prevent apt from modifying them to resolve dependencies. List any held packages:
apt-mark showholdIf you see packages listed, consider unholding them temporarily to allow apt to resolve dependencies:
sudo apt-mark unhold <package-name>After resolving the dependency issue, you can hold the package again if desired.
If the above steps fail, you may need to remove the conflicting package. First, simulate the removal with a dry-run to see what would be removed:
sudo apt remove --dry-run <package-name>If the output looks safe, proceed with the actual removal:
sudo apt remove <package-name>Then try installing the package you originally wanted.
As a nuclear option, clear the apt cache and reinstall the problematic package:
sudo apt clean
sudo apt autoclean
sudo apt install --reinstall <package-name>This removes all cached package files and forces apt to re-download and verify them. Use this only after other solutions have failed, as it forces a fresh installation of the entire package and its dependencies.
If the error persists, check if you have third-party PPAs that provide conflicting packages:
ls /etc/apt/sources.list.d/Disable or remove problematic PPAs by renaming their files or removing them entirely:
sudo mv /etc/apt/sources.list.d/problematic-ppa.list /etc/apt/sources.list.d/problematic-ppa.list.bak
sudo apt updateThen try your installation again. PPAs from different maintainers often have conflicting package versions.
For systems with multiple PPAs, dependency conflicts are common because different maintainers may build packages for different Ubuntu/Debian versions or have different dependency requirements. Use apt-cache policy <package> to see which version will be installed and from which repository. The package manager aptitude (install with sudo apt install aptitude) offers more advanced dependency resolution than apt-get and can sometimes resolve conflicts that apt cannot. Debug held packages with sudo apt -o Debug::pkgProblemResolver=yes dist-upgrade to see the full decision-making process. In Docker containers, always run apt update before installing packages to prevent stale cache issues. For multi-architecture systems (amd64/i386/arm64), ensure you understand architecture-specific dependencies, as mixing architectures can cause unmet dependency errors.
E: Could not connect to proxy server
Could not connect to proxy server
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt
E: The value 'value' is invalid for APT::Default-Release
How to fix invalid APT::Default-Release value in APT
dpkg: error: unable to create new file 'path': Permission denied
How to fix dpkg permission denied errors in APT
subprocess installed post-removal script returned error exit status 1
How to fix "subprocess installed post-removal script returned error exit status 1" in APT