Listing packages in Yum that depend on another installed package
The rpm option you want is:
rpm -q --whatrequires sqlite
Edited: added --installed per discussion in other answers/comments
Edited: removed --installed as it is an invalid option for rpm
Answer
repoquery -q --installed --whatrequires sqlite
Explanations
rpm -q --whatrequires sqlite
only reports dependencies on package names.
On the contrary, repoquery
acts as follow (from manpages):
--alldeps
When used with --whatrequires, look for non-explicit dependencies in addition to explicit ones (e.g. files and Provides in addition to package names).
This is the default.
Example
Let's take package libdb
.
# rpm -q --whatrequires libdb
no package requires libdb
No package depends on libdb
, so we should be able to remove it smoothly. However...
# yum remove -y libdb
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package libdb.x86_64 0:5.3.21-19.el7 will be erased
--> Processing Dependency: libdb(x86-64) = 5.3.21-19.el7 for package: libdb-utils-5.3.21-19.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: pam-1.1.8-12.el7_1.1.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-libs-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: libdb-utils-5.3.21-19.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: cyrus-sasl-lib-2.1.26-20.el7_2.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-python-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: python-libs-2.7.5-39.el7_2.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-devel-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-build-libs-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: iproute-3.10.0-54.el7_2.1.x86_64
--> Running transaction check
. . .
. . .
. . .
Error: Trying to remove "systemd", which is protected
Error: Trying to remove "yum", which is protected
As you can see some other packages were depending not directly on the package, but on file libdb-5.3.so()(64bit)
provided by it.
Finally, here is the real list of packages depending on libdb
:
# repoquery -q --installed --whatrequires libdb
cyrus-sasl-lib-0:2.1.26-20.el7_2.x86_64
iproute-0:3.10.0-54.el7_2.1.x86_64
libdb-utils-0:5.3.21-19.el7.x86_64
pam-0:1.1.8-12.el7_1.1.x86_64
postfix-2:2.10.1-6.el7.x86_64
python-libs-0:2.7.5-39.el7_2.x86_64
rpm-0:4.11.3-17.el7.x86_64
rpm-build-libs-0:4.11.3-17.el7.x86_64
rpm-devel-0:4.11.3-17.el7.x86_64
rpm-libs-0:4.11.3-17.el7.x86_64
rpm-python-0:4.11.3-17.el7.x86_64
For dnf (new version of yum) you may try with repoquery wrapper command:
dnf repoquery --whatrequires sqlite
If it is not available you may install it with command:
dnf -y install dnf-plugins-core