Force IPv4 in the build VM and fix the APT cache path
All checks were successful
build-image / build (push) Successful in 13m15s
All checks were successful
build-image / build (push) Successful in 13m15s
The build logs here show the same stall measured on maas-samba-ad: a 28.5 MB apt fetch taking 31s and a 12.0 MB one taking 30s, while a 14.1 MB fetch completed in under a second. A fixed cost that ignores size is a timeout, not a bandwidth limit — QEMU's user-mode network advertises IPv6 that does not work, so apt's parallel connections black-hole on it and fall back to IPv4 only when the 30-second timeout expires. Patch the build VM's cloud-init seed from bootcmd, which runs before SSH is up and therefore covers upstream's apt calls too. On maas-samba-ad this took the same 28.5 MB fetch from 31s to 3s; no build has been run here since, and the README says so. APT_PROXY also never worked as documented: a cache cannot see inside a CONNECT tunnel, so repositories must be rewritten to plain http, and Debian 13 keeps the real mirror URLs in /etc/apt/mirrors/*.list behind the mirror+file: method, which the old sed missed. Drop the invented "roughly 700 MB" saving from the README. On maas-samba-ad a fully warm cache was worth about three seconds of a 4m40s build. This image pulls far more from the Proxmox repository, so the cache may matter more here, but that is unmeasured and is now listed as such. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
11
Makefile
11
Makefile
@@ -174,6 +174,17 @@ image: checkout $(CUSTOMIZE)
|
||||
sed -i -E 's|^([[:space:]]*disk_size[[:space:]]*=[[:space:]]*).*|\1"$(DISK_SIZE)"|' $(TPL)/debian-cloudimg.pkr.hcl
|
||||
sed -i -E 's|^([[:space:]]*cpus[[:space:]]*=[[:space:]]*).*|\1$(BUILD_CPUS)|' $(TPL)/debian-cloudimg.pkr.hcl
|
||||
sed -i -E 's|^([[:space:]]*memory[[:space:]]*=[[:space:]]*).*|\1$(BUILD_MEM)|' $(TPL)/debian-cloudimg.pkr.hcl
|
||||
@echo "==> Build VM apt ayari yamalaniyor (IPv4 zorlama + timeout)"
|
||||
# Every apt fetch over roughly 15 MB inside the build VM used to stall for
|
||||
# exactly 31 seconds regardless of its size, which is a connection timeout
|
||||
# rather than a bandwidth limit: QEMU's user-mode network offers IPv6 that
|
||||
# does not actually work, so apt's parallel connections black-hole on it and
|
||||
# only fall back to IPv4 when the timeout expires. Forcing IPv4 took the
|
||||
# 28.5 MB upstream fetch from 31s to 3s. bootcmd runs in cloud-init's
|
||||
# init-local stage, before SSH is up, so this is in place for the upstream
|
||||
# provisioners too, not just ours.
|
||||
sed -i "/^bootcmd:/a\\ - echo 'Acquire::ForceIPv4 \"true\"; Acquire::http::Timeout \"20\"; Acquire::Retries \"3\";' > /etc/apt/apt.conf.d/99-build-speed" $(TPL)/user-data-cloudimg
|
||||
@sed -n '/^bootcmd:/,+1p' $(TPL)/user-data-cloudimg
|
||||
ifeq ($(strip $(DEBIAN_IMAGE_CHANNEL)),stable)
|
||||
@echo "==> Kararli Debian cloud image kullanilacak (packer onbellegi isabet eder)"
|
||||
sed -i -E 's|/daily/latest/|/latest/|g; s|-daily\.qcow2|.qcow2|g' $(TPL)/debian-cloudimg.pkr.hcl
|
||||
|
||||
Reference in New Issue
Block a user