Issue
When checking for packages that depend on a particular package (in this case lz4
) using rpm
it does not list any packages that require either lz4-1.7.5-2.el7.i686
and lz4-1.7.5-2.el7.x86_64
...
# rpm -q --whatrequires lz4-1.7.5-2.el7.i686
no package requires lz4-1.7.5-2.el7.i686
# rpm -q --whatrequires lz4-1.7.5-2.el7.x86_64
no package requires lz4-1.7.5-2.el7.x86_64
#
But I can't uninstall either of them without using rpm --nodeps
as they appear to be needed by systemd
and/or systemd-libs
.
# rpm --erase --allmatches lz4
error: Failed dependencies:
liblz4.so.1()(64bit) is needed by (installed) systemd-libs-219-57.el7_5.1.x86_64
liblz4.so.1()(64bit) is needed by (installed) systemd-219-57.el7_5.1.x86_64
liblz4.so.1 is needed by (installed) systemd-libs-219-57.el7_5.1.i686
#
It looks like the output of rpm --whatrequires
is wrong but is it? (I doubt that it is actually wrong - but I don't understand why doesn't it include systemd
or systemd-libs
?
I thought if using rpm --erase --test
instead of rpm --whatrequires
to identify if packages that have dependencies but is there another more reliable way to do this?
Thanks for your help.
Solution
this is a bit tricky. rpm --whatrequires
tracks capabilities; not simply packages.
If you try again; you will see that:
rpm --whatrequires "liblz4.so.1()(64bit)"
will provide you the results.
rpm --erase --test
seems a good way to go for me. An alternative would be to loop over the capabilities provided by the package that you want to remove; but that will be slower. Here is a small bash script that loops over the capabilities of lz4 and prints the packages who depend on those capabilities:
packageToRemove=lz4
for capability in $(rpm -q $packageToRemove --provides | awk '{print $1}')
do
echo "packages requiring $capability:"
rpm -q --whatrequires "$capability"
done
Answered By - Chris Maes