Bug#642159: Do we need a separate mirror/apt/proxy option?
I've dug a little bit in the code and agree with Matt that probably we require
and extra option (or even more if we want to control when to leave the mirror in
/etc/apt/apt.conf), it seems for me that http_proxy (mirror/http/proxy) is being
abused. It's set|retrieve several times during installation, and used for
several purposes.
/usr/lib/fetch-url/http (debian-installer-utils)
23 # use the proxy for wgets (should speed things up)
24 if db_get mirror/$proto/proxy; then
25 export ${proto}_proxy="$RET"
26 fi
/bin/choose-mirror (choose-mirror.c, choose-mirror)
656 static int set_proxy(void) {
657 char *px = add_protocol("proxy");
658 char *proxy_var;
659
660 proxy_var = xasprintf("%s_proxy", protocol);
661
662 debconf_get(debconf, px);
663 if (debconf->value != NULL && strlen(debconf->value)) {
664 if (strstr(debconf->value, "://")) {
665 setenv(proxy_var, debconf->value, 1);
/usr/lib/apt-setup/generators/50mirror (apt-setup)
225 if [ "$protocol" = http ]; then
226 db_get mirror/$protocol/proxy
227 proxy="$RET"
228 if [ -n "$proxy" ]; then
229 if ! grep -iq "Acquire::$protocol::Proxy" $ROOT/etc/apt/apt.conf.new; then
230 echo "Acquire::$protocol::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf.new
This make the installer to fail on several situations, let's suppose
mirror/http/proxy is set on a PXE APPEND environment this way:
APPEND DEBCONF_DEBUG=5 priority=critical locale=en_US interface=auto mirror/http/proxy=http://10.99.88.1:3142 url=http://domain.com/file.preseed initrd=initrd.gz
The installer will fail while fetching http://domain.com/file.preseed. This is
because /usr/lib/fetch-url/http set 'export http_proxy=http://10.99.88.1:3142
before retrieving the preseed file.
Now, if export ${proto}_proxy="$RET" is commented on /usr/lib/fetch-url/http,
the installer will go one step further, it'll retrieve the preseed file, but
still will fail when downloading other files on preseed/run, preseed/include and
preseed/late_command. This is due to /bin/choose-mirror setting again http_proxy
on setenv(proxy_var, debconf->value, 1);
Finally, if that line is commented as well, the installer will finish
successfully while still using the mirror because apt-setup use the variable to
configure apt-get before base-installer get into the action. The proxy will also
be available on next boot after installation.
I think this can be fixed, if we add a mirror/apt/proxy debconf variable and use
it on /usr/lib/apt-setup/generators/50mirror while leaving choose-mirror and
/usr/lib/fetch-url/http untouched. Then people could use mirror/http/proxy to
control connections for general applications and mirror/apt/proxy for
controlling debian repositories.
Reply to: