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:
To show package dependency information of a particular package (e.g., tcpdump), run the command with package name:
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:
Finally, to visualize package dependencies with dotty:
$ 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.