Yum / reposync error when using proxy - HTTP Error 502: Bad Gateway

Solution Verified - Updated -

Issue

A system is registered to the Red Hat Network using the rhnreg_ks or rhn_register commands. The server is configured to use a proxy for Red Hat Network / yum related traffic however updates fail to be retrieved with an error similar to the below:

[root@hostname /]# yum list
Loaded plugins: rhnplugin, security
Error: failed to retrieve repodata/1b944da74c82902e4fc9057b4af2dbf846b082a8-primary.xml.gz from rhel-x86_64-server-5
error was [Errno 14] HTTP Error 502: Bad Gateway

The issue is also present when attempting to run the reposync command:

[root@hostname /]#  reposync --gpgcheck -l --repoid=rhel-x86_64-server-5 --download_path=/path/to/repo/
Loaded plugins: rhnplugin
Traceback (most recent call last):
  File "/usr/bin/reposync", line 291, in ?
    main()
  File "/usr/bin/reposync", line 179, in main
    my.doSackSetup(rpmUtils.arch.getArchList(opts.arch))
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 464, in doSackSetup
    return self._getSacks(archlist=archlist, thisrepo=thisrepo)
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 501, in _getSacks
    self.repos.populateSack(which=repos)
  File "/usr/lib/python2.4/site-packages/yum/repos.py", line 260, in populateSack
    sack.populate(repo, mdtype, callback, cacheonly)
  File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 187, in populate
    xml = repo_get_function()
  File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1543, in getPrimaryXML
    return self.retrieveMD('primary')
  File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1484, in retrieveMD
    return self._retrieveMD(mdtype)
  File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1524, in _retrieveMD
    cache=self.http_caching == 'all')
  File "/usr/lib/yum-plugins/rhnplugin.py", line 319, in _getFile
    raise yum.Errors.RepoError, \
yum.Errors.RepoError: failed to retrieve repodata/1b944da74c82902e4fc9057b4af2dbf846b082a8-primary.xml.gz from rhel-x86_64-server-5
error was [Errno 14] HTTP Error 502: Bad Gateway

The up2date.conf contains lines similar to the one below (where the proxy address is 192.168.1.1 and the proxy port is 8080):

enableProxy[comment]=Use a HTTP Proxy
enableProxy=1



httpProxy[comment]=HTTP proxy in host:port format, e.g. squid.redhat.com:3128
httpProxy=192.168.1.1:8080

Environment

  • Red Hat Enterprise Linux 5.5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In