FUNDAMENTALS A Complete Guide for Beginners
Dependency refers to a relationship among software packages that indicates that one package relies on another to function correctly. Actually, dependencies are used to ensure that the required packages are installed on a system before a particular software package can be installed or run successfully. However, “RPM failed dependencies” is an error due to either missing or incompatible packages that are dependencies for your system. In this tutorial, I’ll discuss some common reasons of RPM failed dependencies and how to mitigate them.
Key Takeaway
- Installing RPM package in RHEL.
- Inspecting dependency issues regarding red hat package installation.
- Resolving failed dependencies using different package managers.
Requirements
- System running on RHEL/Fedora.
- Sudo privileges to use the core functionality of package managers.
Cause of RPM Failed Dependencies
There are several potential causes for RPM (Red Hat Package Manager) failed dependency errors:
- Missing Dependencies: The most common cause is that one or more required dependencies are not installed on the system.
- Incompatible Versions: The installed versions of packages may be incompatible with the version required by the package you’re trying to install.
- Conflicting Packages: Another package with the same name but different contents may be installed, causing conflicts with the package you want to install.
- Repository Issues: The repository from which you’re trying to install the package may be misconfigured or incomplete. Ensure that your repositories are correctly set up and up-to-date.
- Corrupted RPM Database: Corruption in the RPM database can lead to dependency issues. This can happen due to filesystem errors or system crashes.
- Dependency Chain: Sometimes, a dependency issue is a part of a chain of dependencies. One package depends on another, which depends on yet another, and so on. If any link in the chain is broken, it can result in a dependency failure.
7 Solutions to Resolve RPM Error: Failed Dependencies in RedHat
If you encounter RPM package installation errors due to failed dependencies, it generally means that the package you are trying to install depends on other packages or libraries that are either missing or incompatible with your system. For example, I have downloaded an RPM file of Google Chrome, and it raised a failed dependency error when I tried to install it.In this tutorial, I’ll show you some recovery techniques so that you can resolve failed dependency errors from the above-like situation.
Reason 01: Missing Dependencies
The most common cause of RPM failed dependencies is missing dependencies, which means that one or more required dependencies are not installed on the system. When you encounter missing dependencies while installing software on a Red Hat-based system you can follow the below solutions to resolve it.
Solution 01: Install Dependency Using YUM to Resolve RPM Error Failed Dependencies
YUM and Yumdownloader are two CLI (Command Line Interface) utilities used in Red Hat-based Linux distributions for package management. Yumdownloader focuses on downloading RPM packages from repositories, rather than installing or managing them. It allows you to download individual packages and their dependencies to a specified directory. So, you can use it to download the required dependencies and then install it using YUM.
Now, follow these steps to resolve failed dependencies of Google Chrome using yumdownloader:
Steps to Follow >
➊ Open the RHEL/Fedora terminal.
➋ Make a separate folder and navigate to it by the below commands:
mkdir ~/myfolder
cd ~/myfolder
- mkdir: Command to create a new directory.
- cd: Command to Change Directory to the specified one.
- ~/myfolder: Absolute path of the newly created folder.
Note: You can use any name instead of myfolder, but consider the same name you choose in all the commands in this solution.
➌ Now, run the command to download all dependencies of Google Chrome.
sudo yumdownloader --resolve google-chrome-stable
- sudo: Enables administrative permission.
- yumdownloader: Command-line utility used for downloading RPM packages from YUM repositories.
- –resolve: This option instructs yumdownloader to resolve and download not only the specified package (“google-chrome-stable“) but also all its dependencies.
- google-chrome-stable: Full name of the package.
➍ Type the user password and press ENTER.
➎ Now, run the command to install package with the dependencies:
sudo yum install -y *.rpm
- yum: Uses YUM package manager.
- install: Command to install package using YUM.
- -y: Answer YES automatically to all the confirmation prompts.
- *.rpm: Indicates every file in the current directory which has .rpm
yum list installed | grep chrome
- list: Command to make a list.
- installed: Shows the name of all installed package.
- | (Piping Symbol): Transfers the output of a command as the input of the next command.
- grep: Searches for a keyword or pattern from output in the terminal.
- chrome: Keyword from the name of the package that I want to search.
Solution 02: Install Dependency Using DNF to Resolve RPM Error Failed Dependencies
DNF stands for “Dandified Yum” and is a software package management utility used in modern Red Hat-based Linux distributions, such as Fedora, CentOS, and RHEL (Red Hat Enterprise Linux). DNF is the successor to the older yum package manager and offers several improvements and enhancements. You can use it to download and install dependency packages in the following ways to resolve failed dependencies.
Steps to Follow >
➊ Open the RHEL/Fedora terminal.
➋ Make a separate folder, navigate to it and download the required dependencies by the below commands:
mkdir ~/mydirectory
cd ~/mydirectory
sudo dnf download google-chrome-stable
- mkdir: Command to create a new directory.
- cd: Command to Change Directory to the specified one.
- ~/mydirectory: Absolute path of the newly created folder.
- download: Command for downloading a package.
- google-chrome-stable: Name of the package.
Note: You can use any name instead of mydirectory, but consider the same name you choose in all the commands in this solution.
➌ Now, run the command to install the package with dependencies:
sudo dnf install -y *.rpm
- sudo: Enables administrative privileges.
- dnf: Uses DNF package manager.
- install: Command to install package using DNF.
- -y: Answer YES automatically to all the confirmation prompts.
- *.rpm: Indicates every file in the current directory which has .rpm
➍ Type the user password if asked and press ENTER.➎ After running the above command, you can check whether the package is installed or not by the command below:
dnf list installed | grep chrome
- list: Command to make a list.
- installed: Shows the name of all installed package.
- | (Piping Symbol): Transfers the output of a command as the input of the next command.
- grep: Searches for a keyword or pattern from output in the terminal.
- chrome: Keyword from the name of the package that I want to search.
Solution 03: Install Dependency Using RPM to Resolve RPM Error Failed Dependencies
RPM (Red Hat Package Manager) is the default package management tool for RedHat-based Linux distributions. It can download and install any RPM packages that can be helpful in solving the rpm error failed dependency issue. So, you can use it to download the rpm file of the package and required dependencies and then install them using RPM.
Now, follow these steps to manually resolve failed dependencies of Google Chrome using rpm:
Steps to Follow >
➊ Open the RHEL/Fedora terminal.
➋ Make a separate folder, navigate to it and download required dependencies by the below commands:
mkdir ~/mychrome
cd ~/mychrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
- mkdir: Command to create a new directory.
- cd: Command to Change Directory to the specified one.
- ~/mychrome: Absolute path of the newly created folder.
- wget: Command which downloads files or webpages non-interactively from the network.
Note: You can use any name instead of mychrome, but consider the same name you choose in all the commands in this solution.
➌ Try running this command for installing the downloaded package:
sudo rpm -ivh *.rpm
- sudo: Enables administrative privileges.
- rpm: Lists all files and folders in the current directory.
- -ivh: Combined options that indicate the following:
Option | Meaning |
---|---|
-i | Option to install a package using rpm. |
-v | This option is used for verbose (detailed information about the installation process) output. |
-h | Displays a progress bar as a series of hash (#) symbols during the installation. |
- *.rpm: Indicates every file in the current directory which has .rpm.
➍ Type the user password and press ENTER.But it shows a failed dependency error on liberation-fonts. Execute the command in the next step to install liberation-fonts.
➎ Now, run the below command to resolve liberation-fonts:
sudo yum install -y liberation-fonts
- yum: Uses YUM package manager.
- install: Command to install package using DNF.
- -y: Answer YES automatically to all the confirmation prompts.
- liberation-fonts: Name of the failed dependency package.
Note: If you see error dependency on other packages, use the package name instead of liberation-fonts in the above command. In case you see multiple packages in failed dependency list, write them separated by SPACE in the above command. For example:
sudo yum install -y <failed dependency 1> <failed dependency 2> …
Use the name of failed dependency packages in the place of <failed dependency 1>, <failed dependency 2>.
➏ After resolving dependencies, you can run the command shown in step ➌ to install the package.This time it shows no failed dependency and installs the package completely.
➐ After running the above command, you can check whether the package is installed or not by the command below:
rpm -qa | grep google-chrome
- rpm: Uses RPM package manager.
- -qa: Stands for Query A This is used to query the status of all installed packages.
- | (Piping Symbol): Transfers the output of a command as the input of the next command.
- grep: Searches for a keyword or pattern from output in the terminal.
- google-chrome: Keyword from the name of the package that I want to search.
Reason 02: Incompatible Versions/Conflicting Packages
Incompatible versions or conflicting packages occur when you try to install software that relies on different versions of a library or component than what is already installed on your system. This can lead to issues with software functionality or system stability. Here’s how to handle incompatible versions or conflicting packages.
Solution 01: Using YUM to Resolve RPM Error Failed Dependencies
When you face incompatible versions or conflicting package errors, it means you may have installed a version of a dependency package that is not compatible with the system. So, first you have to remove it and try to reinstall it by the following steps.
Steps to Follow >
➊ Open the RHEL/Fedora terminal.
➋ Type the following command to remove the package with all its dependencies:
sudo yum remove google-chrome-stable
- sudo: Grants administrative permissions.
- yum: Calls YUM package management tool.
- remove: Command to remove a package using yum.
- google-chrome-stable: Name of the package that raised failed dependency.
➌ Type the user password and press ENTER.
➍ Type Y and press ENTER when the confirmation prompt appears.The above command will remove Google Chrome with all the incompatible dependencies from your system.
➎ Now, try reinstalling it by the following command:
sudo yum install -y google-chrome-stable
- install: Command to install package using YUM.
- -y: Answer YES automatically to all the confirmation prompts.
- google-chrome-stable: Name of the package.
➏ Enter the user password if asked.This will reinstall the package resolving all the incompatibilities by YUM automatically.
Solution 02: Using DNF to Resolve RPM Error Failed Dependencies
Dandified Yum, shortly known as DNF, is the updated version of YUM and can also be used to resolve incompatibility issues. Follow the below guidelines for this purpose.
Steps to Follow >
➊ Open the RHEL/Fedora terminal.
➋ Type the following command to remove the package with all its dependencies:
sudo yum remove google-chrome-stable
- sudo: Grants administrative permissions.
- dnf: Calls DNF package management tool.
- remove: Command to remove a package using yum.
- google-chrome-stable: Name of the package that raised failed dependency.
➌ Type the user password and press ENTER.
➍ Type Y and press ENTER when the confirmation prompt appears.➎ Now, try reinstalling it by the following command:
sudo dnf install -y google-chrome-stable
- install: Command to install package using YUM.
- -y: Answer YES automatically to all the confirmation prompts.
- google-chrome-stable: Name of the package.
➏ Enter the user password if asked.This will reinstall the package resolving all the incompatibilities by DNF automatically.
Reason 03: Repository Issues
Repositories are the storehouse of packages wherefrom package managers collect packages and necessary information about dependencies of the package. For RPM packages, failed dependency can occur if the repository from which you’re trying to install the package may be misconfigured or incomplete. So, ensuring that your repositories are correctly set up and up-to-date may solve the issue.
Solution 01: Updating Repositories Using Package Managers
The package manager (dnf or yum) on Red Hat-based systems serves you the best in resolving these 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:
Steps to Follow >
➊ Open the RHEL/Fedora terminal.
➋ Type the following command:
sudo yum upgrade && sudo yum update
- 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 02: Clearing Cache
Both yum and dnf maintain cache to speed up package management tasks. However, clearing the cache can be useful when you want to ensure that you are fetching the latest package information from the repositories. YUM and DNF provide specific cache clearing commands:
Command for Clearing | YUM Command | DNF Command |
---|---|---|
Package cache | sudo yum clean packages | sudo dnf clean packages |
Metadata cache | sudo yum clean metadata | sudo dnf clean metadata |
Header cache | sudo yum clean headers | sudo dnf clean headers |
Clearing all cache | sudo yum clean all | sudo dnf clean all |
If you are not sure which cache is causing the error, you can remove all kinds of cache. Here’s how you can clear all the cache.
Steps to Follow >
➊ Open the RHEL/Fedora terminal.
➋ Run the command to clear all cache.
sudo yum clean all
OR,
sudo dnf clean all
- yum / dnf: The package manager itself.
- clean: This is the subcommand for performing 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. After clearing the files, you can retry to install the package that showed failed dependency.
Comparative Analysis of Methods
I’ve shown different ways to solve rpm failed dependencies error according to the reasons. You might be confused to decide which one suits you the best. Here’s a comparison between the methods provided to give you an overview of the pros and cons.
Solution | Pros | Cons | |
---|---|---|---|
Reason 1 | Solution 1 |
|
|
Solution 2 |
|
|
|
Solution 3 |
|
|
|
Reason 2 | Solution 1 |
|
|
Solution 2 |
|
|
|
Reason 3 | Solution 1 |
|
|
Solution 2 |
|
|
For problem 1 (Missing dependencies), Use solution 1 or 2 if you are a beginner and stuck in installing a package you want to install for your daily purpose. But if you are a developer and trying to do some experiments of package behavior under different dependencies, use solution 3 because it will facilitate you to manually download a specific version of dependencies.
For problem 2 (Incompatible version), use solution 1 if you are using an older version of RHEL. In case you are using the latest version of RHEL greater than 8, use solution 2 because it will provide you with more automatic resolution for failed dependencies.
Finally for problem 3 (Repository issues), if you haven’t updated your repositories for a long time, use solution 1. On the other hand, if you know which cache is causing the error, you can use solution 2. Please note that you can use both of the solutions one after one.
Conclusion
When you encounter rpm failed 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]
- 2 Methods to Install YUM Packages with Dependencies
- Remove Packages without Dependencies Using Yum [2 Methods]
- [Solved] The Following Packages Have Unmet Dependencies Error
- How to Check APT Dependency Tree in Linux? [4 Methods]
<< Go Back to Dependencies in Linux | Package Management in Linux | Learn Linux Basics