How to check package dependencies on Ubuntu or Debian

A typical .deb package relies on other packages to install and operate properly. With package managers such as apt-get and aptitude, you can resolve package dependencies, and have all prerequisites installed automatically.

Suppose for whatever reason, you want to manually resolve package dependencies of a particular package, in which case you need to identify all its dependent packages first.

In the following, I will explain how to check package dependencies on Ubuntu or Debian.

A command-line tool called apt-rdepends can help you in this case. This tool can recursively check dependencies of .deb package, and list all found package dependencies.

To install apt-rdepends on Ubuntu or Debian:

$ sudo apt-get install apt-rdepends

To show package dependency information of a particular package (e.g., tcpdump), run the command with package name:

$ sudo apt-rdepends tcpdump
Reading package lists... Done
Building dependency tree
Reading state information... Done
tcpdump
  Depends: libc6 (>= 2.14)
  Depends: libpcap0.8 (>= 1.2.1)
  Depends: libssl1.0.0 (>= 1.0.0)
libc6
  Depends: libc-bin (= 2.15-0ubuntu20)
  Depends: libgcc1
  Depends: tzdata
libc-bin
libgcc1
  Depends: gcc-4.7-base (= 4.7.2-2ubuntu1)
  Depends: libc6 (>= 2.14)
  PreDepends: multiarch-support
. . . .

Visualization of Package Dependencies

The text output of apt-rdepends can be difficult to read due to many recursively defined dependency relationships. That is when visualization can help. apt-rdepends can export package dependency information into a dot file, which can be used by a GUI-based graph editor called dotty to visualize package dependencies in a graph format.

For visualization, first install dotty graph editor tool:

$ sudo apt-get install graphviz

Finally, to visualize package dependencies with dotty:

$ sudo apt-rdepends -d tcpdump | dot > tcpdump.dot
$ dotty tcpdump.dot

The visualization result of tcpdump package looks like the following.

So far in this tutorial, we check package dependencies on Debian-based systems. If you want to know more about package dependencies on RPM-based systems such as Fedora or CentOS, please refer to this tutorial.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

Leave a comment

Your email address will not be published. Required fields are marked *

Current ye@r *