FUNDAMENTALS A Complete Guide for Beginners
You may need to install software in your Linux system to perform your daily tasks. For example, a VLC player to run media files like music, and video, and a text editor to prepare documents. In Linux, the software is installed in the form of a package. Sometimes installing a package successfully may depend on some other packages called dependencies. In this case, you have to install dependencies before installing the software. So, I’ll show you how to check package dependencies most easily in this tutorial.
Process flow chart to check package dependencies in Linux:
[Distro Used Throughout the Tutorial: Ubuntu 22.04.1 LTS]
Checking Dependencies in Various Distributions in Linux
There are many distributions available in Linux. Each distribution has different commands for checking the dependencies of a package. Here is a list of those commands to check dependencies for different distributions:
Note: Replace <package-name> with the actual package name. If you are using ArchLinux and pactree is not installed in your system, run the following command to install it first: Now, I’ll show you some methods to check dependencies in the Ubuntu distribution. Sometimes checking the dependencies of a software package becomes the first step of installing the software. You can use 3 different methods to check dependencies in Ubuntu. These are: 1) apt package manager 2) dpkg command 3) Third-party tool called rDpenends The apt package manager provides two straightforward ways to check any software dependency. These are 1) apt show command and 2) apt-cache command. You just have to use the sudo command to use the “apt show” method. Suppose, you want to install VLC player. Before installing, you want to check the dependency packages of VLC. This command provides information about the package such as version, type of the package, total download size, etc. Also, the output has a special section – “Depends” that lists all the dependency packages with their required version. Steps to Follow > ➊ At first, open your Ubuntu terminal. You can press CTRL+ALT+T. ➋ Then, run the following command in the command line: ➌ Now, give the password of the currently logged-in user and hit ENTER. The highlighted box shows the dependency package list with the version number inside the “Depends” section. This command lists out only the dependency package name. It doesn’t show the version, type of package, publisher information, etc. The output only focuses on the dependency package name to enhance readability for you. Steps to Follow > ➊ At first, open your Ubuntu terminal. You can press CTRL+ALT+T. ➋ Then, run the following command in the command line: ➌ Now, enter the password of the currently logged-in user and hit ENTER.The highlighted “Depends” section lists mandatory packages for VLC. Also, the output shows some recommendations and suggestion packages for a better user experience. dpkg is a package manager for Debian distribution. It can also be used to install, uninstall and update packages. You can use dpkg to check dependency if a package is already installed in your system. I will show you dpkg dependency checking for VLC. At first, I will install VLC. If you want to use dpkg to know what are the dependency files of a package, first you have to install the package. You can skip this step if you have the package already installed in your system. If you don’t, follow the steps to install the package: Steps to Follow > ➊ Open your Ubuntu terminal. Press CTRL+ALT+T. ➋ Type the following command: ➌ Now, give the password of the current user and press ENTER.This command installs the VLC player on your system. If you have already installed VLC in your system then the output will look like this:So, you have VLC downloaded and installed in your system. Once you have installed the package, anytime you can check the dependencies of the package using dpkg. To check dependencies using DPLG follow the steps: Steps to Follow > ➊ Open your Ubuntu terminal by pressing CTRL+ALT+T. ➋ Type the following command: ➌ Tap ENTER key.The output lists dependencies after version, publisher, size, and some other information. It also shows the required version of dependency packages in braces. APT-rDepends is a popular and user-friendly third-party tool for checking package dependencies. This tool performs a recursive listing of package dependencies like apt-cache but it also shows the required version of those dependencies. Installing rDepends is a one-time process. Generally, this tool is not installed in your system by default. So, you have to install it before using. Follow this steps to install rDepends: Steps to Follow > ➊ At first, open your Ubuntu terminal. You can press CTRL+ALT+T. ➋ Type the following command in the command line to install rDepends on your system: ➌ Press ENTER. ➍ Now, give the password of the currently logged-in user and hit ENTER.The above command installs apt-rdepends package to help you check other package dependencies. If this installation command doesn’t work for you, see our Common Challenge section to overcome this. Once you install rDepends on your system you can use it to check dependency for any packages. The “apt-rdepends” has the following syntax: Let’s use it for checking the dependencies of VLC. To do so, type the following command in the command line: This command will show all the dependencies in a recursive manner. For example: VLC depends on vlc-bin, vlc-bin depends on libc6, libc6 depends on libcrypt1 and so on. So, this command will help you to see all the nested dependencies required for installing the VLC player. I’ve discussed three methods for checking the dependencies of a package in Linux, which can lead you to confusion when selecting the most suitable option. Hence, to simplify your decision-making process, this section provides a comparative analysis of the three distinct approaches. By exploring the pros and cons of each scenario, you can make an informed choice that aligns with your needs and preferences.
When you are deciding to install a software and want to see the direct dependencies you should go with method 1. In the case you also want to figure out all the interdependencies among dependency packages you should go with method 3. Generally, developers use method 3 to list out all recursive dependencies. Moreover, if you want to see dependencies of a software that is already installed in your system you can use method 2, but you can use method 1 also in this case. The apt-rdepends installation shown in method 3 may fail the first time when you run sudo apt-get install -y apt-rdepends command. Updation of apt-get resolves the problem most of the time. Type the following command on your Ubuntu terminal if apt-rdepends installation fails: In this tutorial, I have illustrated the 3 easiest ways to check the dependencies of a package in a Linux system. This article will introduce you to the basic command structure provided by Linux package managers to check package dependencies. Here, I have shown the dependencies of VLC player throughout the tutorial to better demonstrate the difference among the output of each method. You can use it for other software packages by just replacing the package name. Moreover, these three methods include dependency checking that is suitable for beginners to advanced users.
Distribution
Command
RHEL
yum deplist <package-name>
Fedora
sudo dnf info <package-name>
ArchLinux
pactree -r <package-name>
OpenSUSE
sudo zypper info <package-name>
sudo pacman -S pacman-contrib
3 Methods to Check Package Dependencies in Ubuntu
Method 01: Use APT to Check Package Dependencies in Linux
A. Using apt show Command to Check Package Dependencies
sudo apt show vlc
B. Using apt-cache Command to Check Package Dependencies
apt-cache depends vlc
Method 02: Use DPKG to Check Package Dependencies of an Existing Package in Linux
Step 01: Install the Package on Ubuntu
sudo apt install vlc
Step 02: Check Dependencies Using DPKG
dpkg -s vlc
Method 03: Use APT-rDepends Tool to Check Package Dependencies in Linux
Step 01: Install APT-rDepends on Ubuntu
sudo apt-get install -y apt-rdpends
Step 02: Check Dependencies Using rDepends
sudo apt-rdepends <PackageName>
sudo apt-rdepends vlc
Comparative Analysis of Methods to Check Package Dependencies in Linux
Methods
Pros
Cons
Method 01
Method 02
Method 03
Common Challenge: rDepends Installation by “apt-get” May Not Work at First
sudo apt-get update
Conclusion
People Also Ask
Related Articles
- 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]
- [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
I am 49 years old and I work in IT since ages but I have never seen such a great, detailed but explicited way to onboard with packaging. Congratulations Ashi!
Hello DESMAREST,
Thank you so much for your incredibly kind words! It’s heartening to know that my explanation resonated with someone as experienced as yourself. If you have any questions or if there’s anything specific you’d like to explore further, feel free to reach out.