问题
公司一台老CentOS 7机器上要安装某个软件,yum install
后,提示安装失败,提示Exiting on user cancel
。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| File "/usr/libexec/urlgrabber-ext-down", line 75, in <module> main() File "/usr/libexec/urlgrabber-ext-down", line 61, in main fo = PyCurlFileObject(opts.url, opts.filename, opts) File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1258, in __init__ self._do_open() File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1589, in _do_open self._do_grab() File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1723, in _do_grab self._do_perform() File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1517, in _do_perform raise KeyboardInterrupt KeyboardInterrupt Exiting on user cancel
|
试了多次都是这样,一脸诧异。
查看了下CentOS版本是CentOS Linux release 7.0.1406 (Core)
, 网上搜一通,发现是CentOS 7.0.1406中yum的一个Bug。摘录解决方法如下。
解决方法
CentOS社区论坛上有相关描述,参见SSH and Yum don’t work in clean CentOS 7
后续版本中已经解决了。但在CentOS 7.0.1406
中的解决方法,需要修改/usr/lib/python2.7/site-packages/urlgrabber/grabber.py
文件的1510行。
将
1
| elif errcode in (42, 55, 56):
|
修改为
修改后再yum install
就解决了。
有趣的一点是,1510行下面的注释。从中就可以看出,即使是操作系统的基础包,很多时候也是包含了妥协的成分。
1 2 3 4 5 6 7 8
| elif errcode in (42, 55, 56): # this is probably wrong but ultimately this is what happens # we have a legit http code and a pycurl 'writer failed' code # which almost always means something aborted it from outside # since we cannot know what it is -I'm banking on it being # a ctrl-c. XXXX - if there's a way of going back two raises to # figure out what aborted the pycurl process FIXME raise KeyboardInterrupt
|