debian-installer preseed "d-i mirror/http/proxy" sets env http_proxy

Bug #568704 reported by Anton Cohen on 2010-04-22
106
This bug affects 22 people
Affects Status Importance Assigned to Milestone
debian-installer (Debian)
New
Unknown
debian-installer (Ubuntu)
Wishlist
Unassigned

Bug Description

Binary package hint: debian-installer

Description: Ubuntu lucid (development branch)
Release: 10.04

In my preseed file I set "d-i mirror/http/proxy string http://apt-cacher:3142/", this is an apt-cacher-ng proxy. This works correctly for installing the system.

I expect "d-i mirror/http/proxy" to only apply to the debian installer http proxy (apt proxy), and all other http applications, e.g., wget, curl, lynx to not use that setting.

Instead when I run applications from the Kickstart %post section, all HTTP connections are proxied; curl, wget, lynx, hg (mercurial), everything. Once the system installs and reboots all is good, the only remanence of the mirror/http/proxy setting is in /etc/apt/apt.conf, which is fine (though I think that should be configurable too). mirror/http/proxy is setting the environment variable http_proxy.

Repo:
Set "d-i mirror/http/proxy string http://apt-cacher:3142/" in a preseed (use your local mirror).

Use a Kickstart post section like this:
%post --interpreter=/bin/bash
exec < /dev/tty3 > /dev/ttyS0
chvt 3
(
echo "## http_proxy = $http_proxy"
echo "## lynx dump head"
lynx -dump -head http://example.com
echo "## wget"
wget -O /root/test http://example.com
) 2>&1 | /usr/bin/tee /var/log/post_install.log
chvt 1

After install check /var/log/post_install.log and it will look like:
## http_proxy = http://apt-cacher:3142/
## lynx dump head
HTTP/1.1 403 Forbidden file type or location
Date: Thu Apr 22 16:29:10 2010
Server: Debian Apt-Cacher NG/0.4.6
## wget
--2010-04-22 09:29:10-- http://example.com
Resolving apt-cacher... 10.0.0.10
Connecting to apt-cacher|10.0.0.10|:3142... connected.
Proxy request sent, awaiting response... 403 Forbidden file type or location
2010-04-22 09:29:10 ERROR 403: Forbidden file type or location.

The workaround for me it to reset $http_proxy at the top of %post:
export http_proxy=""
Then all the applications that use http behave normally.

Suggestion:
Don't set $http_proxy with "d-i mirror/http/proxy", maybe set $apt_http_proxy if d-i needs an environment variable. For users that need a general proxy a setting like "d-i http/proxy" could be created.

MattW (seattle) (mbw) wrote :

I am also seeing this error on Debian Squeeze (debian 6) on i386 when I use Debian Installer.

If the Debian / Ubuntu folks want to save a lot of traffic on their public mirrors, it makes sense to fix this bug.
I am about to run hundreds of nodes worth of installs with about 600 packages - if you'd like me to hit your
ftp.us.debian.org an order of magnitude less, give me a way to do so with preseed!!!

thanks,
Matt

Daniel Hahler (blueyed) on 2011-10-12
Changed in debian-installer (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
Changed in debian-installer (Debian):
status: Unknown → New
ladiko (ladiko) wrote :

i have the same issue in 12.04

Javier López (javier-lopez) wrote :

The issue still exist in Ubuntu 14.04 (currently in development), as a side effect if a user decides to use:

mirror/http/proxy=http://domain.tld:3142 in the APPEND line in a pxe environment, eg.

APPEND priority=critical locale=en_US interface=auto mirror/http/proxy=http://domain.tld:3142 url=http://another-domain.tld/ubuntu.preseed initrd=ubuntu/1404/i386/initrd.gz

The installer will fail to request the remote preseed file (as it'll try to get it through the mirror url). A work around if you still want to define the mirror in the append line (and not in the remote preseed file) is to configure it at preseed/run or at preseed/early_command.

http://serverfault.com/questions/528582/debian-ubuntu-set-preseed-mirror-variable-via-early-run-command

Configuring the mirror at the APPEND line is useful when you want to use a master preseed file from every machine but want to have control when to use cache.

---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Deepak (n-deepak) wrote :

I'm trying to automate 14.04 LTS installations and I still see this problem.

Barry Morrison (basketcase) wrote :

Also experiencing this with 14.04

ladiko (ladiko) wrote :

It's offtopic but might help some people having issues with preseed:

I went over to use mksquashfs to get an image of one machine which is up to date and mount it on another system and use rsync to update the other machine to the exact same state. I use rsync --exclude /etc/hostname --exclude /etc/hosts --exclude /mount and more exclusions and get the same system with specific files unchanged. on new systems I use a minimal linux from minimal.linux-bg.org on a memory drive and partion the hard disk, rsync the files to the disk and chroot update-grub etc.

5 minutes installation / update and no need to preseed or download everthing on each system.

This issue is still the case using 16.04.

Worked around this using:

#
# d-i proxy sets the proxy globally and not for pkgs only
# see also: https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/568704
#
unset http_proxy

quite on top of the %POST section of my kickstart file. Thanks for the original poster who gave the inspiration for that.

Darien (dpsi) on 2017-10-04
information type: Public → Public Security
information type: Public Security → Public
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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