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.
Subscribe to Xmodulo
You can have daily Linux tutorials and FAQs delivered to your email inbox. Simply enter your email address below to subscribe to our mailing list. You will receive hands-on guides and carefully written tutorials related to Linux, everything for free.