[HOW TO] Fix PYCURL ERROR 6 – “Couldn’t resolve host ‘mirrorlist.centos.org’”

I have been using several VMs for simulating a multi-node environment. Most of my VMs are CentOS.
After installing CentOS 6.4 I got the following error when I tried “yum update“:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base

To fix this error I updated NM_CONTROLLED to “no” in the file /etc/sysconfig/network-scripts/ifcfg-eth0

After this I restarted the network interface using the following commands:

ifdown eth0
ifup eth0

After doing the above the yum update started working.

Hope this helps.

30 Comments [HOW TO] Fix PYCURL ERROR 6 – “Couldn’t resolve host ‘mirrorlist.centos.org’”

  1. joeljohn

    Thanks, that worked. Another post mentioned setting search domains in /etc/resolv.conf but that did not work. So this was a good fix!

    Reply
  2. Ibn

    This worked perfectly, i did a text minimal install of centos 6 but i could not connect to internet or update yum.

    The above fixed it.

    Thanks

    Reply
  3. Bobby Menthol

    Thanks so much! I was having this issue and your solution seems to be the only fix that worked for me.

    Reply
  4. Sridhar

    Actually this doesn’t work for me.

    I am on CentOS 6, and after the change suggested above to modify NM_CONTROLLED=no, it doesn’t work.

    So, after lot googling and landed on CentOS RHEL 5 Deployment 5 guide, where i found the below ..

    PEERDNS=
    where is one of the following:

    yes — Modify /etc/resolv.conf if the DNS directive is set. If using DHCP, then yes is the default.

    so, i modified my ifcfg-eth0 to PEERDNS=yes.

    and it worked for me .. and my /etc/resolv.conf has been automatically updated as below ..

    ; generated by /sbin/dhclient-script
    options single-request-reopen
    nameserver xxx.xxx.xxx.xxx

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>