在 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).
并且交易失败。
查看解决方案如何解决此问题。
要解决此问题,可以使用以下命令:
这表示使用参数
yum
再次执行最后一个事务。可能并非在所有情况下都需要(在我的情况下,因为 grub2 包问题)force-reinstall
。--setopt=protected_multilib=false
在此过程中,事务可能会报告两次列出的包的一些错误,但是它完成并且 RPM 的状态似乎是正确的。
然而,yum 仍然抱怨未完成的交易(但不再失败)。现在可以安全地删除它们:
截至目前,YUM 和以前一样运作。