[multipass] improve support for arm64 #5
|
|
@ -33,14 +33,16 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
DPKG_ARCH="$(dpkg --print-architecture)"
|
||||
# Debian 13 (Trixie) official cloud image (qcow2). Multipass can launch from URL/file:// on Linux.
|
||||
# Source: Debian cloud images live under cloud.debian.org/images/cloud/ ('genericcloud' includes cloud-init).
|
||||
DEBIAN13_IMAGE_URL="${DEBIAN13_IMAGE_URL:-https://cloud.debian.org/images/cloud/trixie/latest/debian-13-genericcloud-amd64.qcow2}"
|
||||
DEBIAN13_IMAGE_URL="${DEBIAN13_IMAGE_URL:-https://cloud.debian.org/images/cloud/trixie/latest/debian-13-genericcloud-${DPKG_ARCH}.qcow2}"
|
||||
|
||||
IMAGE="${IMAGE:-24.04}"
|
||||
BASE="${BASE:-ubu2404}"
|
||||
COUNT="${COUNT:-1}"
|
||||
CPUS="${CPUS:-3}"
|
||||
[ "$DPKG_ARCH" = "arm64" ] && CPUS="${CPUS:-2}" # SBC don't have spare CPUs.
|
||||
[ "$DPKG_ARCH" = "amd64" ] && CPUS="${CPUS:-3}"
|
||||
MEM="${MEM:-4G}"
|
||||
DISK="${DISK:-20G}"
|
||||
|
||||
|
|
@ -53,6 +55,8 @@ LOCAL_VARS_URL="${LOCAL_VARS_URL:-https://raw.githubusercontent.com/iiab/iiab/re
|
|||
WAIT_TRIES="${WAIT_TRIES:-60}" # used ONLY for the first auto-resume
|
||||
WAIT_SLEEP="${WAIT_SLEEP:-5}"
|
||||
STAGGER="${STAGGER:-20}"
|
||||
RESUME_TRIES="${RESUME_TRIES:-3}"
|
||||
RESUME_RETRY_SLEEP="${RESUME_RETRY_SLEEP:-8}"
|
||||
|
||||
ACTION="run"
|
||||
modules=()
|
||||
|
|
@ -92,7 +96,7 @@ PR options:
|
|||
--run-pr N Add PR number and force --run
|
||||
|
||||
Env:
|
||||
IMAGE BASE COUNT CPUS MEM DISK IIAB_PR IIAB_FAST LOCAL_VARS_URL WAIT_TRIES WAIT_SLEEP STAGGER
|
||||
IMAGE BASE COUNT CPUS MEM DISK IIAB_PR IIAB_FAST LOCAL_VARS_URL WAIT_TRIES WAIT_SLEEP STAGGER RESUME_TRIES RESUME_RETRY_SLEEP
|
||||
EOF
|
||||
}
|
||||
|
||||
|
|
@ -439,17 +443,56 @@ resume_iiab() {
|
|||
fi
|
||||
fi
|
||||
|
||||
# Retry on rc=255 (SSH connection dropped; often reboot/network restart during apt/upgrade)
|
||||
# Also neutralize apt-listchanges/pagers to avoid "Waiting for data..." stalls.
|
||||
local attempt r
|
||||
r=1
|
||||
for attempt in $(seq 1 "$RESUME_TRIES"); do
|
||||
echo "[INFO] Resume attempt ${attempt}/${RESUME_TRIES} on $vm"
|
||||
|
||||
multipass exec "$vm" -- bash -lc '
|
||||
set -euo pipefail
|
||||
echo "--- resume: sudo iiab -f ---"
|
||||
if command -v iiab >/dev/null 2>&1; then
|
||||
sudo iiab -f
|
||||
else
|
||||
echo "[ERROR] iiab command not found; install likely not finished."
|
||||
echo "--- resume: sudo /usr/sbin/iiab -f ---"
|
||||
|
||||
if ! sudo test -x /usr/sbin/iiab; then
|
||||
echo "[ERROR] /usr/sbin/iiab not found/executable; install likely not finished."
|
||||
exit 89
|
||||
fi
|
||||
|
||||
# Avoid interactive/pager behaviour during apt actions that IIAB may trigger.
|
||||
# (apt-listchanges commonly causes: "Waiting for data... (interrupt to abort)")
|
||||
sudo env \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
APT_LISTCHANGES_FRONTEND=none \
|
||||
NEEDRESTART_MODE=a \
|
||||
TERM=dumb \
|
||||
PAGER=cat \
|
||||
/usr/sbin/iiab -f
|
||||
|
||||
echo "--- resume done ---"
|
||||
'
|
||||
|
||||
r=$?
|
||||
if [[ "$r" -eq 0 ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ "$r" -eq 255 ]]; then
|
||||
echo "[WARN] multipass exec rc=255 (connection dropped; likely reboot). Waiting for VM and retrying..."
|
||||
if ! wait_for_vm "$vm"; then
|
||||
echo "[ERROR] VM did not become ready after reconnect wait: $vm"
|
||||
r=88
|
||||
break
|
||||
fi
|
||||
sleep "$RESUME_RETRY_SLEEP"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Any other non-zero: don't loop forever.
|
||||
break
|
||||
done
|
||||
|
||||
exit "$r"
|
||||
} >"$log" 2>&1
|
||||
echo "$?" >"$rc"
|
||||
set -e
|
||||
|
|
|
|||
Loading…
Reference in New Issue