Yum Not Working: Error: Cannot retrieve repository metadata (repomd.xml)

General support questions
YBellefeuille
Posts: 319
Joined: 2012/03/06 22:30:17
Location: Ottawa

Re: Yum Not Working: Error: Cannot retrieve repository metadata (repomd.xml)

Post by YBellefeuille » 2012/09/11 00:45:59

One problem is that you've apparently edited the [b]CentOS-Base.repo[/b] file and changed it. For example, your file says this:

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

But it should say this:

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

[b]TrevorH[/b] has already advised you to uncomment the mirrorlist line and comment the baseurl line, but that's not the only change you've made. Your mirrorlist line says [b]?release=6&arch=x86_64&repo=os[/b], but it should say [b]?release=$releasever&arch=$basearch&repo=os[/b]

So, please replace the first two sections of [b]/etc/yum.repos.d/CentOS-Base.repo[/b] with the default:

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

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

Perhaps this will solve your problem, and perhaps not. If not, see if the file [b]/etc/sysconfig/network[/b] has this line:

[code]
NETWORKING_IPV6=yes
[/code]

If so, try using [b]TrevorH[/b]'s very big hammer by removing the line, and then:

[code]
service network restart
service NetworkManager restart
[/code]

If [b]yum[/b] now works, let's reinstall the original *.repo files to undo your ill-advised changes:

[code]
yum reinstall centos-release
[/code]

helmikuu
Posts: 9
Joined: 2012/09/07 20:32:21

Re: Yum Not Working: Error: Cannot retrieve repository metadata (repomd.xml)

Post by helmikuu » 2012/09/11 13:51:53

Thanks for the reply. I have done all your suggestions but I am still getting this error.

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
Error: Cannot find a valid baseurl for repo: base

YBellefeuille
Posts: 319
Joined: 2012/03/06 22:30:17
Location: Ottawa

Re: Yum Not Working: Error: Cannot retrieve repository metadata (repomd.xml)

Post by YBellefeuille » 2012/09/12 02:31:05

I suggest you ask in the Networking Support forum. You can refer to this thread for background.

helmikuu
Posts: 9
Joined: 2012/09/07 20:32:21

Re: Yum Not Working: Error: Cannot retrieve repository metadata (repomd.xml)

Post by helmikuu » 2012/09/12 13:51:50

Just an update. Problem solved by disabling the iptables. Thanks for all the help.

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Yum Not Working: Error: Cannot retrieve repository metadata

Post by AlanBartlett » 2012/12/21 03:33:52

[b]Johnson02[/b] -- Please do not hijack an existing thread with a totally unconnected problem.

Please take a look at the recommended reading for new members, especially the [url=https://www.centos.org/modules/newbb/viewforum.php?forum=54]FAQ & Readme First[/url]. Once you have read that information, then open your own thread in the appropriate forum for your current issue.

This thread is now locked.

esmid2
Posts: 1
Joined: 2013/11/10 14:57:55

Re: Yum Not Working: Error: Cannot retrieve repository metad

Post by esmid2 » 2013/11/10 15:01:56

you shold add a valid ip as any ns in /etc/resolve.conf


ex:
nameserver 8.8.8.8

andymichael
Posts: 1
Joined: 2014/07/11 05:47:21

Re: Yum Not Working: Error: Cannot retrieve repository metad

Post by andymichael » 2014/07/11 05:56:31

it seams that if iptables is blocking outgoing http Connection over ipv4, ipv6 is tried. i ran into the same Problem. stopped the Firewall and yum returned to normal behavior. so allow outgoing http over ipv4.

Locane
Posts: 25
Joined: 2014/09/05 00:40:12

Re: Yum Not Working: Error: Cannot retrieve repository metad

Post by Locane » 2015/01/06 05:15:47

For what it's worth, I had the "Cannot retrieve repository metadata (repomd.xml)" because CentOS deprecated the path of the URL I had in my kickstart file. It was originally:

repo --name=base --baseurl=http://mirror.centos.org/centos/6.5/os/$basearch

and had to be changed to:

repo --name=base --baseurl=http://mirror.centos.org/centos/6/os/$basearch

The "6.5" sub directory was removed and rolled in to "6", and I did not know this was a normal thing.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Yum Not Working: Error: Cannot retrieve repository metad

Post by aks » 2015/01/06 21:05:11

Okay this is a little more difficult.

I'm not a fan of disabling IPv6 - y0ou're just delaying the inventiable.

Please backup /etc/sysconfig/ip6tables (to something like ip6tables.orig).

Then create a new ip6tables file with the following:
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type echo-reply -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type destination-unreachable -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type echo-request -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type no-route -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type redirect -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type router-advertisement -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type router-solicitation -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type time-exceeded -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type parameter-problem -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type communication-prohibited -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type address-unreachable -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type port-unreachable -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type packet-too-big -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type router-solicitation -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type router-advertisement -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type neighbour-solicitation -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type neighbour-advertisement -j ACCEPT
-A INPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type parameter-problem -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW,ESTABLISHED,RELATED -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW,ESTABLISHED,RELATED -m tcp -p tcp --dport 80 -j REJECT --reject-with icmp6-adm-prohibited
-A INPUT -j REJECT --reject-with icmp6-adm-prohibited
-A FORWARD -j REJECT --reject-with icmp6-adm-prohibited
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type echo-reply -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type destination-unreachable -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type echo-request -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type no-route -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type redirect -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type router-advertisement -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type router-solicitation -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type time-exceeded -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type parameter-problem -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type communication-prohibited -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type address-unreachable -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type port-unreachable -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type packet-too-big -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type router-solicitation -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type router-advertisement -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type neighbour-solicitation -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type neighbour-advertisement -j ACCEPT
-A OUTPUT -p ipv6-icmp -m ipv6-icmp --icmpv6-type parameter-problem -j ACCEPT
-A OUTPUT -j REJECT --reject-with icmp6-adm-prohibited
COMMIT

Then restart ip6tables with /etc/init.d/ip6tables restart

If that works, please post back so we can tackle the root cause of the problem.

If it doesn't work please post back with the output of:

cat /etc/resolv.conf
hostname -fqdn
dnsdomainname
host mirror.centos.org

NOTE: This is (nearly) 100% not supported and a (nearly) 100% bad practise, but we're troubleshooting here, we'll clean up later.

Cheers

rickyboy.1234
Posts: 1
Joined: 2015/04/17 10:25:30

Re: Yum Not Working: Error: Cannot retrieve repository metad

Post by rickyboy.1234 » 2015/04/17 10:31:27

try to reboot your computer then yum update.



This works for me.

This issue somehow occurred when you stop yum install.


Hope this woks.

Locked