Yum 在我的一些 amazon 实例上失败了,我尝试跟进 amazon 人员,但尚未修复。以下是错误、python 和 yum 版本信息:
[root@myhost_test.cache]# yum list
Loaded plugins: priorities, s3iam, update-motd, upgrade-helper
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 355, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 174, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 572, in doCommands
return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
File "/usr/share/yum-cli/yumcommands.py", line 638, in doCommand
repoid=repoid)
File "/usr/share/yum-cli/cli.py", line 1382, in returnPkgLists
ignore_case=True, repoid=repoid)
File "/usr/lib/python2.7/dist-packages/yum/__init__.py", line 2886, in doPackageLists
avail = self.pkgSack.returnNewestByNameArch(patterns=patterns,
File "/usr/lib/python2.7/dist-packages/yum/__init__.py", line 1069, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.7/dist-packages/yum/__init__.py", line 774, in _getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.7/dist-packages/yum/repos.py", line 383, in populateSack
sack.populate(repo, mdtype, callback, cacheonly)
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 250, in populate
if self._check_db_version(repo, mydbtype):
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 342, in _check_db_version
return repo._check_db_version(mdtype)
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 1520, in _check_db_version
repoXML = self.repoXML
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 1706, in <lambda>
repoXML = property(fget=lambda self: self._getRepoXML(),
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 1702, in _getRepoXML
self._loadRepoXML(text=self.ui_id)
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 1693, in _loadRepoXML
return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 1667, in _groupLoadRepoXML
if self._commonLoadRepoXML(text):
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 1492, in _commonLoadRepoXML
result = self._getFileRepoXML(local, text)
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 1270, in _getFileRepoXML
size=102400) # setting max size as 100K
File "/usr/lib/python2.7/dist-packages/yum/yumRepo.py", line 1058, in _getFile
**kwargs
File "/usr/lib/yum-plugins/s3iam.py", line 195, in urlgrab
response = urllib2.urlopen(request)
File "/usr/local/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/local/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/local/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/local/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/local/lib/python2.7/urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/local/lib/python2.7/urllib2.py", line 1181, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/local/lib/python2.7/httplib.py", line 973, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python2.7/httplib.py", line 1007, in _send_request
self.endheaders(body)
File "/usr/local/lib/python2.7/httplib.py", line 969, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python2.7/httplib.py", line 829, in _send_output
self.send(msg)
File "/usr/local/lib/python2.7/httplib.py", line 791, in send
self.connect()
File "/usr/local/lib/python2.7/httplib.py", line 1176, in connect
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
File "/usr/local/lib/python2.7/ssl.py", line 387, in wrap_socket
ciphers=ciphers)
File "/usr/local/lib/python2.7/ssl.py", line 138, in __init__
self._sslobj = _ssl.sslwrap(self._sock, server_side,
AttributeError: 'module' object has no attribute 'sslwrap'
[root@ip-10-30-213-135-datascience cache]# python -V
Python 2.7.6
[root@ip-10-30-213-135-datascience cache]# yum --version
3.4.3
Installed: rpm-4.11.2-2.63.amzn1.x86_64 at 2015-03-25 11:50
Built : Amazon.com, Inc. <http://aws.amazon.com> at 2015-03-17 21:56
Committed: Ben Cressey <[email protected]> at 2015-03-17
Installed: yum-3.4.3-137.54.amzn1.noarch at 2015-03-25 11:50
Built : Amazon.com, Inc. <http://aws.amazon.com> at 2015-03-04 01:16
Committed: Rodrigo Novo <[email protected]> at 2015-03-04
答案1
问题在于 SSLwrap 在 python 2.7 及更高版本中被删除。要纠正此问题,一个简单的解决方案是让 yum 使用 python2.6
vim /usr/bin/yum
将其中的 shebang 更改为 python2.6
答案2
该文件好像有问题/usr/local/lib/python2.7/ssl.py
。
您能否从故障机器和正常运行的机器发布此文件的 md5sum?您还可以检查 python 版本是否相同吗?