on main help sign in
fix: more robust network handling
commita568295bd37fb03467d9e5f0a558459e265943b7 authorrobcholz <84130577+robcholz@users.noreply.github.com> dateMon 9 Feb 2026, 01:52 (8 months ago) parentb5cd1f2
1 file changed+6−6
src/provision.sh+6−6
src/provision.sh+6−6
@@ -1,12 +1,12 @@
11#!/bin/bash
22set -eEux
33
4−trap 'echo "[vibebox][error] provisioning failed"; echo "VIBEBOX_PROVISION_FAILED"; systemctl poweroff || true; exit 1' ERR
4+trap 'rc=$?; echo "[vibebox][error] provisioning failed at: ${BASH_COMMAND} (exit ${rc})"; echo "VIBEBOX_PROVISION_FAILED"; systemctl poweroff || true; exit 1' ERR
55
66# Wait for network + DNS before apt-get to avoid early boot flakiness.
77wait_for_network() {
88 echo "[vibebox] waiting for network/DNS readiness"
9− local deadline=$((SECONDS + 60))
9+ local deadline=$((SECONDS + 180))
1010 while [ "$SECONDS" -lt "$deadline" ]; do
1111 local has_route=0
1212 if ip -4 route show default >/dev/null 2>&1; then
@@ -21,7 +21,7 @@ wait_for_network() {
2121 fi
2222 sleep 1
2323 done
24− echo "[vibebox][warn] network/DNS still not ready after 60s; continuing" >&2
24+ echo "[vibebox][warn] network/DNS still not ready after 180s; continuing" >&2
2525 echo "[vibebox][warn] /etc/resolv.conf:" >&2
2626 cat /etc/resolv.conf >&2 || true
2727 ip -br addr >&2 || true
@@ -44,9 +44,9 @@ apt_update_with_retries() {
4444}
4545
4646# Don't wait too long for slow mirrors.
47−echo 'Acquire::http::Timeout "2";' | tee /etc/apt/apt.conf.d/99timeout
48−echo 'Acquire::https::Timeout "2";' | tee -a /etc/apt/apt.conf.d/99timeout
49−echo 'Acquire::Retries "2";' | tee -a /etc/apt/apt.conf.d/99timeout
47+echo 'Acquire::http::Timeout "10";' | tee /etc/apt/apt.conf.d/99timeout
48+echo 'Acquire::https::Timeout "10";' | tee -a /etc/apt/apt.conf.d/99timeout
49+echo 'Acquire::Retries "5";' | tee -a /etc/apt/apt.conf.d/99timeout
5050
5151wait_for_network
5252apt_update_with_retries