Recursive dependencies
I can reveal package dependencies like this
apt-cache show wget | grep ^Depends
However I would like to also list the dependencies for the dependencies, so the output would be something like this
wget
libc6
libgcc1
gcc-4.9-base
libidn11
libssl1.0.0
debconf
libuuid1
passwd
libpam0g
libselinux1
libsemanage1
libpam-modules
debianutils
zlib1g
This example has a depth of 4 but I would like the actual solution to have full depth.
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:
falko@falko-virtual-machine:~$ 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
falko@falko-virtual-machine:~$
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
Copied from HowToForge