Finding Out Package Dependencies With apt-rdepends On Debian/Ubuntu

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter

Sometimes you need to find out all the dependencies of a package. This tutorial explains how to use apt-rdepends to recursively list all dependencies of a Debian/Ubuntu package.

I do not issue any guarantee that this will work for you!

 

1 Installing apt-rdepends

apt-rdepends can be installed as follows:

apt-get install apt-rdepends

If you are on Ubuntu and are not logged in as root, use

sudo apt-get install apt-rdepends

instead.

 

2 Using apt-rdepends

apt-rdepends can be used as follows:

apt-rdepends <packagename>

For example, to find out all dependencies of the package wget, run:

apt-rdepends wget

This is a sample output:

[email protected]:~$ apt-rdepends wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
wget
  Depends: dpkg (>= 1.15.4)
  Depends: install-info
  Depends: libc6 (>= 2.11)
  Depends: libssl1.0.0 (>= 1.0.0)
dpkg
  PreDepends: coreutils (>= 5.93-1)
  PreDepends: libbz2-1.0
  PreDepends: libc6 (>= 2.11)
  PreDepends: libselinux1 (>= 1.32)
  PreDepends: xz-utils
  PreDepends: zlib1g (>= 1:1.1.4)
coreutils
  PreDepends: libacl1 (>= 2.2.11-1)
  PreDepends: libattr1 (>= 2.4.41-1)
  PreDepends: libc6 (>= 2.7)
  PreDepends: libselinux1 (>= 1.32)
libacl1
  Depends: libattr1 (>= 2.4.41-1)
  Depends: libc6 (>= 2.4)
  PreDepends: multiarch-support
libattr1
  Depends: libc6 (>= 2.4)
  PreDepends: multiarch-support
libc6
  Depends: libc-bin (= 2.13-20ubuntu5)
  Depends: libgcc1
  Depends: tzdata
libc-bin
libgcc1
  Depends: gcc-4.6-base (= 4.6.1-9ubuntu3)
  Depends: libc6 (>= 2.2.5)
  PreDepends: multiarch-support
gcc-4.6-base
multiarch-support
  Depends: libc6 (>= 2.3.6-2)
tzdata
  Depends: debconf (>= 0.5)
  Depends: debconf-2.0
debconf
  PreDepends: perl-base (>= 5.6.1-4)
perl-base
  PreDepends: dpkg (>= 1.14.20)
  PreDepends: libc6 (>= 2.11)
debconf-2.0
libselinux1
  Depends: libc6 (>= 2.8)
  PreDepends: multiarch-support
libbz2-1.0
  Depends: libc6 (>= 2.4)
xz-utils
  Depends: libc6 (>= 2.7)
  Depends: liblzma2 (>= 5.0.0)
liblzma2
  Depends: libc6 (>= 2.4)
zlib1g
  Depends: libc6 (>= 2.4)
  PreDepends: multiarch-support
install-info
  Depends: libc6 (>= 2.4)
libssl1.0.0
  Depends: debconf (>= 0.5)
  Depends: debconf-2.0
  Depends: libc6 (>= 2.7)
  Depends: zlib1g (>= 1:1.1.4)
  PreDepends: multiarch-support
[email protected]:~$

For most packages, the output is even longer and might not fit on your screen. In these cases you can pipe the output into more (or less), e.g. as follows:

apt-rdepends apache2 | more

apt-rdepends apache2 | less

 

Falko Timme

About Falko Timme

Falko Timme is an experienced Linux administrator and founder of Timme Hosting, a leading nginx business hosting company in Germany. He is one of the most active authors on HowtoForge since 2005 and one of the core developers of ISPConfig since 2000. He has also contributed to the O'Reilly book "Linux System Administration".

Share this page:

Suggested articles

2 Comment(s)

Add comment

Comments

By:

good to know :)

By:

Somethimes is useful to sort packages by install date with following command:

 
ls -tl /var/lib/dpkg/info/ | less