From a568295bd37fb03467d9e5f0a558459e265943b7 Mon Sep 17 00:00:00 2001 From: robcholz <84130577+robcholz@users.noreply.github.com> Date: Mon, 9 Feb 2026 01:52:06 -0500 Subject: [PATCH] fix: more robust network handling --- src/provision.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/provision.sh b/src/provision.sh index fe95476..2e12a58 100644 --- a/src/provision.sh +++ b/src/provision.sh @@ -1,12 +1,12 @@ #!/bin/bash set -eEux -trap 'echo "[vibebox][error] provisioning failed"; echo "VIBEBOX_PROVISION_FAILED"; systemctl poweroff || true; exit 1' ERR +trap 'rc=$?; echo "[vibebox][error] provisioning failed at: ${BASH_COMMAND} (exit ${rc})"; echo "VIBEBOX_PROVISION_FAILED"; systemctl poweroff || true; exit 1' ERR # Wait for network + DNS before apt-get to avoid early boot flakiness. wait_for_network() { echo "[vibebox] waiting for network/DNS readiness" - local deadline=$((SECONDS + 60)) + local deadline=$((SECONDS + 180)) while [ "$SECONDS" -lt "$deadline" ]; do local has_route=0 if ip -4 route show default >/dev/null 2>&1; then @@ -21,7 +21,7 @@ wait_for_network() { fi sleep 1 done - echo "[vibebox][warn] network/DNS still not ready after 60s; continuing" >&2 + echo "[vibebox][warn] network/DNS still not ready after 180s; continuing" >&2 echo "[vibebox][warn] /etc/resolv.conf:" >&2 cat /etc/resolv.conf >&2 || true ip -br addr >&2 || true @@ -44,9 +44,9 @@ apt_update_with_retries() { } # Don't wait too long for slow mirrors. -echo 'Acquire::http::Timeout "2";' | tee /etc/apt/apt.conf.d/99timeout -echo 'Acquire::https::Timeout "2";' | tee -a /etc/apt/apt.conf.d/99timeout -echo 'Acquire::Retries "2";' | tee -a /etc/apt/apt.conf.d/99timeout +echo 'Acquire::http::Timeout "10";' | tee /etc/apt/apt.conf.d/99timeout +echo 'Acquire::https::Timeout "10";' | tee -a /etc/apt/apt.conf.d/99timeout +echo 'Acquire::Retries "5";' | tee -a /etc/apt/apt.conf.d/99timeout wait_for_network apt_update_with_retries