#1106224 sbuild does not provision a working chroot when there is an http_proxy

Package:
sbuild
Source:
sbuild
Submitter:
Picca Frédéric-Emmanuel
Date:
2025-05-22 15:29:02 UTC
Severity:
normal
#1106224#5
Date:
2025-05-21 13:46:23 UTC
From:
To:
Hello, I am trying to build the nbclassic package on a computer which s behind a proxy.
I need to setup apt and http_proxy in order to have something working.

Here the result of sbuild the first time I try to build the package

I: No tarballs found in /home/experiences/instrumentation/picca/.cache/sbuild
I: Creating new chroot tarball:
mmdebstrap --variant=buildd --arch=amd64 --skip=output/mknod --format=tar unstable /home/experiences/instrumentation/picca/.cache/sbuild/unstable-amd64.tar
I: automatically chosen mode: unshare
I: chroot architecture amd64 is equal to the host's architecture
I: finding correct signed-by value...
I: using /tmp/mmdebstrap.IJmh3VL_GS as tempdir
I: skipping output/mknod as requested for ./dev/console
I: skipping output/mknod as requested for ./dev/full
I: skipping output/mknod as requested for ./dev/null
I: skipping output/mknod as requested for ./dev/ptmx
I: skipping output/mknod as requested for ./dev/random
I: skipping output/mknod as requested for ./dev/tty
I: skipping output/mknod as requested for ./dev/urandom
I: skipping output/mknod as requested for ./dev/zero
I: running apt-get update...
I: downloading packages with apt...
I: extracting archives...
I: installing essential packages...
I: installing remaining packages inside the chroot...
I: cleaning package lists and apt cache...
I: creating tarball...
I: done
I: removing tempdir /tmp/mmdebstrap.IJmh3VL_GS...
I: success in 20.6569 seconds
I: Placed new chroot tarball at /home/experiences/instrumentation/picca/.cache/sbuild/unstable-amd64.tar
I: Unpacking /home/experiences/instrumentation/picca/.cache/sbuild/unstable-amd64.tar to /tmp/tmp.sbuild.k4qe2VnZZU...
I: Setting up the chroot...
I: Creating chroot session...
I: Setting up log color...
I: Setting up apt archive...

+------------------------------------------------------------------------------+
| Update chroot                                Wed, 21 May 2025 13:19:03 +0000 |
+------------------------------------------------------------------------------+

Ign:1 http://deb.debian.org/debian unstable InRelease
Ign:1 http://deb.debian.org/debian unstable InRelease
Ign:1 http://deb.debian.org/debian unstable InRelease
Err:1 http://deb.debian.org/debian unstable InRelease
  Could not connect to deb.debian.org:80 (146.75.74.132), connection timed out
  Unable to connect to deb.debian.org:80:
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/unstable/InRelease  Unable to connect to deb.debian.org:80:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


so it seems that at first mmdebstrap use the apt proxy in order to setup the initial chroot

It seems that this initial chroot doesn not get the proxy propagated into.

So when sbuild try to upgrade the unshare chroot it does not use the proxy, -> failure of the build

It would be great if sbuild could detect the proxy and add it to the unshare chroot.


it ould be great also if the http_proxy could be added in the chroot in order to have an autopkgtest network working environment.

cheers

Fred

#1106224#10
Date:
2025-05-21 14:28:26 UTC
From:
To:
Hi Fred,

* Picca Frédéric-Emmanuel <picca@debian.org> [2025-05-21 15:46]:

This is interesting, I don't see mmdebstrap using http_proxy, maybe it
is apt directly.

As a workaround for now you could set the proxy explicitly by adding
this to your sbuild config:

push @{$unshare_mmdebstrap_extra_args}, ("*", ['--aptopt=Acquire::http { Proxy "http://127.0.0.1:3142"; }']);

Cheers Jochen

#1106224#15
Date:
2025-05-21 14:42:09 UTC
From:
To:
Le 2025-05-21 16:28, Jochen Sprickerhof a écrit :

Hello

It seems to me that mmdebstrap generate the chroot by using the system
apt which is well configure.

then when it enter into the chroot these is no more configuration of apt
inside the chroot.

Indeed if I add this it works :).

It would be great if out of the box sbuild could deal with proxies.

One less step to do before buildding packages.

nevertheless thanks for all your work on sbuild

It is better and better with time.

Fred

#1106224#20
Date:
2025-05-22 14:58:28 UTC
From:
To:
do you know how to define the http_proxy and https_proxy via this same
extra_args parameter.

This is something not explined in the sbuild wiki.debian.org.

Cheers

Fred

#1106224#25
Date:
2025-05-22 15:08:39 UTC
From:
To:
* picca <picca@debian.org> [2025-05-22 16:58]:

See mmdebstrap(1) there are examples. Please reply if they don't work.

Cheers Jochen

#1106224#30
Date:
2025-05-22 15:27:29 UTC
From:
To:
for the record here my solution

$unshare_mmdebstrap_extra_args = [
     "*" => [ '--aptopt=Acquire::http { Proxy "http://..."; }',
              '--aptopt=Acquire::https { Proxy "http://..."; }',
              '--customize-hook=echo "export http_proxy=http://..."  >
"$1"/etc/environment',
              '--customize-hook=echo "export https_proxy=http://..."  >
"$1"/etc/environment',
     ]
     ];