CentOS 5.7 - Cannot retrieve repository metadata

12,272

Solution 1

The "Cannot retrieve repository metadata" error looks like a red-herring. The real error seems to be this:

YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. </html>/

Are your Yum repo files corrupt?

The files at /etc/yum.conf and /etc/yum.repos.d/*.repo are provided by the yum and the centos-release packages (Test this with rpm -q --whatprovides /etc/yum.conf /etc/yum.repos.d/*).

Try verifying the files in /etc/yum.repos.d/ against the RPM files. Have there been any changes?

In the following example, the file CentOS-Base.repo has been locally modified:

% rpm --verify centos-release yum
S.5....T  c /etc/yum.repos.d/CentOS-Base.repo

If you discover that these files have indeed been changed, then you could try reinstalling the rpms, or extracting just the few files that you need and manually move them into place. Back up your old files first, for investigation later.

Solution 2

Try a yum clean all and retry your initial yum -y update

Solution 3

Seems like your server is either pulling the empty mirror list or cannot connect to the mirror list server. First check whether your server is actually pulling the mirror list using,

lynx http://mirrorlist.centos.org/?release=5&arch=i386&repo=addons
lynx http://mirrorlist.centos.org/?release=5&arch=i386&repo=os

If you are getting empty page, most likely the mirrors are down or the list is empty. You can disable mirrors and can use the direct centos mirror in the baseurl. For this, comment out mirrorlist in /etc/yum.repos.d/CentOS-Base.repo and make sure to uncomment baseurl if it is already commented.

Share:
12,272
mate64
Author by

mate64

Updated on September 18, 2022

Comments

  • mate64
    mate64 over 1 year

    I got this strange error today and I'm not able to fix it:

    root@server# yum -y update
    Loaded plugins: allowdowngrade
    YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
     Eg. </html>/
    removing mirrorlist with no valid mirrors: /var/cache/yum/addons/mirrorlist.txt
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its 
    path and try again
    root@server#
    

    with disabled repo "addons":

    root@server# yum update --disablerepo=addons
    Loaded plugins: allowdowngrade
    YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
     Eg. </html>/
    removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
    root@server#
    

    with "yum clean all":

    root@server# yum clean all
    Loaded plugins: allowdowngrade
    Cleaning up Everything
    root@server# yum -y update
    Loaded plugins: allowdowngrade
    YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
     Eg. </html>/
    removing mirrorlist with no valid mirrors: /var/cache/yum/addons/mirrorlist.txt
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again
    root@server#
    

    edit 22-09-2011: rpm --verify centos-release yum

    root@server# rpm --verify centos-release yum
    ..5....T  c /etc/issue
    ..5....T  c /etc/issue.net
    S.5....T  c /etc/yum.repos.d/CentOS-Base.repo
    missing   c /etc/yum.repos.d/CentOS-Debuginfo.repo
    S.5....T  c /etc/yum.repos.d/CentOS-Vault.repo
    package yum is not installed
    root@server#
    

    How can I fix this issue ?

    • user1233802
      user1233802 over 12 years
      Did you check what you have in those mirrorlist.txt files?
  • mate64
    mate64 over 12 years
    i've edited my post - unfortunately "yum clean all" was without success :-(
  • ewwhite
    ewwhite over 12 years
    Do you have a firewall or network access issue?
  • mate64
    mate64 over 12 years
    no, the server is online. i've disabled iptables /etc/init.d/iptables stop without success: same error
  • mate64
    mate64 over 12 years
    thank you Stefan - in fact, some files seems to be corrupt. you can find my output above. what's next? how to repair these files ?
  • Stefan Lasiewski
    Stefan Lasiewski over 12 years
    @msec: I updated my answer with some suggestions.