Not able to download packages with yum due to the error ‘[Errno 256] No more mirrors to try’? We can help you with it.
Usually, corrupted yum cache or repo directory ends up in this error. A few file cleanups can easily fix this.
This can also occur due to an outdated whitelist of the Public CIDR list.
At Bobcares, we often fix yum errors, as a part of our Server Management Services.
Today, let’s have a look into this yum error. And see how our Support Engineers fix this.
Why does yum downloading packages end up in error?
We often use yum to install packages and dependencies in a single command. However, sometimes we have seen this yum updates ending up with an error.
Mostly, this happens due to errors with yum cache, local files in the repository folder, outdated firewall rules, etc.
Let’s check out how our Support Engineers fix this error in each case.
How we fix the yum error in downloading packages?
The error message while installing the FTP package appears as,
Now let’s have a look at each reason and its fix.
1. Clear yum cache to download packages
Old cache in the system can cause errors while downloading packages. Hence our Support Engineers delete the cache using the command,
rm -rf /var/cache/yum/*
In addition, we also delete the metadata for the enables repositories. For this, we use the command,
yum clean metadata
Later, we clean up the yum folder using the command,
yum clean all
Finally, we check the yum update again. Thereby, we ensure to fix the error.
2. Check repository to fix yum error
In some servers, the yum repository contains corrupted files. And accessing these repositories while updating can cause errors. So our Support Engineers check the folder yum.repos.d
Initially, we list the files using the command,
ll /etc/yum.repos.d
Later we check the system registry. Our Experts check the files under both RHN classic and RHSM. And removes the error causing local repositories. Later, we check if the update is running successfully.
3. Network access to download packages
Similarly, network access is important for yum updates. So, we check the access to the repository URL by ping.
In addition, we also ensure to whitelist the Public CIDR list for Red Hat. Because outdated whitelist restricts access to the CDN can result in errors.
Usually, yum download the packages using the base URL in the config file. This URL is cdn.redhat.com. Basically, there are multiple servers resolving to this address.
So we whitelist these IPs listed in the Public CIDR list.
[Need assistance in fixing yum errors? – We are available 24/7]
Conclusion
In short, yum error downloading packages occur due to corrupted cache or repository. Another possible reason is network access denial due to the firewall in the system. Today, we saw how our Support Engineers fix this error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
I was trying to update my packages i fired command yum update as root user but i then encountered error downloading packages and error number is **[Error 5] [Error 13] ** i don’t know but its showing permission denied , something like error downloading packages beacuse i don’t have the permission to do so. help please , i am not able to install any software on my centos too.
$ yum update
Loaded plugins: fastestmirror, langpacks
You need to be root to perform this command.
(base) [ales@k8s-master ~]$ sudo yum update
[sudo] password for ales:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 7.1 kB 00:00:00
* base: mirrors.praction.in
* epel: sg.fedora.ipserverone.com
* extras: mirrors.praction.in
* rpmfusion-free-updates: mirror.vutbr.cz
* updates: mirrors.praction.in
azure-cli | 2.9 kB 00:00:00
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
epel | 5.3 kB 00:00:00
extras | 2.9 kB 00:00:00
google-chrome | 1.3 kB 00:00:00
http://pkg.jenkins.io/redhat-stable/repodata/repomd.xml: [Errno 12] Timeout on http://pkg.jenkins.io/redhat-stable/repodata/repomd.xml: (28, ‘Connection timed out after 30000 milliseconds’)
Trying other mirror.
jenkins | 2.9 kB 00:00:00
kubernetes/signature | 454 B 00:00:00
kubernetes/signature | 1.4 kB 00:00:00 !!!
https://miktex.org/download/fedora/30/r … repomd.xml: [Errno 12] Timeout on https://miktex.org/download/fedora/30/r … repomd.xml: (28, ‘Connection timed out after 30000 milliseconds’)
Trying other mirror.
https://miktex.org/download/fedora/30/r … repomd.xml: [Errno 12] Timeout on https://miktex.org/download/fedora/30/r … repomd.xml: (28, ‘Connection timed out after 30001 milliseconds’)
Trying other mirror.
miktex-fedora-28 | 2.9 kB 00:00:00
rpmfusion-free-updates | 3.7 kB 00:00:00
teamviewer | 2.5 kB 00:00:00
updates | 2.9 kB 00:00:00
virtualbox/7/x86_64/signature | 181 B 00:00:00
virtualbox/7/x86_64/signature | 2.9 kB 00:00:00 !!!
Resolving Dependencies
—> Running transaction check
—> Package containerd.io.x86_64 0:1.2.6-3.3.el7 will be updated
—> Package containerd.io.x86_64 0:1.2.10-3.2.el7 will be an update
—> Package docker-ce.x86_64 3:19.03.2-3.el7 will be updated
—> Package docker-ce.x86_64 3:19.03.3-3.el7 will be an update
—> Package docker-ce-cli.x86_64 1:19.03.2-3.el7 will be updated
—> Package docker-ce-cli.x86_64 1:19.03.3-3.el7 will be an update
—> Package epel-release.noarch 0:7-11 will be updated
—> Package epel-release.noarch 0:7-12 will be an update
—> Package google-chrome-stable.x86_64 0:77.0.3865.90-1 will be updated
—> Package google-chrome-stable.x86_64 0:77.0.3865.120-1 will be an update
—> Package x264-libs.x86_64 0:0.148-23.20170521gitaaa9aa8.el7 will be updated
—> Package x264-libs.x86_64 0:0.148-24.20170521gitaaa9aa8.el7 will be an update
—> Finished Dependency Resolution
Dependencies Resolved
==================================================================================
Package Arch Version Repository Size
==================================================================================
Updating:
containerd.io x86_64 1.2.10-3.2.el7 docker-ce-stable 23 M
docker-ce x86_64 3:19.03.3-3.el7 docker-ce-stable 24 M
docker-ce-cli x86_64 1:19.03.3-3.el7 docker-ce-stable 39 M
epel-release noarch 7-12 epel 15 k
google-chrome-stable x86_64 77.0.3865.120-1 google-chrome 59 M
x264-libs x86_64 0.148-24.20170521gitaaa9aa8.el7
rpmfusion-free-updates 556 k
Transaction Summary
==================================================================================
Upgrade 6 Packages
Total download size: 147 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for google-chrome
No Presto metadata available for docker-ce-stable
No Presto metadata available for rpmfusion-free-updates
Failed to download prestodelta for repository epel: [Errno 5] [Errno 13] Permission denied
Error downloading packages:
3:docker-ce-19.03.3-3.el7.x86_64: [Errno 5] [Errno 13] Permission denied
containerd.io-1.2.10-3.2.el7.x86_64: [Errno 5] [Errno 13] Permission denied
epel-release-7-12.noarch: [Errno 5] [Errno 13] Permission denied
1:docker-ce-cli-19.03.3-3.el7.x86_64: [Errno 5] [Errno 13] Permission denied
google-chrome-stable-77.0.3865.120-1.x86_64: [Errno 5] [Errno 13] Permission denied
x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64: [Errno 5] [Errno 13] Permission denied
yum has been using it well. Today, installing NTP suddenly reported a mistake.
Error downloading packages: autogen-libopts-5.18-5.el7.x86_64: [Errno 256] No more mirrors to try. ntp-4.2.6p5-28.el7.centos.x86_64: [Errno 256] No more mirrors to try. ntpdate-4.2.6p5-28.el7.centos.x86_64: [Errno 256] No more mirrors to try.
Check online, need to clear the cache:
yum clean cache
yum makecache
As a result, another mistake was made:
Loaded plug-ins: fastestmirror Determining fastest mirrors Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Can not resolve host: mirrorlist. centos. org; unknown error" One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=<repoid> ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable <repoid> or subscription-manager repos --disable=<repoid> 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true Cannot find a valid baseurl for repo: base/7/x86_64
Encounter this mistake…
Change the source of yum, change the dns, and basically try all the methods on the internet, but they are useless.
State of mind burst
Then I changed my mind and prepared to fix the network problem. As a result, GW had a problem.
CentoOS 7 minimal appears ping: unknown host www.baidu.com solution:
-
Modification (vi/etc/sysconfig/network-scripts/ifcfg-eth0)
-
System CTL restart network. service (or service network restart)
-
View (cat/etc/resolv.conf)
Note: Do not add the content of the picture directly in / etc/resolv.conf. Restarting the network in CentOS7 will redistribute the DNS content of / etc/sysconfig/network-scripts/ifcfg-eth0 to / etc/resolv.conf.
At this point, you can try ping www.baidu.com (continue execution if still ping is not working)
-
Netstat-rn
-
Add gateway (route add default gw 192.168.175.1)
The GW problem solution is transferred from — zz657114506
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
-
Check the network connectivity. If IP based Firewall is being used then whitelist the IPs that are mentioned in Public CIDR Lists for Red Hat (IP Addresses for cdn.redhat.com) for access to the content delivery network (CDN).
-
Check what files are present under
/etc/yum.repos.d
directory by:-# ll /etc/yum.repos.d
-
If the system is registered with Red Hat Subscription Manager (RHSM) via subscription-manager,
rhel-source.repo
andredhat.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/messagesJul 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
-
Product(s)
- Red Hat Subscription Management
- Red Hat Satellite
- Red Hat Enterprise Linux
- Red Hat Customer Portal
-
Component
- yum
-
Category
- Troubleshoot
-
Tags
- customer_portal
- rhel
- rhn
- rhn_classic
- rhsm
- satellite
- subscription_management
- yum
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.