使用 RPM 卸载包时意外失败的依赖项

Unexpected failed dependencies when uninstalling a package using RPM

当使用 rpm 检查依赖于特定包(在本例中为 lz4)的包时,它不会列出任何需要 lz4-1.7.5-2.el7.i686 和 [=15= 的包]...

# 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
#

但我无法在不使用 rpm --nodeps 的情况下卸载它们中的任何一个,因为 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
#

看起来 rpm --whatrequires 的输出是错误的但是是吗? (我怀疑它实际上是错误的 - 但我不明白为什么它不包括 systemdsystemd-libs?

我想如果使用 rpm --erase --test 而不是 rpm --whatrequires 来识别包是否具有依赖性,但是否有另一种更可靠的方法来做到这一点?

感谢您的帮助。

这有点棘手。 rpm --whatrequires 轨道 能力;不仅仅是包裹。

如果您再试一次;你会看到:

rpm --whatrequires "liblz4.so.1()(64bit)"

将为您提供结果。

rpm --erase --test 对我来说似乎是个好方法。另一种方法是遍历要删除的包提供的功能;但这会更慢。这是一个小的 bash 脚本,它循环遍历 lz4 的功能并打印依赖于这些功能的包:

packageToRemove=lz4
for capability in $(rpm -q $packageToRemove --provides | awk '{print }')
do
    echo "packages requiring $capability:"
    rpm -q --whatrequires "$capability"
done

下面的命令给了我预期的结果,但我仍然不明白为什么 rpm --whatrequires 不起作用。 (在构建我的第一个包之前,我可能不会弄清楚)。

# repoquery --alldeps --whatrequires --cache --installed lz4
systemd-0:219-57.el7.x86_64
systemd-libs-0:219-57.el7.i686
systemd-libs-0:219-57.el7.x86_64
#

但在某些情况下,输出可以是 "interesting"...

# repoquery --alldeps --whatrequires --cache --installed lvm2-libs
lvm2-7:2.02.177-4.el7.x86_64
lvm2-libs-7:2.02.177-4.el7.x86_64
# 

# repoquery --whatrequires --cache --installed lvm2
lvm2-7:2.02.177-4.el7.x86_64
#