Product SiteDocumentation Site

5.2.4. Determining which packages require a certain capability

In addition to querying capabilities and requirements of a particular package, you can query the capabilities themselves. This function allows you to check which packages require a given capability.
The --whatrequires option tells the rpm command to report on which packages in the RPM database require a certain capability. The basic syntax is:
rpm –q query_options --whatrequires capability
Some packages are not required by anything:
$ rpm -q --whatrequires tcsh
no package requires tcsh
Note
Don’t worry about the poor tcsh package being lonely. Because other packages do not require this package, you can easily remove the tcsh package without affecting the rest of your system.
This example shows a package name as the capability. Shared libraries are also considered capabilities. You can query on these as well. For example:
$ rpm -q --whatrequires librpm-4.1.so
rpm-4.1-1.06
net-snmp-5.0.1-6
rpm-python-4.1-1.06
rpm-devel-4.1-1.06
rpm-build-4.1-1.06
This example shows that the core RPM library is used by a number of RPM-related packages, along with, oddly enough, the net-snmp system-management package.
The capability you query for must be an explicit capability. For example, you will get different results if you query for the bash package or the command, /bin/bash. If you query for the bash package, you will see the packages that explicitly require the capability bash. For example:
$ rpm -q --whatrequires bash
gpm-1.19.3-20
info-4.0b-3
initscripts-6.40-1
sendmail-8.11.6-3
sysklogd-1.4.1-4
vixie-cron-3.0.1-63
ypbind-1.8-1
ypserv-1.3.12-2
If you instead query for the capability /bin/bash, that is, the file /bin/bash, you will see a different list of packages. For example:
$ rpm -q --whatrequires /bin/bash
apmd-3.0final-34
at-3.1.8-20
autofs-3.1.7-21
autofs-3.1.7-21
bash-2.05-8
bind-9.1.3-4
cipe-1.4.5-6
crontabs-1.10-1
dialog-0.9a-5
gpm-1.19.3-20
hotplug-2001_04_24-11
initscripts-6.40-1
ipchains-1.3.10-10
iproute-2.2.4-14
kudzu-0.99.23-1
logwatch-2.1.1-3
man-1.5i2-6
mkbootdisk-1.4.2-3
mkinitrd-3.2.6-1
mutt-1.2.5i-17
openssh-server-3.1p1-2
pine-4.44-1.72.0
rpm-build-4.0.3-1.03
rusers-server-0.17-12
sendmail-8.11.6-3
shapecfg-2.2.12-7
sharutils-4.2.1-8
sysklogd-1.4.1-4
tetex-1.0.7-30
ucd-snmp-4.2.1-7
vixie-cron-3.0.1-63
xinetd-2.3.3-1
ypbind-1.8-1
ypserv-1.3.12-2
There is no short form for the --whatrequires option.
Other capabilities, especially system-level shared libraries, are used by a large number of packages. For example:
# rpm -q --whatrequires libcrypt.so.1 | sort
autofs-3.1.7-21
cvs-1.11.1p1-3
cyrus-sasl-1.5.24-23
cyrus-sasl-devel-1.5.24-23
cyrus-sasl-plain-1.5.24-23
fetchmail-5.9.0-1
ircii-4.4Z-7
krbafs-1.0.9-2
nss_ldap-172-2
openldap12-1.2.12-4
openldap-2.0.11-13
openldap-clients-2.0.11-13
pam-0.75-19
pam_krb5-1.46-1
passwd-0.64.1-7
perl-5.6.0-17
pine-4.44-1.72.0
pwdb-0.61.1-3
python-1.5.2-35
rsh-0.17-5
rsh-server-0.17-5
screen-3.9.9-3
sendmail-8.11.6-3
shadow-utils-20000902-4
sh-utils-2.0.11-5
SysVinit-2.78-19
tcsh-6.10-6
util-linux-2.11f-17
vim-enhanced-5.8-7
wu-ftpd-2.6.1-20
xinetd-2.3.3-1
ypserv-1.3.12-2
yp-tools-2.5-1
Quite a few packages require encryption and decryption (the purpose of this library), making this library crucial to operating the system. Many of the packages listed here are in turn depended on by even more packages.
To help trace back capabilities, you can combine the queries. For example:
$ rpm -q --provides sendmail
smtpdaemon
sendmail = 8.11.6-3
$ rpm -q --whatrequires smtpdaemon
fetchmail-5.9.0-1
mutt-1.2.5i-17
The first command lists the capabilities that the sendmail package provides, including the generic capability of smtpdaemon. You can then list which packages require this particular capability, as shown in the second command. This is a big help for wading through a mess of packages depending on packages depending on yet more packages.