Linux Logo

Linux Centos 6 PYCURL ERROR 6 error RESOLVED!

A particular virtual machine running Linux CentOS 6.5 had been problematic when it came to yum updates. The result always ended with a PYCURL ERROR 6 – Couldn’t resolve host. After spending way too much time towards resolution, a solution finally came to light.

The configuration of the system is a Linux CentOS 6.5 build with two network cards. One card Bridged, the other Host-only. Yum updates ran successfully when accessing a mount point, ie. /media, with only the one repository enabled at /etc/yum.repos.d/CentOS-Media.repo. However, when enabling the repositories of Base and Updates in the /etc/yum.repos.d/CentOS-Base.repo, the PYCURL ERROR 6 would unveil it’s ugly head.

It was suggested in one forum to disable ipv6 permanently. A method used to do this was adding the following lines to /etc/sysctl.conf.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

To make this change effective immediately until the next reboot (where which the /etc/sysctl.conf will take effect), run the following commands.

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

However, this did not resolve the issue. It was a post that suggested added the Google DNS to /etc/resolv.conf and then try the yum update, that it quickly became apparent the cause for this problem. The problem was within the /etc/resolv.conf file. The nameserver was pointing to the Host-only network and not the Bridged network. After changing the nameserver to point to the correct DNS servers for the Bridged network, a yum repolist command was issued and returned the expected results.

Once again, check the /etc/resolv.conf file for the appropriate nameserver or nameservers. This may resolve your PYCURL ERROR 6 error.

Source(s)
http://wiki.centos.org/FAQ/CentOS6
https://www.centos.org/forums/viewtopic.php?f=16&t=8892&sid=400261062ac4d9256f46baa285a5b70a&start=10