Wget does not work with proxy

Bug #554068 reported by Chris Norman
118
This bug affects 24 people
Affects Status Importance Assigned to Milestone
wget (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: wget

Ubuntu 10.04, April 2 build. I cannot install flashplugin or mscorefonts. Lots of messages like this: "Connecting to voxel.dl.sourceforge.net|208.122.31.13|:80... failed: Connection refused." I am using a proxy server.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: wget 1.12-1.1ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-19.28-generic 2.6.32.10+drm33.1
Uname: Linux 2.6.32-19-generic i686
Architecture: i386
Date: Fri Apr 2 18:13:44 2010
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: wget

Revision history for this message
Chris Norman (vredley-deactivatedaccount) wrote :
Revision history for this message
csantiago (santiago-carlos) wrote :

I confirm this bug. In my case I wanted to install b43-fwcutter (proprietary driver for a wireless card) using a network behind a proxy.

A. Normal procedure (FAIL)
1) Set proxy in System->Preferences->Network Proxy and set it to be system-wide
2) Install driver through System->Administration->Hardware Drivers, or
3) Install b43-fwcutter through synaptic
DIDN'T WORK because it requires a wget command that was not using the proxy

B. Download and install (FAIL)
1) Download http://archive.ubuntu.com/ubuntu/pool/main/b/b43-fwcutter/b43-fwcutter_012-1build1_i386.deb via browser
2) Double-click to install
DIDN'T WORK because it also requires the wget command to get the firmware

C. Download both b43-fwcutter and firmware and then install (FAIL)
DIDN'T WORK because the installer didn't care if the firmware is on same folder and keep trying to download it

D. Using environment variable http_proxy (FAIL)
1) Set proxy in environment variable http_proxy
2) Install with 'sudo apt-get install b43-fwcutter'
DIDN'T WORK and give an error similar to
"Connecting to voxel.dl.sourceforge.net|208.122.31.13|:80... failed: Connection refused."

E. Set proxy in /etc/wgetrc (ONLY WAY TO INSTALL IT)
1) uncomment lines with http_proxy and ftp_proxy and set the proxy
2) sudo sh
3) apt-get install b43-fwcutter

Strangely using 'sudo apt-get install b43-fwcutter' even after setting the proxy in /etc/wgetrc was still not working.
However, as root (using sudo sh) it finally installs it

SOLUTION:
In my opinion there must a way that, somehow, forces wget to use the proxy set in System->Preferences->Network Proxy

Revision history for this message
csantiago (santiago-carlos) wrote :

The fact that "using 'sudo apt-get install b43-fwcutter' even after setting the proxy in /etc/wgetrc was still not working"
may be related with https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/556293

Revision history for this message
humble_coffee (humblecoffee) wrote :

I am also having issues with wget behind a proxy. Trying to download any address that requires proxy authorization fails with the following message:

"failed: Connection timed out."

Also it seems to be trying to connect using port 80. Shouldn't it be using the port specified in the proxy setting? I have the proxy configured correctly in the Gnome Network Proxy Preferences and everything else that needs proxy access works fine, with the exception of apt-get. It's error message is:

"407 Proxy Authentication Required"

Revision history for this message
humble_coffee (humblecoffee) wrote :

Oh and I've configured .wgetrc with all relevant options.

Revision history for this message
csantiago (santiago-carlos) wrote :

humble_coffee, have you tried to use wget as normal user?

I think the problem is related to sudo. To check it, do the following:

1) Remove, or comment out, your settings of the proxy in wgetrc (either in /etc/wgetrc as in ~/.wgetrc)

2) Set proxy in System->Preferences->Network Proxy and set it to be system-wide

3) sudo su
This will make you enter a root. All the commands after this will run as root, so you don't to start them with SUDO

2) echo $http_proxy

If your proxy is correctly shown then you should be able to execute 3), 4) or 5)

If not, before going to 3) do:
export http_proxy="http://your.proxy.address:port/"

3) wget <URL of the file to download>

or
4) apt-get update

or
5) apt-get install <some package>

If you can run 3) to 5) as described, but cannot run as:
sudo wget <URL of the file to download>
sudo apt-get update
sudo apt-get install <some package>

then the problem is with SUDO that is not reading $http_proxy from environment. That bug is already reported in
https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/556293

but it is with very low activity :-(

Revision history for this message
csantiago (santiago-carlos) wrote :

I add two lines on top and forgot to renumber all the text. The correct text should be:

««
humble_coffee, have you tried to use wget as normal user?

I think the problem is related to sudo. To check it, do the following:

1) Remove, or comment out, your settings of the proxy in wgetrc (either in /etc/wgetrc as in ~/.wgetrc)

2) Set proxy in System->Preferences->Network Proxy and set it to be system-wide

3) sudo su
This will make you enter a root. All the commands after this will run as root, so you don't to start them with SUDO

4) echo $http_proxy

If your proxy is correctly shown then you should be able to execute 5), 6) or 7)

If not, before going to 5) do:
export http_proxy="http://your.proxy.address:port/"

5) wget <URL of the file to download>

or
6) apt-get update

or
7) apt-get install <some package>

If you can run 5) to 7) as described, but cannot run as:
sudo wget <URL of the file to download>
sudo apt-get update
sudo apt-get install <some package>

then the problem is with SUDO that is not reading $http_proxy from environment. That bug is already reported in
https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/556293

but it is with very low activity :-(
»»

Sorry about the second post.

Revision history for this message
humble_coffee (humblecoffee) wrote :

My problem occurs without the use of sudo. I can't download any file at all that requires proxy authentication with wget.

Revision history for this message
humble_coffee (humblecoffee) wrote :

Someone over in this bug (https://bugs.launchpad.net/ubuntu/+source/wget/+bug/232469) found the problem. The environment variable no_proxy has a trailing comma which it should not. Once you remove that, downloads through the proxy started working. I don't know whether this is the same problem that other people on this bug have been experiencing though.

Revision history for this message
Id2ndR (id2ndr) wrote :

I confirm that removing the trainning comma fix the trouble.

Here is a command line that can handle it before it is fixed:
export no_proxy=$(echo $no_proxy | sed 's/,$//')

Revision history for this message
Chris Norman (vredley-deactivatedaccount) wrote :

This bug is a fairly recent phenomenon, at least on my system. Lubuntu Beta 1 does not have this problem, whereas Lubuntu Beta 2 does.

Revision history for this message
darren (darrenm) wrote :

Just found this bug report. It's really annoying and should be fixed before Lucid RC.

Revision history for this message
Nicholas Meyer (npmeyer-gmail) wrote :

I can also confirm that removing the trailing comma fixes the problem.

Revision history for this message
Erlan Sergaziev (sergeant) wrote :

Indeed the solution seems very easy but after trying to find how to fix this I realized how difficult it is to contribute code.

Can someone with access to source code please make the correction.

I believe it should just be one line:

if (i<list_count-1) {
  // code to append comma
}

Revision history for this message
Pureferret (pureferret) wrote :

I have no "$no_proxy" setting, and having the correct proxy settings in apt.con and bash.bashrc. also set my proxy in system>preferences>network proxy and in synaptic. The only thing I have working is firefox.

Also if I've stumbled on the wrong bug report can someone redirect me?

Revision history for this message
felipeal (launchpad-felipeal) wrote :

This bug is very annoying, I re-installed Ubuntu (after using another distro for months) and spent hours trying to figure out why the proxy stop working...

Revision history for this message
AaronD12 (aarond12) wrote :

I can verify this bug is resolved (in my case) by fixing the no_proxy environment variable using the fix from Id2ndR.
export no_proxy=$(echo $no_proxy | sed 's/,$//')

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in wget (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.