6

I'm trying to do yum update. This is the error I'm getting.

sudo yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
12: Timeout on http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os: (28,'connect() timed out!')
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

I did wget http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os. It never goes through. So I know I've to change this somehow. Can anyone tell suggest me how to fix this. I found many posts related to this problem over here; but couldn't find a proper solution for this.

My /etc/resolve.conf is:

nameserver 130.102.115.238
nameserver 130.102.128.53
nameserver 130.102.2.53

I tried adding nameserver 8.8.8.8. It didn't work.

My /etc/yum.repos.d/Centos-Base.repo is:

[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

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

I tried commenting the mirrorlists and uncommenting the baseurls. Didn't work. I really need some help with this. Stuck on this for sometime now.

PS I am trying to set a Hadoop node using Cloudera. That's when I encountered this problem. So I tried doing a yum update individually to figure out what's wrong.

5

It looks like you don't have the proxy information configured in your repo file. According to http://www.centos.org/docs/5/html/yum/sn-yum-proxy-server.html, you have to specify your proxy, proxy_username, and proxy_password in yum.conf. This doc is for CentOS 5, but it should hold for CentOS 6 as well.

  • 1
    As you suggested I edited my yum.conf referring the link. I used export http_proxy. But now I get CRITICAL:yum.cli:Config Error: Parsing file failed: File contains parsing erro: file:///etc/yum.conf [line 15]: export http_proxy I dont want to include my credentials in the file. SO I have set up proxy through the command line before editing this. What am I doing wrong? – Ashwin Sep 23 '13 at 23:31
  • 1
    Awesome. As a temporary fix I included my credentials in yum.conf and it worked. Still I would love to know how to make it secure. Now any user will be able to use proxy server using my credentials. – Ashwin Sep 23 '13 at 23:43
  • the link is broken. my yum.conf is in /etc, if anyone wonders – Line Sep 12 at 10:39
1

In my case, I have a proxy:port settings. I edited the /etc/yum.conf file, but forgot the port number after the proxy= entry.

proxy=http://your.proxyhost.org:8080

I was seeing this exact error as stated above, so I rechecked the yum.conf file and added the correct port and it works.

1

I had the same issue regarding this error: Cannot find a valid baseurl for repo: base and Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=os&infra=stock

As root (su - root) and provide your username password, you should be in the sudoers file.

Then:

vim /etc/yum.repos.d/CentOS-Base.repo

Modify all only these three sections (base, update and extra) by adding the correct baseurl depending on your centos versions. Keep uncommented the previous baseurl.

Just add this line in all 3 sections:

baseurl=http://mirror.centos.org/centos/6.6/os/i386/

The issue is that yum doesn't find the correct url (obsolete).

I did it and yum just started uploading the packages. No Proxy needed (use proxy if your connection need it), other direct internet connection in you centos settings. Good Luck.

  • Could you please add all three lines that are necessary besides just baseurl? Add four space characters before code to properly format it. – John Sep 30 '16 at 20:31
0

common mistake you name the file reoslve.conf vs resolv.conf,, check that the file name is resolv.conf..then type ping yahoo.com or some domain of your choosing, should resolve properly and automatically after you update this file, or try after service network start then ping.

-1

I have come across to the same problem and got the solution after doing some network configurations changes to the file presented at /etc/sysconfig/network-scripts/your etherenet file.

DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
IPV6INIT=yes
IPV6_AUTOCONF=no
NETWORK=X.X.X.X
NETMASK=X.X.X.X
IPADDR=X.X.X.X
GATEWAY=X.X.X.X
DNS1=X.X.X.X
DNS2=X.X.X.X
USERCTL=no
-1

It cause of nameserver

solution is

nano /etc/resolv.conf

and insert

nameserver 8.8.8.8
nameserver 8.8.4.4

it all work!

  • The OP says “I tried adding nameserver 8.8.8.8 [to my /etc/resolve.conf]. It didn't work.” Do you believe that 8.8.8.8+8.8.4.4 will be better? – Scott May 22 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.