LINUX
2018.10.15 / 09:40

[SOLVED] yum update fails: Error: Cannot retrieve repository metadata (repomd.xml) for repository ¡¦

Chitta
Ãßõ ¼ö 147

I'm using CentOS 6.3. When I try to update my system with yum I have this message:

yum update

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ircam.fr
 * centosplus: miroir.univ-paris13.fr
 * extras: mirrors.ircam.fr
 * update: centos.quelquesmots.fr
http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again

yum clean all

Loaded plugins: fastestmirror
Cleaning repos: CactiEZ addons base centosplus extras pgdg93 update
Cleaning up Everything
Cleaning up list of fastest mirrors

yum check

Loaded plugins: fastestmirror
check all

yum erase apf

Loaded plugins: fastestmirror
Setting up Remove Process
No Match for argument: apf
Determining fastest mirrors
 * base: centos.mirror.fr.planethoster.net
 * centosplus: centos.mirror.fr.planethoster.net
 * extras: mirrors.ircam.fr
 * update: centos.quelquesmots.fr
CactiEZ                                                | 2.9 kB     00:00
CactiEZ/primary_db                                     |  13 kB     00:00
http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again

yum upgrade

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.fr.planethoster.net
 * centosplus: centos.mirror.fr.planethoster.net
 * extras: mirrors.ircam.fr
 * update: centos.quelquesmots.fr
http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again

My yum.conf

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

@WesternGun  2018-09-03 20:59:04

In my case, which is really exceptional, the location of the XML file which contains the repo information is changed.

  • I have Internet connection (ping 8.8.8.8 works)
  • When I run yum upgrade, after a lot of 404 error, I can get the names of packages I must download, but I cannot download them.

And, when I browse into the first 404 repo URL, which is:

http://mirror.airenetworks.es/CentOS/7.4.1708/os/x86_64/repodata/repomd.xml

and I see it absent. Going to its parent folder http://mirror.airenetworks.es/CentOS/7.4.1708/readme I get this:

This directory (and version of CentOS) is deprecated. For normal users, you should use /7/ and not /7.4.1708/ in your path. Please see this FAQ concerning the CentOS release scheme:

https://wiki.centos.org/FAQ/General

If you know what you are doing, and absolutely want to remain at the 7.4.1708 level, go to http://vault.centos.org/ for packages.

Please keep in mind that 7.4.1708 no longer gets any updates, nor any security fix's.

So, I have to go back to /etc/yum.repo.d to edit the files.

I have:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

I suspect that $releasever is no more in use, so I can test by changing it to 7:(remember to escape & with \)

curl http://mirrorlist.centos.org/?release=7\&arch=x86_64\&repo=os\&infra=arch

we can get a list of files:

ftp://ftp.cesca.cat/centos/7.5.1804/os/x86_64/
http://ftp.rediris.es/mirror/CentOS/7.5.1804/os/x86_64/
http://ftp.cica.es/CentOS/7.5.1804/os/x86_64/
http://centos.mirror.minorisa.net/7.5.1804/os/x86_64/
http://repo.nixval.com/CentOS/7.5.1804/os/x86_64/
http://centos.uvigo.es/7.5.1804/os/x86_64/
http://ftp.uma.es/mirror/CentOS/7.5.1804/os/x86_64/
http://ftp.cixug.es/CentOS/7.5.1804/os/x86_64/
http://mirror.airenetworks.es/CentOS/7.5.1804/os/x86_64/
http://mirror.gadix.com/centos/7.5.1804/os/x86_64/

So, we can set the variable like this:

  1. Open the /etc/yum.repo.d/CentOS-Base.repo
  2. In the [base] section, define: releasever=7.
  3. Re-run yum upgrade or yum install xxx.

@Roy Hinkley  2016-10-03 14:58:39

All of the previous answers did not work for me, but running the following commands did:

$ sudo yum remove centos-release-SCL
$ sudo yum update # Update to CentOS 6.8
$ sudo yum install centos-release-scl
$ sudo yum update

Which I got from this blog post.


@SPRBRN  2015-05-05 15:03:02

The problem for me was that the repos use https and that doesn't work.

cd /etc/yum.repos.d/
grep -RFi "https" *

This shows in what repo files https is used. Open them in an editor and make it http. For me that fixed the problem.


@Jefferson Souza  2015-01-13 12:04:37

If you use 6.5, I don't know why, but doesn't exist the 6.5 directory at official yum repository for centOS. All packages will return a 404 status code

If you try this: http://mirror.centos.org/centos/6.5/os/x86_64/Packages/php-pear-1.9.4-4.el6.noarch.rpm you will get a 404, but if you try the 6.6 version: http://mirror.centos.org/centos/6.6/os/x86_64/Packages/php-pear-1.9.4-4.el6.noarch.rpm it works.


@Rob D  2014-11-11 17:41:23

Your ca-bundles.crt are too old. One work-around until you upgrade to a newer version of CentOS would be to change the epel.repo from using https to http

sudo sed -i 's/https/http/g' /etc/yum.repos.d/epel.repo