How to check .deb Package Dependencies in Ubuntu

Most software or application in Ubuntu, does not come as one package and it depends on other packages to work as intended. These supporting packages are called dependency packages as they are required for the proper working of the software. Usually, the package manager in your system automatically resolves these dependencies, but sometimes an issue or error occurs and you have to resolve the issue manually.

In that case, it is better to have a detailed picture of the dependencies of the package so that you can locate the issue easily. Therefore, You will learn how to check the dependencies of any package in this article.

Check Dependencies Using APT Package Manager

You can use the apt package manager depends command to list down the dependencies associated with any particular package. For example, run the following command to see the dependencies of the vlc package.

sudo apt depends vlc

Check package dependencies using apt

You can also use the following apt-cache command to get a similar result.

sudo apt-cache depends vlc

Check .deb package dependencies using apt-cache command

If you want more detailed information about package dependencies, run the following apt show command.

sudo apt show vlc

How to use apt show command

Similarly, you can use the apt-cache show command to get more comprehensive information about package dependencies.

sudo apt-cache show vlc

Using apt-cache show

Check Dependencies Using Debian Package Manager (dpkg)

If you have to install any software from a deb file, you can check its dependencies by running one of the following commands.

sudo dpkg -I /path/to/package.deb
sudo dpkg --info /path/to/package.deb

Note: Replace /path/to/package with your deb file path before running the above command.

Check dependencies using dpkg command

dpkg info command

The above commands will show the dependencies even before the .deb package is installed. But if you want to check the dependencies of an already installed package, run the following command with your package name.

sudo dpkg -s firefox

dpkg -s command

Check Dependencies Using apt-rdepends Utility

apt-rdepends is a utility that can help you list down the package dependencies. You can install it by using the following command.

sudo apt install apt-rdepends

Install apt-rdepends

To see the dependencies tree, run the following command with your package name.

sudo apt-rdepends packagename

Using apt rdepends

You can also get information about packages that are dependent on a particular package with the following command.

sudo apt-rdepends -r vlc-bin

apt-rdepends -r vlc-bin

Check Dependencies Using reverse-depends Utility

Reverse-depends is a utility that provides information about the dependent packages. You can install it by running the following command.

sudo apt install ubuntu-dev-tools

install ubuntu-dev-tools

To list down the direct dependencies of the package, run the following command with your package name.

sudo reverse-depends -R vlc

Ubuntu reverse-depends command

Check Dependencies Using Simulated Installation/Uninstallation

You can use the -s option with the apt command to simulate the installation and uninstallation of any package to see the dependencies installed during the installation.

sudo apt install -s vlc

apt install -s command option

sudo apt remove -s php

apt remove command

Conclusion

Ubuntu/Linux packages are interdependent as they are designed to complete a single task. This article shows how you can see the package dependencies.

It is beneficial to know what packages are required or are being installed during software installation as it gives you more clarity over the installation process. It also helps you debug your installation process in case of an error.

Leave a Comment