Proxy Authentication Required

My arm64 snap fails with:

+ snapcraftctl stage
[12/Feb/2022:05:11:00 +0000] "GET http://ftpmaster.internal/ubuntu/pool/main/e/elfutils/libdw1_0.176-1.1build1_arm64.deb HTTP/1.1" 407 2193 "-" "Debian APT-HTTP/1.3 (2.0.6) non-interactive"

Err libdw1_0.176-1.1build1_arm64.deb                                            

  407  Proxy Authentication Required [IP: 10.10.10.1 8222]                      

Fetched 0 B in 0s (0 B/s)                                                       
Package fetch error: The item '/root/.cache/snapcraft/download/libdw1_0.176-1.1build1_arm64.deb' could not be fetched: 407  Proxy Authentication Required [IP: 10.10.10.1 8222]
Build failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 202, in run
    self.pull()
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 172, in pull
    env=env)
  File "/usr/lib/python3/dist-packages/lpbuildd/target/operation.py", line 50, in run_build_command
    return self.backend.run(args, cwd=cwd, env=full_env, **kwargs)
  File "/usr/lib/python3/dist-packages/lpbuildd/target/lxd.py", line 539, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'lp-focal-arm64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/lpbuildd-git-proxy', '--env', 'SNAPPY_STORE_NO_CDN=1', '--env', 'SNAPCRAFT_LOCAL_SOURCES=1', '--env', 'SNAPCRAFT_SETUP_CORE=1', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-69242982", "build-request-timestamp": "2022-02-11T23:52:53Z", "build_url": "https://launchpad.net/~build.snapcraft.io/+snap/88b3637f4e0291817fac9f2f7ed53efa/+build/1671489"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--', '/bin/sh', '-c', 'cd /build/qtcreator-ros && linux64 snapcraft pull']' returned non-zero exit status 2.
Revoking proxy token...

while the amd64 builds fine.

Is there a way to prevent this (e.g. by using another source)? Also, if I want to retry this, I have to rebuild both snaps (amd64 and arm64). This is quite ineffective. Is there a way to only rebuild the failed snaps?

does your snap take a long time to build (and longer on arm64) ? the proxy token for the builders are only valid for something like 3h …

For the amd64, it says the build duration is “1 hour”. For the failed arm64 snap, this is “3 hours”. I guess 3 hours is the maximum time for a build? Or is the 3h limit just for downloading and the build could actually take longer? My best guess is that any arm64 build will take longer than its corresponding amd64 build.

There are only a few timestamps in the log (and the successful build do not have any log). The failed arm64 log starts at:

12 Feb 12:37:47 ntpdate[1656]: adjust time server 10.211.37.1 offset 0.007564 sec

and fails at:

2022/02/12 15:37:48 socat[35378] E CONNECT code.qt.io:9418: Proxy Authentication Required

which is exactly the 3h that you mentioned.

The log does not update during the build, so it is hard to say if the build really takes that long or if it gets stuck in downloading something that then just times out.

How do I increase this timeout?

this time limit is just for downloading, there is no limit in build duration time …

you can not increase the time limit for the proxy token but you can perhaps re-organize your snapcraft.yaml to do all the the downloading first …

The snap in question builds Qt 6 and Qt Creator. Those are relatively expensive to build. I don’t think rearranging those would make any difference. In this case, rearranging isn’t possible anyway since one has to be build before the other.

this time limit is just for downloading, there is no limit in build duration time …

The flatpak-builder (used for building flatpaks similarly to snapcraft) gathers all sources before the build. So these kinds of timeouts would not occur unless the downloading itself exceeds the maximum time. Can I do something similar with snapcraft, so that it will download all sources first (within the 3h proxy token timeout), and then build using those sources?

you can not increase the time limit for the proxy token

May I ask why this is the case? Choosing a timeout of 3h seems arbitrary to me. Since this is the cumulated time of downloading and building, this effectively means that it is not possible to distribute any meaningful arm64 snaps.

Someone must have chosen this number as a timeout for a reason. It should be easy to increase this. Where is this timeout set? And whom can I contact to discuss this?

For Snapcraft 6.1 (and for core20) we are introducing a build-attributes entry for parts named core22-step-dependencies which brings in a future feature into core20 which would have the effect you want. We tried changing the behavior globally but too many projects were tied to the current lifecycle execution.

Do you mean the behaviour where all sources are downloaded before the build? Can you point me to documentation on how this can be used? I am eager to have this sorted out so I can build the arm64 snap.

This has yet to be released so not documented to not confuse yet, an example however on how to trigger the behavior is on:

Which is part of

And this will be the supported behavior when using core22 on Snapcraft 7 which will start using

For some time, the arm64 builds did seem to work with the snapcraft timeouts (I think within 7 or 8 hours). But now they are failing again when they time out at 6 hours. Did those timeouts change back and forth globally?

Is it not possible to set the timeout sufficiently high enough such that the arm64 builds pass when their amd64 counterparts also pass?