Wednesday, 30 April 2014

[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"

Of the many problems with yum, [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404" is one that meets with all kinds of differing suggestions. In case you haven't seen it before, your yum command fails, but yet you can access the file using wget or curl.

# yum info s3cmd
Loaded plugins: changelog, fastestmirror, rhnplugin, security, versionlock
centos-6.0-x86_64                                        | 1.0 kB     00:00     
centos-6.0-x86_64/primary                                | 3.7 MB     00:00     
centos-6.0-x86_64                                                     8791/8791
http://xx.xx.xx.xx/cobbler/repo_mirror/centos-6.3-updates-x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: centos-6.3-updates-x86_64. Please verify its path and try again

# wget http://xx.xx.xx.xx/cobbler/repo_mirror/centos-6.3-updates-x86_64/repodata/repomd.xml
--2014-04-15 07:57:55--  http://xx.xx.xx.xx/cobbler/repo_mirror/centos-6.3-updates-x86_64/repodata/repomd.xml
Connecting to xx.xx.xx.xx:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1213 (1.2K) [text/xml]
Saving to: “repomd.xml”

100%[======================================>] 1,213     --.-K/s   in 0s 

The first thing to do before running any of the commands is to look what  is going on by setting an environment variable that gives more debug info to what exactly is going on, e.g....

URLGRABBER_DEBUG=1 yum info s3cmd


For example in this case, it turns out some helpful soul had configured a proxy where one wasn't needed!


INFO:urlgrabber:opening local file "/var/cache/yum/x86_64/6/centos-6.3-updates-x86_64/repomd_V4Iwmtmp.xml" with mode wb 
* About to connect() to proxy mymachine.localdomain port 81 (#0)
*   Trying xx.xx.xx.xx…
* connected
* Connected to mymachine.localdomain (xx.xx.xx.xx) port 81 (#0)
> GET http://xx.xx.xx.xx/cobbler/repo_mirror/centos-6.3-updates-x86_64/repodata/repomd.xml HTTP/1.1 
User-Agent: urlgrabber/3.9.1 yum/3.2.29
Host: somehost.somedomain
Accept: */*
Proxy-Connection: Keep-Alive
* The requested URL returned error: 404
* Closing connection #0


Which directs you straight to the helpful config we need to rip out to get working again.


# grep proxy /etc/yum.conf
proxy=http://somehost.somedomain:81
proxy_username=
proxy_password=


No comments: