无法使用 yum 更新服务器,重复错误

无法使用 yum 更新服务器,重复错误

尝试运行 yum update 并出现一些错误,似乎无法绕过它们,尝试了“skip-broken”,尝试了 yum-complete-transaction、package-cleanup --dupes、package-cleanup --cleandupes ...似乎都不起作用,这里是 yum update 输出:

Loaded plugins: fastestmirror, priorities, replace
Setting up Update Process
Loading mirror speeds from cached hostfile
 * ius: mirror.rackspace.com
drivesrvr                                                                                     | 2.2 kB     00:00
Resolving Dependencies
--> Running transaction check
---> Package coreutils.x86_64 0:8.4-37.el6_7.3 will be updated
--> Processing Dependency: coreutils = 8.4-37.el6_7.3 for package: coreutils-libs-8.4-37.el6_7.3.x86_64
---> Package coreutils.x86_64 0:8.4-43.el6 will be an update
---> Package glibc.i686 0:2.12-1.166.el6_7.7 will be updated
--> Processing Dependency: glibc = 2.12-1.166.el6_7.7 for package: glibc-common-2.12-1.166.el6_7.7.x86_64
---> Package glibc.i686 0:2.12-1.192.el6 will be an update
---> Package krb5-libs.i686 0:1.10.3-42z1.el6_7 will be updated
---> Package krb5-libs.i686 0:1.10.3-57.el6 will be an update
---> Package libselinux.i686 0:2.0.94-5.8.el6 will be updated
---> Package libselinux.i686 0:2.0.94-7.el6 will be an update
---> Package openssl.i686 0:1.0.1e-42.el6_7.4 will be updated
---> Package openssl.i686 0:1.0.1e-48.el6_8.1 will be an update
---> Package python-boto.noarch 0:2.38.0-1.el6 will be obsoleted
---> Package python-rsa.noarch 0:3.1.1-5.el6 will be obsoleted
---> Package python2-boto.noarch 0:2.41.0-1.el6 will be obsoleting
---> Package python2-rsa.noarch 0:3.4.1-1.el6 will be obsoleting
--> Processing Dependency: python-pyasn1 for package: python2-rsa-3.4.1-1.el6.noarch
--> Running transaction check
---> Package coreutils.x86_64 0:8.4-37.el6_7.3 will be updated
--> Processing Dependency: coreutils = 8.4-37.el6_7.3 for package: coreutils-libs-8.4-37.el6_7.3.x86_64
---> Package glibc.i686 0:2.12-1.166.el6_7.7 will be updated
--> Processing Dependency: glibc = 2.12-1.166.el6_7.7 for package: glibc-common-2.12-1.166.el6_7.7.x86_64
---> Package python-pyasn1.noarch 0:0.0.12a-1.el6 will be installed
--> Finished Dependency Resolution
Error: Package: coreutils-libs-8.4-37.el6_7.3.x86_64 (@updates)
           Requires: coreutils = 8.4-37.el6_7.3
           Removing: coreutils-8.4-37.el6_7.3.x86_64 (@updates)
               coreutils = 8.4-37.el6_7.3
           Updated By: coreutils-8.4-43.el6.x86_64 (base)
               coreutils = 8.4-43.el6
Error: Package: glibc-common-2.12-1.166.el6_7.7.x86_64 (@updates)
           Requires: glibc = 2.12-1.166.el6_7.7
           Removing: glibc-2.12-1.166.el6_7.7.i686 (@updates)
               glibc = 2.12-1.166.el6_7.7
           Updated By: glibc-2.12-1.192.el6.i686 (base)
               glibc = 2.12-1.192.el6
 You could try using --skip-broken to work around the problem
** Found 8 pre-existing rpmdb problem(s), 'yum check' output follows:
coreutils-libs-8.4-43.el6.x86_64 is a duplicate with coreutils-libs-8.4-37.el6_7.3.x86_64
coreutils-libs-8.4-43.el6.x86_64 has missing requires of coreutils = ('0', '8.4', '43.el6')
glibc-2.12-1.192.el6.x86_64 is a duplicate with glibc-2.12-1.166.el6_7.7.i686
glibc-common-2.12-1.192.el6.x86_64 is a duplicate with glibc-common-2.12-1.166.el6_7.7.x86_64
krb5-libs-1.10.3-57.el6.x86_64 is a duplicate with krb5-libs-1.10.3-42z1.el6_7.i686
libselinux-2.0.94-7.el6.x86_64 is a duplicate with libselinux-2.0.94-5.8.el6.i686
openssl-1.0.1e-48.el6_8.1.x86_64 is a duplicate with openssl-1.0.1e-42.el6_7.4.i686
2:shadow-utils-4.1.5.1-5.el6.x86_64 is a duplicate with 2:shadow-utils-4.1.4.2-19.el6_6.1.x86_64

答案1

问题在于 RPM 数据库包含某些软件包的两个条目,既有旧版本,也有新版本。

这种情况发生在之前的 yum 更新被中断,并且之后再也没有完成的时候。就你的情况而言,这种情况可能不止发生过一次。(你应该避免中断 yum 事务。如果一个事务被中断,你应该立即地用 结束它yum-complete-transaction。切勿尝试手动停止正在运行的事务。您以后可以随时撤消它。)

Yum 有时可以恢复,但偶尔也会丢失。在这种情况下,您需要自己解决问题。

有一个名为的工具package-cleanup有时可以修复这些问题,但众所周知,它会尝试选择太多包并尝试删除系统上的所有内容,这就是我一般不信任它的原因。

我会手动修复这个问题。对于每个软件包,这涉及调整 RPM 数据库,使其认为没有重复,然后更新系统。

rpm -e --nodeps --justdb coreutils-libs-8.4-37.el6_7.3.x86_64
rpm -e --nodeps --justdb glibc-2.12-1.166.el6_7.7.i686

请注意,这里我们实际上并没有删除软件包,而只是删除了表明软件包已安装的 rpmdb 条目。

此时应该可以更新系统了,

yum distro-sync

(如果没有,您需要删除其余软件包的 rpmdb 条目,然后重试。)

如果 未重新安装或更新已删除 rpmdb 条目的软件包yum distro-sync,请重新安装它们。

相关内容