Why does yum return error: [Errno 256] No more mirrors to try ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux
  • Red Hat Customer Portal
  • Red Hat Subscription Management (RHSM)
  • Red Hat Satellite

Issue

  • yum update fails with the error : [Errno 256] No more mirrors to try

Resolution

# ll /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 the old yum cache from the system by running the following commands:
# rm -fr /var/cache/yum/*
# yum clean all
  • Check if the valid repositories are getting listed by:-
# yum repolist
  • If the previous solutions does not work, try reenabling each repository one by one with the following:-
# REPOLIST=`subscription-manager repos --list-enabled | grep "Repo ID" | awk '{print $3}'`
# subscription-manager repos --disable="*"
# rm -fr /var/cache/yum/*
# yum clean all
# for i in ${REPOLIST}; do subscription-manager repos --enable=$i ; yum repolist; done

Root Cause

  • Possible reasons for this issue:
    • Corrupted yum cache.
    • Inaccessibility of a repository URL from the system due to network-related issues.
    • Presence of customized or other media repositories.
    • Outdated whitelist when using IP-based Firewall configuration to access Red Hat's Content Delivery Network (CDN).

Diagnostic Steps

  • yum update fails with any of the below errors:-
Error Downloading Packages:
InstallMedia: [Errno 256] No more mirrors to try.
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
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 an error: 404 Not Found"
Trying other mirrors.
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.
  • On Satellite Server it fails with this error as per /var/log/messages
Jul 24 12:12:53 sat.example.com pulp: requests.packages.urllib3.connectionpool:INFO: Starting new HTTPS connection (1): cdn.redhat.com Jul 24 12:12:53 sat.example.com pulp: nectar.downloaders.threaded:INFO: Download failed:
  • 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

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

8 Comments

Hi Team,
Please note we have local repository configured.

[root@mpe3100 yum.repos.d]# cat /etc/yum.repos.d/hp.repo
[hp]
name=hp
baseurl=file:///arjun/rhel6
enabled=1
gpgcheck=0
[root@mpe3100 yum.repos.d]#

The cache has been cleared

root@mpe3100 yum.repos.d]# rm -fr /var/cache/yum/*
[root@mpe3100 yum.repos.d]#

Still we get the below error when we run yum install gcc

Total download size: 75 M
Installed size: 221 M
Is this ok [y/N]: y
Downloading Packages:

Error Downloading Packages:
ppl-0.10.2-11.el6.x86_64: failure: Packages/ppl-0.10.2-11.el6.x86_64.rpm from hp: [Errno 256] No more mirrors to try.
sinjdoc-0.5-9.1.el6.x86_64: failure: Packages/sinjdoc-0.5-9.1.el6.x86_64.rpm from hp: [Errno 256] No more mirrors to try.
mpfr-2.4.1-6.el6.x86_64: failure: Packages/mpfr-2.4.1-6.el6.x86_64.rpm from hp: [Errno 256] No more mirrors to try.
zlib-devel-1.2.3-29.el6.x86_64: failure: Packages/zlib-devel-1.2.3-29.el6.x86_64.rpm from hp: [Errno 256] No more mirrors to try.

Please confirm if we need to download and install the last four packages listed in error

check dns resolver /etc/resolv.conf

solved the issue, was clear and to the point.

If you are using satelitte6 and have Content Views with custom channel names or different from the one used of the container base image (by default 7Server) remember to add the --releasever=xyz modifier to all your yum commands

RUN yum clean all && yum --releasever=7.3 update && \ yum repolist --disablerepo=* && \ yum-config-manager --disable * > /dev/null && \ yum-config-manager --releasever=7.3 --enable rhel-7-server-rpms && \ yum install --releasever=7.3 -y bzip2 fontconfig

Consider also this solution to the problem I had below... (to [Errno 14] but also encountered [Errno 256] with HTTPS Error 404 - Not Found. The Errno 14 is perhaps most likely due to URL and "releasever" setting while Errno 256 related to GPG.

https://access.redhat.com/solutions/2850911 - As GPG armor is not enabled on server side, so ensure repo_gpgcheck is set to 0 in yum.conf file for RHEL clients.

Fresh install of RHEL 7.4 on VirtualBox 5.2 and have the same issue, though this did not resolve it. Followed these instructions up to "Install the latest updates" https://developers.redhat.com/products/rhel/hello-world/#fndtn-virtualbox_get-ready-for-software-development

Following issue on "yum update" or "yum repolist" as root (though system already registered and attached to RedHat Subscription Manager)

[root@localhost ~]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/repodata/repomd.xml.asc: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

rhel-7-server-rpms                                                                                               | 3.5 kB  00:00:00     
https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/repodata/repomd.xml.asc: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
rhel-7-server-rpms/7Server/x86_64                                                                                | 3.5 kB  00:00:00     
https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/rt/os/repodata/repomd.xml.asc: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
rhel-7-server-rt-rpms/7Server/x86_64                                                                             | 4.0 kB  00:00:00     
repo id                                             repo name                                                                     status
rhel-7-server-rpms/7Server/x86_64                   Red Hat Enterprise Linux 7 Server (RPMs)                                      0
rhel-7-server-rt-rpms/7Server/x86_64                Red Hat Enterprise Linux for Real Time (RHEL 7 Server) (RPMs)                 0
repolist: 0

I am getting error in RHEL 7 GUI installation [Errno 256] No more mirrors to try Please explain how to remove this error and proceed with the installation

Check your dns settings. Check /etc/hosts/resolv.conf.

rm -fr /var/cache/yum/* yum clean all

This resolved the issue for me