Linux下使用yum install时出现Exiting on user cancel

Posted feilstar

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux下使用yum install时出现Exiting on user cancel相关的知识,希望对你有一定的参考价值。

有时使用yum install时会出现如下错误,导致软件无法安装。

Loaded plugins: fastestmirror
Cleaning repos: base epel extras mysql-connectors-community mysql-tools-community
: mysql56-community updates
14 metadata files removed
0 sqlite files removed
0 metadata files removed
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
mysql-connectors-community | 2.5 kB 00:00:00
mysql-tools-community | 2.5 kB 00:00:00
mysql56-community | 2.5 kB 00:00:00
updates | 3.4 kB 00:00:00
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax


Exiting on user cancel

这个yum的一个bug,解决的办法是修改/usr/lib/python2.7/site-packages/urlgrabber/grabber.py文件。

elif errcode == 42:
  # 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

修改后:

#elif errcode == 42:
  # 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

然后切换到root用户,执行以下命令:

yum clean metadata

yum clean all

yum upgrade

执行完后,重新执行安装命令,大多数人应该都解决了,但是博主运气较差,并没有解决。

后来各种鼓捣,又修改了/usr/bin/yum文件,将第一行修改为如下内容:

#!/usr/bin/python2

但是新问题又来了:

[[email protected] conf]# yum -y install php
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
                                            ^
SyntaxError: invalid syntax

解决方法就是,修改/usr/libexec/urlgrabber-ext-down文件,将第一行修改为如下内容:

#! /usr/bin/python2

至此,终于可以愉快的安装软件了。





















































以上是关于Linux下使用yum install时出现Exiting on user cancel的主要内容,如果未能解决你的问题,请参考以下文章

linux下yum安装时出现Loaded plugins: fastestmirror解决办法

linux 使用yum命令安装软件时出现HTTP Error 404 NOT FOUND错误的解决办法

yum安装vim时出现以下错误提示 求解决方法 通过yum install vim* 进行vim的安装

【linux】yum不能用了。我执行 rpm -e libcurl --nodeps 后 ,使用yum时出现:(见问题补充)

RHEL关于本地yum仓库的问题

php编译时出现错误解决方法