有没有办法修复损坏的“yum”?这是我在 amazon linux EC2 实例上执行 sudo yum update 时意外按下 ctrl+c 导致的
$ sudo yum update
Loaded plugins: priorities, update-motd, upgrade-helper
2216 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package glibc.i686 0:2.17-36.80.amzn1 will be updated
--> Processing Dependency: glibc = 2.17-36.80.amzn1 for package: glibc-common-2.17-36.80.amzn1.x86_64
---> Package glibc.x86_64 0:2.17-36.80.amzn1 will be updated
--> Processing Dependency: glibc = 2.17-36.80.amzn1 for package: glibc-common-2.17-36.80.amzn1.x86_64
---> Package glibc.i686 0:2.17-36.81.amzn1 will be an update
---> Package glibc.x86_64 0:2.17-36.81.amzn1 will be an update
---> Package glibc-devel.x86_64 0:2.17-36.80.amzn1 will be updated
---> Package glibc-devel.x86_64 0:2.17-36.81.amzn1 will be an update
---> Package glibc-headers.x86_64 0:2.17-36.80.amzn1 will be updated
---> Package glibc-headers.x86_64 0:2.17-36.81.amzn1 will be an update
---> Package nss-softokn-freebl.i686 0:3.14.3-9.15.amzn1 will be updated
---> Package nss-softokn-freebl.i686 0:3.16.0-1.19.amzn1 will be an update
---> Package perl-ExtUtils-Install.noarch 0:1.58-280.34.amzn1 will be updated
---> Package perl-ExtUtils-Install.noarch 0:1.58-280.36.amzn1 will be an update
--> Finished Dependency Resolution
Error: Package: glibc-common-2.17-36.80.amzn1.x86_64 (@amzn-main)
Requires: glibc = 2.17-36.80.amzn1
Removing: glibc-2.17-36.80.amzn1.i686 (@amzn-main)
glibc = 2.17-36.80.amzn1
Updated By: glibc-2.17-36.81.amzn1.i686 (amzn-updates)
glibc = 2.17-36.81.amzn1
You could try using --skip-broken to work around the problem
** Found 4 pre-existing rpmdb problem(s), 'yum check' output follows:
glibc-common-2.17-36.81.amzn1.x86_64 is a duplicate with glibc-common-2.17-36.80.amzn1.x86_64
glibc-common-2.17-36.81.amzn1.x86_64 has missing requires of glibc = ('0', '2.17', '36.81.amzn1')
nss-softokn-freebl-3.16.0-1.19.amzn1.x86_64 is a duplicate with nss-softokn-freebl-3.14.3-9.15.amzn1.x86_64
2:vim-filesystem-7.4.027-2.28.amzn1.x86_64 is a duplicate with 2:vim-filesystem-7.4.027-2.27.amzn1.x86_64
答案1
您有重复的软件包,并且可能还有其他损坏。请尝试以下命令:
package-cleanup --cleandupes # Removes duplicate packages
rpm --rebuilddb # Rebuilds RPM database
yum reinstall glibc nss-softokn-freebl vim-filesystem
当一切正常后,看看 yum 是否正常运行:
yum check dependencies
如果它抱怨依赖性,请先安装它们。
答案2
请尝试
sudo yum clean all
sudo yum update
答案3
纳米/etc/yum.conf
查找 releasever=latest
如果有注释(#),请将其删除。
然后重试上面 Janne Pikkarainen 的回答。
答案4
我在中止对 glibc 进行的 yum 更新后也遇到了同样的情况。Dennis Kaarsemaker 为我指明了正确的方向。
OP 没有将任何答案标记为已接受。只是为了确认哪些部分对我的情况有效:
package-cleanup --cleandupes 不遵守规定并抱怨受到保护的包裹。
rpm --rebuilddb 没有给出任何输出,因此不确定它是否有贡献。
就我而言,yum reinstall glibc 起了作用,它完成了 glibc 和悬而未决的 glibc-common 的更新。
随后我再次运行了 package-cleanup --cleandupes,这删除了一些旧版本的软件包,主要是 glibc 和 cantos 版本,它们也在中止的 yum 更新中悬而未决。