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. android自定义控件(6)-详解在onMeasure()方法中如何测量一个控件尺寸

    今天的任务就是详细研究一下protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)方法.如果只是说要重写什么方法有什么 ...

  2. logrotate关于日志轮询和分割

    如果你的是源码包安装的服务,那么对于Linux服务器上的一些服务在运行当中产生的日志很重要,可以判断你的服务是否有异常等,但源码包安装的日志是没有日志的轮询或者说是切割能力的, 所以你就需要用到bas ...

  3. CF451A Game With Sticks 水题

    Codeforces Round #258 (Div. 2) Game With Sticks A. Game With Sticks time limit per test 1 second mem ...

  4. iOS9 Universal Link实现

    先来贴几个比较全面的帖子,看完就差不多了. 1   iOS 9 通用链接(Universal Links) 帖子注意项非常重要,仔细阅读. 自己补充几点: 1 服务器上配置的json文件apple-a ...

  5. js做灯泡明灭特效

    W3school中的js专讲这一块 http://www.w3school.com.cn/tiy/t.asp?f=js_lightbulb

  6. padding/margin/border 理解

  7. Linux/CentOS配置:使用yum update更新时不升级内核的方法

    RedHat/CentOS/Fedora使用 yum update 更新时,默认会升级内核.但有些服务器硬件(特别是组装的机器)在升级内核后,新的内核可能会认不出某些硬件,要重新安装驱动,很麻烦.所以 ...

  8. C\C++ sizeof 陷阱&&总结

    今天使用动态数组,本来想通过sizeof 获取动态数据,结果出现了错误. 先对自己做个测试,能做出下面这个题目,并做出合理解释,可以不用往下看了. ][]; cout<< cout< ...

  9. ProgressDialog的使用

    ProgressDialog 继承自AlertDialog,AlertDialog继承自Dialog,实现DialogInterface接口. ProgressDialog的创建方式有两种,一种是ne ...

  10. 标签语义化之常用HTML标签

    一.布局的理解误区 网络上流行管新型的布局方式叫“DIV+CSS”,其实是一个错误的理解,导致了很多人过度依赖与滥用DIV标签, HTML提供了我们一共七八十个标签,其中常用的有三十个左右,DIV不过 ...