由于Yum从CentOS 6回购(我正在使用Centos 5.6)寻找Nginx包,所以我在做Yum更新时遇到校验和错误。
下面是错误: http ://nginx.org/packages/centos/6/x86_64/repodata/a017491800bf2f9c0d3d043d30ca1e065ff89212b35159c0fa201fd9c02f77f3-primary.sqlite.bz2:[Errno -3]执行校验和错误尝试其他镜像。
有没有办法从Yum手动卸载Nginx?
在CentOS 5上从CentOS 6回购安装软件包是不明智的,应该避免。 如果你想要,请完全升级到CentOS 6。 或者,手动抓住源rpm并在CentOS 5上重build它。
至于为什么会失败:CentOS 6的较新的createrepo使用不同于CentOS 5中的yum(sha256 vs sha1 iirc)所使用的校验和algorithm,因此你的yum无法validation存储库内容。
尝试下面的命令
yum clean all
然后a
yum update
或者一个
yum upgrade
我有相同的错误信息。 在我的情况下,问题是存储库服务器使用sha256校验和algorithm对其RPM进行索引,而yum客户端软件只知道普通校验和。
我的解决scheme
python-hashlib (Python 2/3的文档) 。 /usr/lib/python*/site-packages/yum/{repos,misc}.pyc 通过replace以下文件修补/usr/lib/python*/site-packages/yum/repos.py文件:
elif sumtype == 'sha': import sha sum = sha.new() else: raise Errors.RepoError, 'Error Checksumming file, wrong \ checksum type %s' % sumtype
…与:
elif sumtype == 'sha': import sha sum = sha.new() else: import hashlib if "algorithms" in hashlib.__dict__ and sumtype in hashlib.algorithms: sum = hashlib.new(sumtype) elif sumtype in hashlib.__dict__: sum = hashlib.__dict__[sumtype]() else: raise Errors.RepoError, 'Error Checksumming file, wrong \ checksum type %s' % sumtype
修补文件/usr/lib/python*/site-packages/yum/misc.py通过replace:
else: raise MiscError, 'Error Checksumming file, bad checksum type %s' % sumtype
…与:
else: import hashlib if "algorithms" in hashlib.__dict__ and sumtype in hashlib.algorithms: sum = hashlib.new(sumtype) elif sumtype in hashlib.__dict__: sum = hashlib.__dict__[sumtype]() else: raise MiscError, 'Error Checksumming file, bad checksum type %s' % sumtype
yum现在应该可以理解和处理版本库服务器发布的sha256校验和,所以你应该能够在没有出现这个问题的情况下再次运行你的命令。
当yum客户端尚未识别校验和时,新代码将尝试使用hashlib 。 它应该是足够灵活的,以处理未来hashlib和存储库索引器本身的哈希值,而无需进一步修改yum客户端。