centos 7 升级后yum install出现Exiting on user cancel

centos 7.x升级后用yum install进行安装时经常出现Exiting on user cancel,例如:

[root@localhost ~]# yum install logstash
Loaded plugins: axelget, fastestmirror
No metadata available for base
No metadata available for docker-main-repo
No metadata available for epel
No metadata available for extras
No metadata available for logstash-1.5
No metadata available for updates
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package logstash.noarch 1:1.5.6-1 will be installed
--> Finished Dependency Resolution Dependencies Resolved =========================================================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================================================
Installing:
logstash noarch 1:1.5.6-1 logstash-1.5 86 M Transaction Summary
=========================================================================================================================================================================================================
Install 1 Package Total download size: 86 M
Installed size: 133 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
logstash-1.5.6-1.noarch.rpm | 0 B 00:00:30 ...
logstash-1.5.6-1.noarch.rpm 2% [== ] 141 kB/s | 2.5 MB 00:10:09 ETA Exiting on user cancel

总是出现Exiting on user cancel,导致不能正常安装。

这是yum的一个bug导致的问题。修改/usr/lib/python2.7/site-packages/urlgrabber/grabber.py.

vi /usr/lib/python2.7/site-packages/urlgrabber/grabber.py

将第1510行和1517行注释掉即可

修改前:

1510             elif errcode == 42:
1511 # this is probably wrong but ultimately this is what happens
1512 # we have a legit http code and a pycurl 'writer failed' code
1513 # which almost always means something aborted it from outside
1514 # since we cannot know what it is -I'm banking on it being
1515 # a ctrl-c. XXXX - if there's a way of going back two raises to
1516 # figure out what aborted the pycurl process FIXME
1517 raise KeyboardInterrupt

修改后:

1510             #elif errcode == 42:
1511 # this is probably wrong but ultimately this is what happens
1512 # we have a legit http code and a pycurl 'writer failed' code
1513 # which almost always means something aborted it from outside
1514 # since we cannot know what it is -I'm banking on it being
1515 # a ctrl-c. XXXX - if there's a way of going back two raises to
1516 # figure out what aborted the pycurl process FIXME
1517 # raise KeyboardInterrupt

然后以root用户运行如下命令升级:

yum clean metadata
yum clean all
yum upgrade

升级完成后运行yum命令安装即可。

  • 参考文档:http://www.ostechnix.com/yum-dont-work-in-clean-centos-7-how-to-fix-it/

centos 7 升级后yum install出现Exiting on user cancel的更多相关文章

  1. CENTOS下Python 升级后YUM无法使用的解决办法

    Python有很多实用的工具,安装依赖python版本较高,升级Python后导致yum无法使用. 原因: 系统自带的yum依赖Python老版本,升级后不兼容 解决办法: 1. 列出所有版本,确定老 ...

  2. linux中python环境搭建及升级后yum不可用解决方案

    1.1 LinuxCentOS 为例.1.1.1 升级 Python(1) 下载 Python 版本$ wget https://www.python.org/ftp/python/2.7.11/Py ...

  3. 如何解决python升级后yum报错

    当我们yum命令的时候,会提示 "File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxEr ...

  4. yum install oracle-validated

    背景 当时心血来潮要在linux搞oracle,可一顿折腾,大约两个周时间,主要是各种环境的检测麻烦,在redhat上操作也不如centos有利. 命令 yum install oracle-vali ...

  5. CentOS 7升级Python到3.5后yum出错

    CentOS 7升级Python到3.5后,我跟以前CentOS 6一样,在/usr/bin/python创建了一个指向Python 3的软连接,然后将/usr/bin/yum的顶部的: !/usr/ ...

  6. CentOS 6.5升级Python后yum不可用的解决方案

    因开发需要,今天把CentOS 6.5自带的Python2.6.6升级到了Python2.7.3.按照如下步骤进行升级 1.查看当前系统python的版本 python -V 2.下载2.7.3版本的 ...

  7. vm安装centos后unknown host问题和yum install安装不成功问题

    网上差了很多说要在vi /etc/sysconfig/network新增GATEWAY=192.168.0.1 还有vi /etc/sysconfig/network-scripts/ifcfg-et ...

  8. CentOS 7升级Python到3.6.6后yum出错问题解决总结

      最近将一台测试服务器操作系统升级到了Cent0S 7.5,然后顺便也将Python从2.7.5升级到Python 3.6.6,升级完成后,发现yum安装相关包时出现异常,报"File & ...

  9. CentOS 7 yum install cobbler2.8.3

    安装前注意事项: 1.cobbler主机要为静态ip,否则和dhcpd服务冲突. 2.如果用虚拟机安装,client的内存请设置为2g以上,否则会报错. 3.kickstart文件中不要出现中文,大坑 ...

随机推荐

  1. yii2 Pjax的使用

    有两个例子:刷新时间和数据显示排序 1.刷新时间 (1)控制器中的方法:Time public function actionTime() { return $this->render('tim ...

  2. Yii2 打印sql语句和批量插入数据

    打印sql语句: $model->find()->createCommand()->getRawSql(); 批量插入 Yii::$app->db->createComm ...

  3. 浅谈T-SQL中的特殊联结

    引言 上一篇博客我们介绍了交叉联接,内联接,外联接3种基本的联接操作.这一篇文章我们介绍一些特殊的联接操作. 组合联接 组合联接就是联接条件涉及到联接两边的多个列的查询.当需要根据主键-外键关系来联接 ...

  4. SQL Server2008 with(lock)用法

    参考资料: WITH (NOLOCK) 在sqlserver 中with(nolock)详解

  5. ASP.NET 大文件下载的实现思路及代码

    文件下载是一个网站最基本的功能,ASP.NET网站的文件下载功能实现也很简单,但是如果遇到大文件的下载而不做特殊处理的话,那将会出现不可预料的后果.本文就基于ASP.NET提供大文件下载的实现思路及代 ...

  6. [百度地图] ZMap 与 MultiZMap 封装类说明;

    ZMap.js 与 MultiZMap 说明 1. ZMap 与 MultiZMap 都是封装一些地图常用的使用方法,类方法功能大多使用 prototype 原型 实现: ZMap 在一个页面只能使用 ...

  7. SQL 分组后获取其中一个字段最大值的整条记录

    --有id,name,createDate的一张表testTable--根据name分组,获取每组中createDate最大的那条记录(整条)查询出来------------------------- ...

  8. 湖南附中模拟day1 瞭望塔

    /* 这个题要用到树的性质,一般比较难的图论题会往这方面靠拢,这样用很容易出错,应该先写暴力,然后再去一点点想正解 */ //暴力70分 #include<iostream> #inclu ...

  9. HDOJ 4734 F(x)

    数位DP.... F(x) Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  10. ThinkPHP报错处理

    1,当运行结果提示:找不到该页面(控制器),怎么办? 建造一个空页面:EmptyController <?php namespace Home\Controller; use Think\Con ...