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

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

原文地址:https://www.cnblogs.com/feilstar/p/10284890.html

时间: 2024-10-07 10:30:11

Linux下使用yum install时出现Exiting on user cancel的相关文章

Linux Study之--yum install错误

Linux Study之--yum install错误 系统环境:Oracle Linux5.4    在通过yum安装软件时出现以下错误: 1.yum配置文件 [[email protected] yum.repos.d]# cat yum.repo  [base] name=Oracle linux  baseurl=file:///media/Server enable=1 gpcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedor

在Linux下用yum安装所需的指令

在昨天用finger及tree指令时发现Linux默认情况下未安装这两个指令.于是就自己尝试了下安装这两个指令. 在进行操作前我们要有一个明确的思路,这样我们实际进行时可以事半功倍. 这两个文件安装有两种途径:1,上网下载安装:2,通过Linux的安装ISO文件进行安装. 我用的是第二种方法 基本流程 1,你需要先建立一个挂载时用到的文件夹不建随便找一个文件夹也可以.用mkdir指令 2,将ISO文件挂载到指定的文件夹内.用mount指令 3,通过vim对yum的文件进行修改指令为vim /et

linux下使用yum安装mysql以及启动、登录和远程访问

linux下使用yum安装mysql,以及启动.登录和远程访问. 1.安装 查看有没有安装过: yum list installed mysql* rpm -qa | grep mysql* 查看有没有安装包: yum list mysql* 安装mysql客户端: yum install mysql 安装mysql 服务器端: yum install mysql-server yum install mysql-devel 2.启动&&停止 数据库字符集设置 mysql配置文件/etc/

linux下使用yum安装mysql、tomcat、httpd

一.linux下使用yum安装mysql 1.安装 查看有没有安装过: yum list installed mysql* rpm -qa | grep mysql* 查看有没有安装包: yum list mysql* 安装mysql客户端: yum install mysql 安装mysql 服务器端: yum install mysql-server yum install mysql-devel www.2cto.com 2.启动&&停止 数据库字符集设置 mysql配置文件/etc

Linux 下使用yum 命令安装MySQL

Linux下使用yum安装MySQL,以及启动.登录和远程访问MySQL数据库. 1.yum安装mysql 1. 查看有没有安装包:   yum list mysql*    #移除已经安装的mysql    yum remove mysql mysql-server mysql-libs compat-mysql51    rm -rf /var/lib/mysql    rm /etc/my.cnf2. 查看是否还有mysql软件:    rpm -qa|grep mysql    #如果有

linux 下使用yum命令出错解决办法

linux系统使用yum命令时,遇到出现以下错误: Loaded plugins: fastestmirror Existing lock /var/run/yum.pid: another copy is running as pid 3404. Another app is currently holding the yum lock; waiting for it to exit... The other application is: yum Memory : 41 M RSS (253

转载:Linux下执行SVN命令时提示错误:Valid UTF-8 data

在Linux下执行svn add *时出现如下错误: svn:  Valid UTF-8  data(hex: 4b)followed by invalid UTF-8 sequence(hex:  fc 63 68  65) 出现这个错误是因为svn库里有文件的名字不是utf-8编码的,这种情况对于中文来说很常见.比如在自己的windows上建了一个中文名字的文件,就会使这种情况. 几经周折,才找到解决办法: 首先,执行命令: ls * | file -/dev/stdin:  ISO-885

yum install 时遇到 HTTP 404 page not found错误

前天在编译软件时,需要 libtool 包,运行 sudo yum install libtool 总是提示HTTP 404 page not found,开始以为是网络出问题了,因为最近几个月网络抽风似乎是正常现象 . 后来查了一下资料,才知道是本地缓存出了问题,解决方法如下: 1.sudo yum clean all 2.rpm rebuilddb yum install 时遇到 HTTP 404 page not found错误

[linux]centos7下解决yum install mysql-server没有可用包

1.下载mysql的repo源 [[email protected] ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2.安装mysql-community-release-el7-5.noarch.rpm包 [[email protected] ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm 3.查看安装的MySQ源 [[email pro