环境
- Red Hat Enterprise Linux 5 and later
- Red Hat Customer Portal
- Red Hat Subscription Management (RHSM)
- Red Hat Satellite
问题
yum update
fails with the error : [Errno 256] No more mirrors to tryyum update
fails with :-
Error Downloading Packages:
InstallMedia: [Errno 256] No more mirrors to try.
- yum fails with :
Error Downloading Packages:
ftp-0.17-35.el5.x86_64:failure:ftp-0.17-35.el5.x86_64.rpm from Red5repo55:[Errno 256] No more mirrors to try. [[6]]" (code -1) Packages Scheduled
- yum fails with :
Downloading Packages:
https://cdn.redhat.com/content/dist/rhel/server/6/6Server/x86_64/supplementary/os/Packages/java-1.6.0-ibm-1.6.0.15.0-1jpp.1.el6_4.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error Downloading Packages:
1:java-1.6.0-ibm-1.6.0.15.0-1jpp.1.el6_4.x86_64: failure: Packages/java-1.6.0-ibm-1.6.0.15.0-1jpp.1.el6_4.x86_64.rpm from rhel-6-server-supplementary-rpms: [Errno 256] No more mirrors to try.
决议
-
Check the network connectivity. If you are using IP addresses to configure firewall whitelist for access to the content delivery network (CDN), please ensure they're updated based on this list: Public CIDR Lists for Red Hat (IP Addresses for cdn.redhat.com)
-
Check what files are present under
/etc/yum.repos.d
directory by:-
# ll /etc/yum.repos.d
- If the system is registered to RHN Classic, only
rhel-source.repo
should be present under/etc/yum.repos.d/
.
If the system is registered with Red Hat Subscription Manager (RHSM) via subscription-manager,rhel-source.repo
and 'redhat.repo' are present.
If any local repositories, or any other media repositories are present, remove them by :-
# rm -rf /etc/yum.repos.d/<local or other repository name>
- Remove old yum cache from system by running following commands:
# rm -fr /var/cache/yum/*
# yum clean all
- Check if you can list the valid repositories by :-
# yum repolist
根源
- Possible reasons for this issue:
- Corrupted yum cache.损坏的yum缓存
- Inaccessibility of a repository URL from the system due to network related issues.由于网络相关问题,无法从系统访问存储库URL
- Presence of customized or other media repositories.自定义或其他媒体存储库的存在
- Outdated whitelist when using IP-based Firewall configuration to access Red Hat's Content Delivery Network (CDN).使用基于IP的防火墙配置访问Red Hat内容交付网络时的过期白名单
诊断步骤
- Check the accessibility of the repository URL in the system/network.
# ping URL
- Check the repositories under
/etc/yum.repos.d
ll /etc/yum.repos.d
- Collect a sosreport of the affected system.
解决方案:
1.缓存问题:
在CentOS 使用yum 安装软件的时候 出现错误no more mirrors to try,导致软件无法继续安装。
可能原因是不正当的删除造成的。
尝试
yum clean all
yum makecache
yum -y update
命令 ,然后重新安装
2.网络问题解决:
请到网络通畅的地方下载。
3.自定义或其他媒体存储库的存在(本地yum源)问题解决:
a.检查本地yum源,重新配置(建议无网络环境下,大部分公司会要求使用统一的yum本地源)
b.若有网络情况下,改回远程源(建议在网络环境下)
具体可看另一篇文章的第三部分详解(yum工具用法、源码包安装):Linux安装软件包的三种方法;rpm包介绍、rpm工具的用法;yum工具用法、源码包安装
绿色环保建议:
同时保留远程yum源和本地源,在不同环境下灵活切换即可,之后及时更新自己的本地源
4.使用基于IP的防火墙配置问题解决:
检查白名单:Red Hat内容交付网络时的白名单是否过期