FUNDAMENTALS A Complete Guide for Beginners
A package with unmet dependencies is a software package that cannot be installed or updated because it relies on other packages or libraries that are either missing or have incompatible versions on your system. Unmet dependencies can prevent the package manager (e.g. YUM, DNF, APT) from installing or updating software correctly. In this tutorial, I’ll discuss some common reasons for the error “The following packages have unmet dependencies” in different Linux distributions and how to mitigate them.
To resolve package unmet dependencies, check the following primary solutions with apt:
- Debug and Upgrade packages using:
sudo apt -o Debug::pkgProblemResolver=yes dist-upgrade
- Remove and install the packages using: a.
sudo apt remove <package name>
b.sudo apt install -y <package name>
- Fix broken dependencies using:
sudo apt install -f
Cause of Packages Unmet Dependencies
Unmet dependencies can occur in both Debian-based Linux distribution (Ubuntu) and Red Hat-based distribution (RHEL/CentOS/Fedora) for similar reasons, although their package management tools differ. Here are some common causes of unmet dependencies in both distributions:
- Repository Configuration Issues: If the repositories are not correctly configured in /etc/apt/sources.list or /etc/apt/sources.list.d/, APT may not be able to locate the necessary packages. In RHEL, repository configuration issues in the /etc/yum.repos.d/
- Manual Package Installations: Installing packages manually e.g. using
dpkg -i
in Ubuntu without resolving dependencies can result in unmet dependencies. However, using therpm -i
command to install packages in RHEL can lead to a similar issue. - Dependency Chain Conflict: Sometimes, resolving one set of dependencies can create conflicts with another package’s dependencies, resulting in unmet dependencies.
- Software Sources Priority: APT uses package pinning to determine which version of a package to install. If package pinning is not set correctly, it may install an incompatible version. On the other hand, priority settings for repositories in RHEL can affect which package versions are considered for installation. If not configured correctly, this can lead to unmet dependencies.
Preliminary Solutions to Unmet Dependencies Error in Linux
Before heading into the main solution techniques, I want to discuss two methods that may solve the packages’ unmet dependency problem for most of the users. So, I suggest you try the preliminary solutions first and then try the other solutions discussed later on if these fail.
1. Debug and Upgrade the Packages
One of the primary fixes of unmet dependencies can be to debug all the packages that are listed in the snippet by running the command for the upgrade. To automatically debug all the packages and upgrade them to remove the error, open the Ubuntu terminal and type the following command:
sudo apt -o Debug::pkgProblemResolver=yes dist-upgrade
- sudo: Enables administrative permissions.
- apt: Calls APT package management tools.
- -o Debug::pkgProblemResolver=yes: An option passed to apt that instructs it to enable debugging output for the package problem resolver to provide additional information about why a particular package upgrade might be failing due to unresolved dependencies or conflicts.
- dist-upgrade: This command ensures that all packages are upgraded to their latest versions while resolving any dependency or conflict issues.
2. Remove and Install the Packages
Removing and then reinstalling a package can be beneficial in solving unmet dependency issues in all Linux distributions because it forces the package manager to re-evaluate the package’s dependencies and try to resolve any issues that might have arisen. Here’s how this process can help in Ubuntu:
- Open the Ubuntu terminal.
- Run the following command to remove the package:
sudo apt remove <package name>
EXPLANATION- sudo: Enables administrative permissions.
- apt: Calls APT package management tools.
- remove: Command to remove a package using apt.
- <package name>: Name of the package that raised unmet dependency error.
- Enter the user password.
- Now, run the following command to install the package:
sudo apt install -y <package name>
EXPLANATION- install: Command for installing packages using apt.
- -y: Answer YES automatically to all the confirmation prompts.
Note: Replace <package name> in the above commands with the actual name of the package.I have applied the method for resolving unmet dependencies of TeamViewer. The first command removed teamviewer package. Then the second command installed teamviewer with necessary dependencies.
Note: If you are using a RedHat-based Linux distribution such as RHEL/Fedora/CentOS, you can use the below set of commands for removal and reinstallation of the package:
sudo yum remove <package name>
sudo yum install -y <package name>
Replace <package name> in the above commands with the actual name of the package.
6 Solutions to Resolve Packages Have Unmet Dependencies Error in Ubuntu
If you encounter package installation errors due to unmet dependencies, it generally means that the package you are trying to install depends on other packages or libraries that are either incompatible or the repository is not correctly configured with your system. For example, I have downloaded a DEB file of TeamViewer, and it raised an unmet dependency error when I tried to install it.The output shows that installing teamviewer_15.44.5-1_amd64.deb was unsuccessful because it depends on libminizip1 which is unmet.
However, you may face more than one dependency unmet or missing while installing other software. In this tutorial, I’ll show you some recovery techniques so that you can resolve unmet dependency errors from the above-like situation.
Solution 01: Using “APT/APT-GET” to Resolve Unmet Dependencies
APT (Advanced Package Tool) is a powerful package management system used in Debian-based Linux distributions, including Ubuntu. It simplifies package management by handling dependencies automatically. When the installation is stuck due to unmet dependencies, follow these steps to install them with apt
:
- Open the Ubuntu terminal.
- Run the following command:
sudo apt install -f
EXPLANATION- sudo: Enables administrative permissions.
- apt: Calls APT package management tools.
- install: Command for installing package using apt.
- -f: Flag that indicates to fix the missing dependencies.
- Type Y and press ENTER when the confirmation prompt appears.The above command detects all unmet dependencies and installs them automatically.
Solution 02: Using “Aptitude” to Fix Unmet Dependencies
Aptitude is a package management tool in Ubuntu and other Debian-based Linux distributions. It provides a Text-based User interface (TUI) for managing software packages on your system. It is known for its advanced and robust dependency resolution capabilities, which can be particularly helpful in resolving unmet dependencies. Aptitude assists in solving unmet dependency issues in the following ways:
- Thorough Dependency Analysis: It performs a comprehensive analysis of not only the direct dependencies of the requested packages but also the indirect dependencies, ensuring a complete picture of the package ecosystem.
- Interactive Conflict Resolution: If there are conflicting packages or unmet dependencies, it presents options to the user, suggesting various solutions to resolve the issue.
- Dependency Conflict Avoidance: It aims to avoid dependency conflicts by proactively evaluating multiple solutions for satisfying dependencies, and it tries to select a solution that results in the least disruption to the system while meeting the requirements.
- Alternative Solutions: If there are multiple ways to satisfy a package’s dependencies, aptitude presents alternative solutions and allows you to explore them.
- Compatibility Checks: It checks for package compatibility with the current system configuration, ensuring that the packages selected for installation or upgrade are suitable for the specific version of Ubuntu you are using.
- Package States: It tracks the state of packages on your system, including whether they were installed manually or as dependencies. This information is valuable for making decisions about package removal and system cleanup.
Here’s how to use aptitude for resolving unmet dependencies:
- Open the Ubuntu terminal.
- Run the following command to install aptitude:
sudo apt install -y aptitude
EXPLANATION- sudo: Enables administrative permissions.
- apt: Calls APT package management tools.
- install: Command for installing a package using apt.
- -y: Answer YES automatically to all the confirmation prompts.
- aptitude: Aptitude package name.
- Enter the user password.
- Now, run this command to fix unmet dependencies by aptitude:
sudo aptitude install -f
- Type Y and press ENTER to accept the solution provided by aptitude.After accepting the solution, aptitude will install the required package and solve the problem of unmet dependencies.
Solution 03: Removing PPAs Using “Software Updater”
PPAs often provide packages that are built for specific Ubuntu releases. When you remove a PPA, you eliminate the packages it provides, which might be causing conflicts or unmet dependencies because they aren’t compatible with your current Ubuntu version. Moreover, Ubuntu’s package manager (apt or apt-get) can have difficulty resolving dependencies when packages from multiple sources, including PPAs, are involved. Removing a problematic PPA simplifies the package manager’s task of resolving unmet dependencies. Here’s how to remove third-party PPAs:
- Open Software Updater from the Show Applications section.
- Click on Settings.
- Navigate to Other Software.
- If you find any URL checked, this may be the reason for conflicting dependencies. So, uncheck it.
- Type the user password and click on Authenticate.
- Click on Close.
- Click on Reload when prompt appears.Now, try to install the package that showed unmet dependency. You can add the PPA later by checking the URL in a similar process.
Solution 04: Update Repository Using “APT”
The APT package manager on Ubuntu systems serves you the best in resolving dependency issues. However, try using it to update the repository or install the software you need. It will automatically handle dependencies and conflicts, upgrading or downgrading packages as necessary to maintain compatibility. Follow the steps to update repositories:
- Open the Ubuntu terminal.
- Type the following command:
sudo apt update && sudo apt upgrade
EXPLANATION- sudo: Grants administrative permissions.
- apt: Calls APT package management tool.
- upgrade: Upgrade all packages on the system to their latest versions.
- &&: Symbol to represent AND. Here it merges the two commands.
- update: Update packages and install new packages if they are available in the repositories and meet the update criteria.
- Type the user password and press ENTER.This upgradation will reconfigure repositories and resolve unmet dependency issues.
Note: You could use APT-GET instead of APT for the repository upgradation. The command is:
sudo apt-get update && sudo apt-get upgrade
Solution 05: Clear Cache and Reinstall Package
Clearing the cache removes downloaded package files (.deb files) that are cached on your system. It can free up disk space but doesn’t remove installed packages. However, clearing the cache can be useful when you want to ensure that you are fetching the latest package information from the repositories. Reinstalling the package after clearing the cache can be a useful solution for unmet dependencies. Here’s how to do it:
- Open the Ubuntu terminal.
- Run the below commands to clear all cache and reinstall TeamViewer.
sudo apt clean all sudo apt install –reinstall teamviewer
EXPLANATION- sudo: Grants administrative permissions.
- apt: Calls APT package management tool.
- clean: This is the subcommand used to perform cache-cleaning operations.
- all: This argument specifies that you want to clean all types of cache, including metadata, packages, and headers.
- install: Command for installing package using apt.
- –reinstall: Command to remove the existing version and install the package again.
- teamviewer: Name of the package.
- Enter the user password if asked.The above commands generally fix the issue. But if you still face unmet dependencies error like the above picture, follow next step:
- Run the below command:
sudo apt install –fix-broken sudo apt install –reinstall teamviewer
- Type Y and press ENTER when the confirmation prompt appears.This time, apt will resolve the unmet dependencies and reinstall the package successfully.
Solution 06: Using “Synaptic” Package Manger GUI
Synaptic Package Manager, often denoted as “Synaptic”, is a GUI (Graphical User Interface) package management tool for Debian-based Linux distributions. interfaces that also handle dependencies and other package management tasks effectively. Follow these steps to resolve unmet dependencies automatically using Synaptic in Ubuntu:
- Open Synaptic Package Manager from the Show Applications section.
- Type user password in the authentication window and click Authenticate.
- Select Broken from the Custom Filters section. It will list the packages that are broken due to missing or unmet dependencies.
- Right click on the package and select Mark for Upgrade.This will detect the unmet dependency packages automatically.
- Click on Mark.After that, Synaptic will install the detected unmet dependencies. You can check it by clicking Reload located at the top-left of the synaptic window.
3 Solutions to Resolve Packages Have Unmet Dependencies in Red Hat
Unmet dependencies can occur in Red Hat-based distribution (RHEL/CentOS/Fedora) for similar reasons as Debian-based Linux distribution (Ubuntu). Generally, errors due to unmet dependencies means that the package you are trying to install depends on other packages or libraries that are either incompatible or somehow unmet the required version with your system.
Solution 01: Using “YUM” to Solve Unmet Dependencies
YUM is a CLI (Command Line Interface) utility used in Red Hat-based Linux distributions for package management. It focuses on installing or managing RPM packages from repositories allowing you to download packages with their necessary dependencies and install them automatically. To use YUM options to solve unmet dependencies issues regarding Firefox, open the RHEL/Fedora terminal and Run the following command:
sudo yum install -y --setopt=tsflags=nodocs firefox
- sudo: Grants administrative permissions.
- yum: Calls YUM package management tool.
- install: Command to install package using YUM.
- -y: Answer YES automatically to all the confirmation prompts.
- –setopt=tsflags=nodocs: Instructs the package manager not to install any documentation files associated with the packages being installed or updated.
- firefox: Name of the package.
Solution 02: Update Repository Using “YUM/DNF”
The package manager (DNF and YUM) on Red Hat-based systems serves you the best in resolving unmet dependencies issues. Try using it to update the repository or install the software you need. It will automatically handle dependencies and conflicts, upgrading or downgrading packages as necessary to maintain compatibility. Follow the steps to update repositories:
- Open the RHEL/Fedora terminal.
- Type the following command:
sudo yum upgrade && sudo yum update
EXPLANATION- sudo: Grants administrative permissions.
- yum: Calls YUM package management tool.
- upgrade: Upgrade all packages on the system to their latest versions.
- &&: Symbol to represent AND. Here it merges the two commands.
- update: Update packages and install new packages if they are available in the repositories and meet the update criteria.
- Type the user password and press ENTER.
- Type Y and press ENTER when the confirmation prompt appears.
This upgradation will reconfigure repositories, install the broken package and resolve failed dependency issues.
Note: You could use DNF instead of YUM for the repository upgradation. The command is:
sudo dnf upgrade && sudo dnf update
Solution 03: Clear Cache and Reinstall in RedHat
Both yum and dnf maintain cache to speed up package management tasks. Clearing the cache can be useful when you want to ensure that you are fetching the latest package information from the repositories. Reinstalling the package after clearing the cache can be a useful solution for unmet dependencies.
- Open the RHEL/Fedora terminal.
- Run the command to clear all cache
sudo yum clean all
OR,
sudo dnf clean all
EXPLANATION- yum / dnf: The package manager itself.
- clean: This is the subcommand used to perform cache-cleaning operations.
- all: This argument specifies that you want to clean all types of cache, including metadata, packages, and headers.
- Enter the user password.The above command will remove a number of cache files.
- Now, you can retry to install the package that showed unmet dependency by the command:
sudo dnf reinstall -y <package name>
EXPLANATION- sudo: Enables administrative privileges.
- dnf: Uses DNF package manager.
- reinstall: Command to remove the existing version and install the package again.
- -y: Answer YES automatically to all the confirmation prompts.
- <package name>: Name of the package.
Note: Use the name of the package that has unmet dependencies instead of <package name> in the following command.
- Enter the user password if asked.Fixing the unmet dependencies, the above command will reinstall Firefox.
Comparative Analysis of Methods to Solve Unmet Dependencies Error
I’ve shown different ways to solve packages’ unmet dependencies error for different Linux distributions. You might be confused about deciding which one suits you the best. Here’s a comparison between the methods provided to give you an overview of the pros and cons.
Distro | Solution | Pros | Cons |
---|---|---|---|
Ubuntu | Solution 1 |
|
|
Solution 2 |
|
|
|
Solution 3 |
|
|
|
Solution 4 |
|
|
|
Solution 5 |
|
|
|
Solution 6 |
|
|
|
Red Hat | Solution 1 |
|
|
Solution 2 |
|
|
|
Solution 3 |
|
|
For Ubuntu, if you are comfortable with CLI and want to install all unmet dependencies automatically you can use Solution 1. However, if you are not comfortable with CLI, you can use Solution 6 in this situation. However, if you want to explore suggestions of possible solutions, use solution 2. Additionally, if you know that repository misconfiguration is causing the issue, try using Solution 03 and if it fails, use Solution 04. In case it shows a repository lock or held package error, apply Solution 05.
For RedHat, if you want to install all unmet dependencies automatically you can use Solution 1. However, if you know that repository misconfiguration is causing the issue, try using Solution 02 and if it fails, use Solution 03.
Conclusion
When you encounter packages’ unmet dependency issues, the first step is to carefully read the error messages that are displayed during the installation or update process. These messages often provide valuable information about which packages are conflicting and why. Then apply the solution methods described in this article. Moreover, always try to keep your repositories up-to-date.
People Also Ask
Related Articles
- How To Check Package Dependencies in Linux [3 Easy Ways]
- How to Install Dependencies Using dpkg? [Easiest Solution]
- How to Install Missing Dependencies in Ubuntu? [4 Methods]
- Install Dependencies Automatically in Ubuntu [3 Exclusive Methods]
- 5 Methods to Remove Package and Dependencies in Ubuntu
- How to Install RPM Package With Dependencies? [3 Methods]
- 2 Ways to Install RPM Without Dependencies in Linux
- How to Check RPM Reverse Dependencies in Linux? [4 Methods]
- [Solved] RPM Failed Dependencies Error in RedHat
- 2 Methods to Install YUM Packages with Dependencies
- Remove Packages without Dependencies Using Yum [2 Methods]
- How to Check APT Dependency Tree in Linux? [4 Methods]
<< Go Back to Dependencies in Linux | Package Management in Linux | Learn Linux Basics
Hi,
Thanks for your explanations.
A remark : on my Linux Mint 21.3 Cinnamon the command “sudo apt -o Debug::pkgProblemResolver=yes dist-upgrade” doesn’t work, but the command “sudo apt dist-upgrade -o=Debug::pkgProblemResolver=yes dist-upgrade” works.
Philippe
Hi Philippe,
Most of the time, the command
dist-upgrade
works fine from both positions. But you don’t have to use ‘dist-upgrade’ twice as you mentioned in your command, use it only after thesudo
.Thanks a lot for your remark and appreciation.
This worked for me on Ubuntu:
sudo apt update
Let it update. Then:
sudo apt –fix-broken install
Wow, your solution worked like a charm! I was struggling with this issue for hours and your blog post saved me. Thank you so much for sharing this and helping me resolve the error!
Thanks for sharing this solution! I encountered the same unmet dependencies error while trying to install a package, and your step-by-step guide helped me resolve it quickly. I appreciate the clarity and detail in your explanation!
Thank you for this detailed guide! I struggled with the unmet dependencies error for a while, and your step-by-step solutions made it easy to resolve. It’s great to see such clear instructions, especially for those new to Linux. Keep up the great work!