Bug 161190

Summary: proxy setting in yum.conf is ignored
Product: [Fedora] Fedora Reporter: Tomasz Kepczynski <tomek>
Component: yumAssignee: Jeremy Katz <katzj>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: arequipeno, cesare, frodet, goemon, hugo, katzj, marius.andreiana, rhbugzilla, roozbeh, saalwaechter, stephan_ebelt
Target Milestone: ---   
Target Release: ---   
Hardware: noarch   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-04-10 18:46:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace -ff -o yum.log yum update none

Description Tomasz Kepczynski 2005-06-21 08:25:29 UTC
Description of problem:
According to yum.conf man page proxy setting in yum.conf contains url to
proxy server yum should use. I've put the following line in my yum.conf:
proxy=http://proxy01.ir.intel.com:911/
as the last uncommented line in main section.
Regardless of the above setting yum tries to connect directly.
Setting http_proxy in environment works as expected.

Version-Release number of selected component (if applicable):
yum-2.3.2-7

How reproducible:
always

Steps to Reproduce:
1. set proxy in yum.conf as described above
2. try to issue yum update
  
Actual results:
yum tries to connect directly (and can't due to firewall)

Expected results:
yum goes through proxy as described in man page

Additional info:

Comment 1 Frode Tennebø 2005-09-06 07:57:44 UTC
I'm had the same problem as you. Setting the environment as follows:

export HTTP_PROXY="http://proxy01.ir.intel.com:911/" (in your case)

solved my problem. I also commented out the yum.conf proxy entry.

Comment 2 Jeremy Katz 2005-09-21 19:27:47 UTC
Does this still occur with yum 2.4.0?

Comment 3 Graham King 2005-09-22 09:11:24 UTC
I just tested with yum-2.4.0-0.fc4 and the proxy setting in yum.conf was honoured.

Comment 4 Tomasz Kepczynski 2005-09-22 09:23:15 UTC
yum     19236 root    4u  IPv4 12089754              TCP
gklab-59-001.igk.intel.com:55241->www.redhat.com:http (SYN_SENT)

and /etc/yum.conf:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
proxy=http://proxy01.ir.intel.com:911/

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

So for me yum-2.4.0-0.fc4 does not work as expected.


Comment 5 Tomasz Kepczynski 2005-09-22 19:30:33 UTC
I thought I was clear that it does NOT work for me. Config above has
proxy set inside a file and yum attempts to connect directly to
www.redhat.com (as a line from lsof listing shows) which of
course is stuck in SYN_SENT as there is no response coming back
due to firewall.
Reopening.

Comment 6 Dan Hollis 2005-09-22 22:25:27 UTC
x86_64 yum-2.4.0-0.fc4 seems to proxy ok for me.

of course no solution for fc3 ...

Comment 7 Tomasz Kepczynski 2005-09-23 06:27:44 UTC
Created attachment 119176 [details]
strace -ff -o yum.log yum update

Comment 8 Tomasz Kepczynski 2005-09-23 06:31:58 UTC
I don't understand why but on two machines yum behaves differently.
Attachment above is from i686 SMP where yum does not honour proxy
setting from configuration file (comment #4). On anotcher machine
(x86_64) everything seems to work fine...
Is it possible that yum tries to read something from up2date which
may affect its behaviour?



Comment 9 Frode Tennebø 2005-09-28 12:04:23 UTC
[ft@garvin ~]$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
keepalive=0
proxy=http://www-proxy:81/

[ft@garvin ~]$ rpm -q yum
yum-2.4.0-0.fc4

[root@garvin ~]# yum upgrade
Setting up Upgrade Process
Setting up repositories
Cannot find a valid baseurl for repo: updates-released
Error: Cannot find a valid baseurl for repo: updates-released

[root@garvin ~]# export HTTP_PROXY=http://www-proxy:81/
[root@garvin ~]# yum upgrade
Setting up Upgrade Process
Setting up repositories
updates-released          100% |=========================|  951 B    00:00     
extras                    100% |=========================| 1.1 kB    00:00     
base                      100% |=========================| 1.1 kB    00:00     
:
:

So for me, 2.4.0 also does NOT work.

Comment 10 Tomasz Kepczynski 2005-09-28 12:08:42 UTC
For the comment #8 - the x86_64 which seemed to work actually worked
only because it was behind transparent proxy. yum insists on contacting
fedora.redhat.com, probably to get mirror list.


Comment 11 Frode Tennebø 2005-09-28 12:14:42 UTC
s/work/honour proxy settings in yum.conf/

Comment 12 Stephan Ebelt 2005-12-22 12:02:19 UTC
I ran into exactly this issue on a fresh FC4 installation. The last update
installed yum-2.4.1-1.fc4.

It just ignores the proxy setting in yum.conf and attempts to make a direct
connection.

# grep proxy /etc/yum.conf
proxy=http://proxy.dd.net-linx:3128/

# yum update &

# netstat 
Proto Recv-Q Send-Q Local Address       Foreign Address         State
tcp        0      1 dd-lx-gsx03:53794   www.redhat.com:http     SYN_SENT
[...]

Setting $http_proxy works. But *only if* there is a slash at the end. E.g.

export http_proxy=http://proxy.some.tld:3128/

rather than

export http_proxy=http://proxy.some.tld:3128

Comment 13 Andrea Pasquinucci 2006-01-08 14:51:06 UTC
There is something wrong in the parsing of the ENV variables HTTP_PROXY and
http_proxy, I tried various forms for them  like 

export http_proxy=http://proxy.some.tld:3128
export http_proxy=http://proxy.some.tld:3128/
export http_proxy=proxy.some.tld:3128
export http_proxy=proxy.some.tld:3128/

getting every time different results, either working or something like

 Setting up repositories
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.main(sys.argv[1:])
  File "/usr/share/yum-cli/yummain.py", line 92, in main
    result, resultmsgs = do()
  File "/usr/share/yum-cli/cli.py", line 528, in doCommands
    ypl = self.returnPkgLists()
  File "/usr/share/yum-cli/cli.py", line 1170, in returnPkgLists
    ypl = self.doPackageLists(pkgnarrow=pkgnarrow)
  File "__init__.py", line 904, in doPackageLists
  File "/usr/share/yum-cli/cli.py", line 71, in doRepoSetup
    yum.YumBase.doRepoSetup(self, thisrepo=thisrepo)
  File "__init__.py", line 233, in doRepoSetup
  File "repos.py", line 681, in getRepoXML
  File "repos.py", line 624, in get
  File "/usr/lib/python2.4/site-packages/urlgrabber/mirror.py", line 414, in urlgrab
    return self._mirror_try(func, url, kw)
  File "/usr/lib/python2.4/site-packages/urlgrabber/mirror.py", line 400, in
_mirror_try
    return func_ref( *(fullurl,), **kwargs )
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 618, in
urlgrab
    return self._retry(opts, retryfunc, url, filename)
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 547, in _retry
    return apply(func, (opts,) + args, {})
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 604, in
retryfunc
    fo = URLGrabberFileObject(url, filename, opts)
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 727, in
__init__
    self._do_open()
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 794, in
_do_open
    fo, hdr = self._make_request(req, opener)
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 881, in
_make_request
    fo = opener.open(req)
  File "/usr/lib/python2.4/urllib2.py", line 358, in open
    response = self._open(req, data)
  File "/usr/lib/python2.4/urllib2.py", line 376, in _open
    '_open', req)
  File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.4/urllib2.py", line 573, in <lambda>
    lambda r, proxy=url, type=type, meth=self.proxy_open: \
  File "/usr/lib/python2.4/urllib2.py", line 580, in proxy_open
    if '@' in host:
TypeError: iterable argument required

Comment 14 Hugo Cisneiros 2006-01-24 15:26:26 UTC
*** Bug 178805 has been marked as a duplicate of this bug. ***

Comment 15 John Saalwaechter 2006-03-23 23:10:39 UTC
This is still a problem under Fedora Core 5. I just did a fresh
install of FC5. I put a proxy line in the [main] section of
/etc/yum.conf, and I got the error:

Error: Cannot find a valid baseurl for repo: core

I looked at the python involved, and the problem that I see is that
the getMirrorList() function in /usr/lib/python2.4/site-packages/yum/repos.py
does not provide any of the URLGrabber configuration that the
Repository.setupGrab() method does for the Repository object. In
getMirrorList() it's just doing a bare url grab. The first url grabbed is
the mirrorlist, which fails (silently) and eventually leads to the
"Cannot find a valid baseurl for repo: core" error.

To show that this is the problem, I did a quick hack of repos.py so that
the Repository object's self.proxy_dict is sent to the getMirrorList()
function for its use.  That solved my problem (i.e. I can set proxy in
/etc/yum.conf and it works).

Here's a diff showing the hack:

# cat /etc/fedora-release
Fedora Core release 5 (Bordeaux)
# rpm -q yum
yum-2.6.0-1
# grep proxy /etc/yum.conf
proxy=http://my_proxy_server.com:2121
# cd /usr/lib/python2.4/site-packages/yum
# diff repos.py.orig repos.py
535c535
<             mirrorurls = getMirrorList(self.mirrorlist)
---
>             mirrorurls = getMirrorList(self.mirrorlist,self.proxy_dict)
820c820
< def getMirrorList(mirrorlist):
---
> def getMirrorList(mirrorlist,pdict):
838c838
<         fo = urlresolver.urlopen(url)
---
>         fo = urlresolver.urlopen(url,proxies=pdict)
#


Comment 16 Jeremy Katz 2006-03-24 15:47:27 UTC
*** Bug 186555 has been marked as a duplicate of this bug. ***

Comment 17 Jeremy Katz 2006-04-10 18:46:36 UTC
Committed to CVS and will build for the devel tree for tomorrow.  If you could
get that package and test it with FC5 that would help (and then I'll eventually
push for an fc5 update)