How to Check RPM Reverse Dependencies in Linux? [4 Methods]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

The reverse dependency refers to the packages that require another package as a dependency. In a reverse dependency, packages are organized backward showing a list of packages that are required by other packages to function properly. Here, RPM reverse dependencies can be either runtime dependencies, which are required for the software to run, or build dependencies, which are required to compile or build the rpm package.

Key Takeaways

  • Getting a comprehensive idea about reverse dependency.
  • Learning the ways to check rpm reverse dependencies using various techniques.

Requirements

  • System running on RHEL/CentOS/Fedora/Ubuntu.
  • Login credentials to the system to enable sudo privilege.

Process Flow Chart

[Distro Used Throughout the Tutorial: RHEL 9.2 and Ubuntu 22.04.1 LTS]4 methods to check reverse dependencies of an RPM package

What is Reverse Dependency?

Installing a software package may depend on some other packages as a prerequisite. These packages are called dependencies. However, reverse dependency means the backward dependencies of a package. Actually, it is the opposite of forward dependencies. For example, if Package B is required by Package A, then Package A becomes a reverse dependency of Package B.Reverse dependency relation among package A, B & C.

Applications of Reverse Dependency

Reverse dependency information is valuable in various scenarios in the field of software and package management:

  • Dependency Management: It is essential for managing the dependencies of software packages by package managers. apt, yum, and dnf use this information to ensure that all of its dependencies are satisfied when you install or update a package.
  • Package Removal: When you want to remove a package, knowing its reverse dependencies helps you understand which other packages rely on it. Removing a package without considering its reverse dependencies can potentially break other software.
  • Security Patching: Security patching of a package that other software relies on can mitigate security vulnerabilities and ensure the system’s overall security.
  • Software Auditing: In enterprise environments, reverse dependency information helps organizations understand the impact of changes to software packages on the overall system.
  • Troubleshooting: When you encounter issues with a package, knowing its reverse dependencies can be helpful for troubleshooting as it allows you to identify potential conflicts or issues caused by changes in those dependencies.

Overall, reverse dependency information plays a crucial role in maintaining system stability. It helps users and administrators make informed decisions when installing, upgrading, or removing packages, ensuring reliable package management.

4 Methods to Check RPM Reverse Dependencies in Linux

RPM is a package type used by RedHat-based Linux distributions. RPM reverse dependency means the backward dependencies of a .rpm package. In other words, it is a list of the packages which require a specific package. In this tutorial, I’ll show you four methods to check rpm reverse dependencies.

You can read our Comparative Analysis of Methods to distinguish between these four methods and pick the best one for your needs.

Method 01: Using DNF to Check RPM Reverse Dependency in RedHat

DNF (Dandified Yum) is a package manager used in Linux distributions that are based on RedHat, such as Fedora, CentOS, and Red Hat Enterprise Linux (RHEL). RedHat-based distributions use packages of RPM type. In this method, I’ll show you listing the reverse dependencies of httpd RPM package using DNF. Follow the below steps:

Steps to Follow >

➊ Open the RHEL/Fedora terminal.

➋ Type the below command:

sudo dnf repoquery –requires httpd
EXPLANATION
  • sudo: Enables administrative permissions.
  • dnf: Calls dnf package management tool.
  • repoquery: Command to query in the package repository.
  • –requires: List all the packages that require the mentioned package.
  • httpd: Name of the package to query.

➌ Enter the user password if asked.

➍ Press ENTER.Checking reverse dependency of httpd by DNFThe above command lists all the packages that require httpd for their complete functionalities.

Method 02: Using YUM to Check RPM Reverse Dependency in RedHat

YUM (Yellowdog Updater, Modified) is a  CLI (Command Line Interface) utility used in RedHat-based Linux distributions for package management. As a package management tool, it can find information about dependency with the help of yum-utils. To view the reverse dependencies of a package using YUM, follow the steps.

Steps to Follow >

➊ Open the RHEL/Fedora terminal.

➋ Type the below command to install yum-utils

sudo yum install yum-utils
EXPLANATION
  • sudo: Enables administrative permissions.
  • yum: Calls yum package management tool.
  • install: Command to install a package using yum.
  • yum-utils: Name of the package to install.

➌ Enter the user password if asked.

➍ Type Y and press ENTER when the confirmation prompt appears.Install yum-utils in ubuntuThe above command will install yum-utils in your system.

➎ Now, run this command to see reverse dependencies of httpd:

repoquery –whatrequires httpd
EXPLANATION
  • repoquery: Command to query in the package repository.
  • –whatrequires: List all the packages that require the mentioned package.
  • httpd: Name of the package to query.
Checking dependencies of httpd by YUM repoqueryThe above command lists reverse dependencies of httpd.

Method 03: Using RPM to Manually Find Reverse Dependency in RedHat

RPM stands for “Red Hat Package Manager”. It is a command-line package management tool used primarily in Linux distributions that use the RPM packaging format used by RedHat-based distributions. The rpm command itself does not provide a direct way to query reverse dependencies. However, if you want to find reverse dependencies using RPM package files without querying the system, you can do it by examining the RPM database manually in the following steps:

Steps to Follow >

➊ Open the RHEL/Fedora terminal.

➋ Run the below command to list the dependencies of Firefox:

rpm -qR firefox
EXPLANATION
  • rpm: Enables administrative permissions.
  • -qR: Calls yum package management tool.
  • firefox: Command to install a package using yum
Checking dependency of Firefox by RPMThis command shows the dependency list of Firefox browser. Now with the same command, you can inspect the dependency list of every dependency package of Firefox. Thus you can gather dependency information and sketch up a reverse dependency of the package.
Note: If you have .rpm file downloaded, you can use this command:
rpmquery -p <filename.rpm>

Use the exact filename in place of <filename.rpm> with full path.

Method 04: Using APT-rDepends to Check Reverse Dependency in Ubuntu

APT-rDepends is a popular and user-friendly third-party tool for checking package dependencies and Alien is a tool for converting RPM packages to Debian. However, these tools are not generally preinstalled in Ubuntu. So, you have to install APT-rDepends and install Alien tool before proceeding in this method. These tools help performing a recursive listing of package dependencies and it also shows the required version of those dependencies. Usually, RPM is a package type for RedHat-based Linux distributions, but you can check the dependency of an RPM package even if you are using Ubuntu. To do that, follow the steps below with me.

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ Run the command:

cd ~/Downloads/

ls
EXPLANATION
  • cd: Command to Change Directory.
  • ls: Lists all the files and folders in the mentioned directory.
  • ~/Downloads/: Absolute path of Downloads
Checking RPM of teamviewer is downloaded. downloaded in The output shows that I’ve an RPM file of TeamViewer downloaded in the Downloads folder.

➌ Run this command to convert the .rpm file to .deb:

sudo alien -d teamviewer-15.43.7-2.x86_64.rpm
EXPLANATION
  • sudo: Enables administrative permissions.
  • alien: Calls Alien package management tool.
  • -d: This option converts a package to Debian (.deb).
  • teamviewer-15.43.7-2.x86_64: Name of the RPM file.
Converting RPM of teamviewer to DEB file.
Note: The conversion may take a few minutes. Use the filename according to the file you have.

➍ Type the user password and press ENTER.

➎ Run this command to install the deb file.

sudo dpkg -i teamviewer_15.43.7-3_amd64.deb
EXPLANATION
  • dpkg: Calls DPKG package manager.
  • -i: This option installs a package with dpkg.
  • teamviewer-15.43.7-2.x86_64: Name of the DEB file.
Installing teamviewer by dpkg in ubuntu
Note: Use the filename according to the deb file created in your system. You can run “ls” command to check the name.

➏ Now, run the command to view reverse dependency of teamviewer:

apt-rdepends -r teamviewer
EXPLANATION
  • apt-rdepends: Uses apt-rdepends tool.
  • -r: Used to list reverse dependencies.
  • teamviewer: Package name.
Checking reverse dependency of teamviewer by apt-rdependsThe above command will list all the packages that have dependencies on TeamViewer.

Comparative Analysis of Methods

I’ve shown four ways to check reverse dependencies in Linux. 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.

Methods Pros Cons
Method 1
  • Helps to find out which repositories contain packages that satisfy a specific dependency.
  • Useful when resolving package installation or dependency issues arise.
  • It is designed to be faster and more efficient.
  • Focuses only on listing repositories that provide packages satisfying a particular dependency.
Method 2
  • Helps to identify which packages on your system depend on a particular package.
  • Useful for understanding the impact of removing or updating a package.
  • Manages repositories, simplifying access to packages.
  • Repository configuration can be a trouble when you try to install software from third-party repository.
Method 3
  • Allows direct manipulation of RPM packages.
  • Useful for advanced users and system administrators who need fine-grained control.
  • No automatic dependency resolution.
  • It doesn’t manage repositories, which are essential for accessing packages.
Method 4
  • List out all dependencies in a recursive manner that helps to visualize all interdependencies for a software package.
  • Needs to install a third-party package that may raise a problem for beginners.

If you are using an older Red Hat-based distribution (e.g. CentOS 6), you may have yum as the default package manager. Try Method 2 in this case. On recent distributions (e.g. CentOS 8, Fedora), it’s recommended to use Method 1 as it’s the officially supported and more feature-rich package manager. For advanced users and system administrators who need fine-grained control can use Method 3. If you are using Ubuntu and want to see reverse dependencies of an RPM package, use Method 4.

Common Challenges That May Arise

Generating a list of reverse dependencies in Linux can be a useful task for understanding package dependencies. However, several common challenges may arise during this process:

  • Multiple Dependency Structures: Some packages have multiple layers of dependencies. This can make the resulting dependency tree large and challenging to visualize or interpret.
  • Missing or Unavailable Packages: Reverse dependency relies on package information in the package repositories. If a package’s dependency information is not available in the configured repositories, it can result in generating an inaccurate tree.
  • Outdated Package Information: If the package information on your system is outdated, the generated reverse dependency list may not reflect the current state of the repositories.
  • Dependency Loop Detection: Dependency loops occur when packages have circular dependencies, which can make it challenging to determine a clear picture of the reverse dependency.

To mitigate these challenges, it’s essential to keep your package repositories up to date and use reliable tools for dependency analysis.

Conclusion

The reverse dependency helps package managers to automate the process of resolving complex dependencies and provides users with a consistent and reliable system. It is a powerful tool for representing and understanding the requirement of a package as a dependency. However, you should keep your repository up to date and use software from trusted sources to get an accurate track of the reverse dependency of a package.

People Also Ask

Does RPM remove dependencies?

Yes, RPM can remove dependency packages manually by sudo rpm -e <dependency package name>. If you want automatic dependency removal, it’s better to use YUM. The command is: sudo yum remove <package name>. Use the actual package name instead of <dependency package name> and <package name>.

What are rpm dependencies?
RPM (RedHat Package Manager) is used in RedHat-based Linux distributions. It handles .rpm packages. The dependency of a .rpm package is known as rpm dependencies.  Here, dependencies can be either runtime dependencies, which are required for the software to run, or build dependencies, which are required to compile or build the software.
How to ignore dependencies with RPM?
The rpm command itself does not provide a direct way to ignore dependencies. However, if you want to ignore dependencies while installing a package, use the command: sudo yum install –nodeps <package name>. If you want to ignore dependencies while removing an RPM package, use this command: sudo yum remove –noautoremove <package name>. Replace <package name> with the actual name of the package.
How to remove rpm without dependencies?
If you want to remove rpm package without dependencies on your RHEL, use this command: sudo yum remove –noautoremove <package name>. Replace <package name> with the actual name of the package.

Related Articles


<< Go Back to Dependencies in Linux | Package Management in Linux | Learn Linux Basics

4.4/5 - (8 votes)
Ashikur Rahman

Hello, I’m Ashikur Rahman, currently working as a Linux Content Developer Executive at SOFTEKO. I have completed my graduation in Computer Science and Engineering from Khulna University of Engineering & Technology (KUET). Also, I’m pursuing my master’s in the same department at Bangladesh University of Engineering & Technology (BUET). I like to learn new technologies, contribute, and share those with others. Here my goal is to provide beneficial and user-friendly articles on Linux distribution for everyone. Read Full Bio

Leave a Comment