YUM 损坏的交易

YUM 损坏的交易

在 RHEL 7 上,在一段时间后使用 YUM 进行更新时,YUM 事务无法正确完成,因为与服务器的连接被中断并且 YUM 会话未在屏幕中运行。

--> Processing Conflict: firewalld-0.4.4.4-6.el7.noarch conflicts selinux-policy < 3.13.1-118.el7
--> Finished Dependency Resolution
You could try using --skip-broken to work around the problem
** Found 157 pre-existing rpmdb problem(s), 'yum check' output follows:
audit-2.7.6-3.el7.x86_64 is a duplicate with audit-2.6.5-3.el7_3.1.x86_64
audit-libs-2.7.6-3.el7.x86_64 is a duplicate with audit-libs-2.6.5-3.el7_3.1.x86_64
audit-libs-python-2.7.6-3.el7.x86_64 is a duplicate with audit-libs-python-2.6.5-3.el7_3.1.x86_64
bash-4.2.46-29.el7_4.x86_64 is a duplicate with bash-4.2.46-21.el7_3.x86_64
32:bind-libs-9.9.4-51.el7_4.2.x86_64 is a duplicate with 32:bind-libs-9.9.4-50.el7_3.1.x86_64
32:bind-libs-lite-9.9.4-51.el7_4.2.x86_64 is a duplicate with 32:bind-libs-lite-9.9.4-50.el7_3.1.x86_64
32:bind-license-9.9.4-51.el7_4.2.noarch is a duplicate with 32:bind-license-9.9.4-50.el7_3.1.noarch
...

因此交易并未完成,并且某些软件包以 2 个版本列出。

在这种状态下,yum update报告:

# yum update
Loaded plugins: product-id, search-disabled-repos
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).

并且交易失败。

请参阅解决方案,了解如何解决此问题。

答案1

要解决该问题,可以使用以下命令:

$ yum history redo force-reinstall last --setopt=protected_multilib=false

这就是说yum用参数再次执行最后一个事务force-reinstall。可能--setopt=protected_multilib=false并非在所有情况下都需要(在我的情况下是这样,因为 grub2 软件包问题)。

事务可能会在过程中报告两次列出的软件包上的一些错误,但是它完成并且 RPM 的状态似乎是正确的。

然而,百胜仍然抱怨未完成的交易(但不再失败)。现在可以安全地删除它们:

$ yum-complete-transaction --cleanup-only

目前,YUM 已恢复正常运营。

相关内容