apt-get does't work with http_proxy

Bug #1613193 reported by zhang sheng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I use lubuntu 16.04.
$ uname -a
Linux ubuntu 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ dpkg -l |grep apt
ii apt 1.2.10ubuntu1 amd64 commandline package manager

When I set "http_proxy" environment var and run "apt-get update", I get many "connection failed"
Err:16 http://archive.ubuntu.com/ubuntu xenial/main Sources
  Connection failed
Err:17 http://archive.ubuntu.com/ubuntu xenial/restricted Sources
  Connection failed
Err:18 http://archive.ubuntu.com/ubuntu xenial/universe Sources
  Connection failed
Err:19 http://archive.ubuntu.com/ubuntu xenial/multiverse Sources
  Connection failed
Err:20 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
  Connection failed
Err:21 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages
  Connection failed

But I can use curl and wget to fetch website homepage.
And in centos7, yum can work with 'http_proxy', I can update my centos7.

Tags: xenial
zhang sheng (langyxxl)
tags: added: xenial
Revision history for this message
David Kalnischkies (donkult) wrote :

What type of proxy is that? Given you were using it before I presume its an HTTP proxy. Does the URI you specify has "http://" in front? Is that perhaps a public proxy? We have a test covering HTTP proxies and I have just run an upgrade myself with a SOCKS proxy so that more likely something specific to your setup than a general "everything broken" case…

Please run apt with some debug options enabled: -o Debug::Acquire::http=1 -o Debug::pkgAcquire::Worker=1

Beware: That generates a lot of output, so you might want to add also somthing like: 2>&1 | tee apt-update.log

Revision history for this message
zhang sheng (langyxxl) wrote :

$ export http_proxy=http://192.168.1.1:8080
$ apt-get -o Debug::Acquire::http=1 -o Debug::pkgAcquire::Worker=1 update >apt-update.log 2>&1

I paste all output at "http://paste.ubuntu.com/23060145/"

I find something strange. I can't find port 8080 at debug output.
Does apt can't specify proxy port?

Revision history for this message
zhang sheng (langyxxl) wrote :

I use tcpdump to capture http request among "yum" "wget" "apt-get".
# yum repolist
Hypertext Transfer Protocol
    GET http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock HTTP/1.1\r\n
    User-Agent: urlgrabber/3.10 yum/3.4.3\r\n
    Host: mirrorlist.centos.org\r\n
    Accept: */*\r\n
    Proxy-Connection: Keep-Alive\r\n
    \r\n
    [Full request URI: http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock]
    [HTTP request 1/1]
    [Response in frame: 8]

# wget http://archive.ubuntu.com/ubuntu/dists/xenial/restricted/i18n/Translation-zh
Hypertext Transfer Protocol
    GET http://archive.ubuntu.com/ubuntu/dists/xenial/restricted/i18n/Translation-zh HTTP/1.1\r\n
    User-Agent: Wget/1.17.1 (linux-gnu)\r\n
    Accept: */*\r\n
    Accept-Encoding: identity\r\n
    Host: archive.ubuntu.com\r\n
    Connection: Keep-Alive\r\n
    Proxy-Connection: Keep-Alive\r\n
    \r\n
    [Full request URI: http://archive.ubuntu.com/ubuntu/dists/xenial/restricted/i18n/Translation-zh]
    [HTTP request 1/1]
    [Response in frame: 1180]

# apt-get update
Hypertext Transfer Protocol
    GET http://archive.ubuntu.com/ubuntu/dists/xenial/restricted/i18n/Translation-zh HTTP/1.1\r\n
    Host: archive.ubuntu.com\r\n
    Cache-Control: max-age=0\r\n
    Accept: text/*\r\n
    User-Agent: Debian APT-HTTP/1.3 (1.2.10)\r\n
    \r\n
    [Full request URI: http://archive.ubuntu.com/ubuntu/dists/xenial/restricted/i18n/Translation-zh]
    [HTTP request 1/1]

Only "apt-get" doesn't have "Proxy-Connection: Keep-Alive", how can i add "Proxy-Connection: Keep-Alive" to apt-get? I need to verify this.

Revision history for this message
zhang sheng (langyxxl) wrote :

Finally I find the problem is User-Agent string in apt-get.

see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=355782

Revision history for this message
Julian Andres Klode (juliank) wrote :

Marking as invalid then.

Changed in apt (Ubuntu):
status: New → Invalid
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.