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

简介: centos 7 升级后yum install出现Exiting on user cancelcentos 7.x升级后用yum install进行安装时经常出现Exiting on user cancel,例如:[root@localhost ~]# yum install logstash...

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/
相关文章
|
4月前
|
Linux Perl
Linux centos7升级内核(两种方法:内核编译和yum更新)
Linux centos7升级内核(两种方法:内核编译和yum更新)
354 0
Linux centos7升级内核(两种方法:内核编译和yum更新)
|
7月前
|
Linux 数据安全/隐私保护
百度搜索:蓝易云【Centos7系统中找不到yum及安装方法。】
综上所述,如果你在CentOS 7系统中找不到 `yum`命令,可以通过重新安装 `yum`来解决问题。
338 0
|
2月前
|
Linux 应用服务中间件 网络安全
CentOS7搭建本地离线局域网yum源(Httpd/Nginx+yum)
CentOS7搭建本地离线局域网yum源(Httpd/Nginx+yum)
291 0
|
2月前
|
缓存 Linux
Centos7中搭建本地yum源
Centos7中搭建本地yum源
133 0
|
6月前
|
Web App开发 Linux 开发工具
Centos7 yum 安装chrome
Centos7 yum 安装chrome配置yum源vim /etc/yum.repos.d/google-chrome.repo写入以下内容[google-chrome]name=google-chromebaseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearchenabled=1gpgcheck=1gpgkey=http...
165 0
|
5月前
|
Linux 应用服务中间件 nginx
CentOS7搭建yum源仓库(阿里源)
CentOS7搭建yum源仓库(阿里源)
970 0
|
5月前
|
缓存 Linux
CentOS7配置阿里yum源 超详细!!!
CentOS7配置阿里yum源 超详细!!!
6220 0
|
9天前
|
缓存 Linux
linux centos7 挂载本地iso yum源
linux centos7 挂载本地iso yum源
50 0
|
9天前
|
关系型数据库 MySQL Linux
CentOS 7 下使用yum安装MySQL5.7.20 最简单 图文详解
CentOS 7 下使用yum安装MySQL5.7.20 最简单 图文详解
46 0
|
3月前
|
缓存 Linux Perl
CentOS7换yum源
CentOS是Linux系统里最常用的一种,CentOS7的yum源默认是国外的源,相较于国内源,网络连接不够稳定,下载速度较慢,因此我们常常把下载好的CentOS7换源为国内的yum源,本篇文章将介绍如何更换CentOS7的yum源为国内yum源,以阿里云的源为例。
503 0