Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(images): keep the VM image's apt sources; cloud-init wrote UNAVAILABLE suites (#5916)

ddupont8d1d6b09a5d5
diff --git a/libs/images/common/boot-qemu.sh b/libs/images/common/boot-qemu.sh
index 8ba5a94602..1c30d05e21 100755
--- a/libs/images/common/boot-qemu.sh
+++ b/libs/images/common/boot-qemu.sh
@@ -40,7 +40,9 @@ DISK="${1:?disk.img}"; shift
host_arch() { case "$(uname -m)" in arm64|aarch64) echo arm64 ;; *) echo amd64 ;; esac; }
ARCH="$(host_arch)"; MEM=4G; SMP=4; FWD="3211,22"; PROBE=""; RFB_OUT=""
CLAIM_DIR=""; RUN_CMD=""
-SSH=0; SSH_CMD='uname -a; systemctl is-system-running || true; systemctl --no-pager --plain list-units "cua-*"'; ENV_TOKEN=""; TIMEOUT=300; LOG=""; KEEP=0; UEFI=0
+# The default SSH check also fails when cloud-init rewrote apt's sources with
+# a release it could not read ("UNAVAILABLE"), which breaks apt-get.
+SSH=0; SSH_CMD='uname -a; systemctl is-system-running || true; systemctl --no-pager --plain list-units "cua-*"; if grep -rsl UNAVAILABLE /etc/apt/sources.list /etc/apt/sources.list.d/; then echo "apt sources name no release (UNAVAILABLE)" >&2; exit 1; fi'; ENV_TOKEN=""; TIMEOUT=300; LOG=""; KEEP=0; UEFI=0
while [ $# -gt 0 ]; do
case "$1" in
--arch) ARCH="$2"; shift 2 ;;
diff --git a/libs/images/common/vm/files/99-cua-cloud.cfg b/libs/images/common/vm/files/99-cua-cloud.cfg
index 4f6d3c6b72..e37fa0af80 100644
--- a/libs/images/common/vm/files/99-cua-cloud.cfg
+++ b/libs/images/common/vm/files/99-cua-cloud.cfg
@@ -13,3 +13,9 @@ ssh_pwauth: false
preserve_hostname: false
growpart: {mode: auto, devices: ["/"]}
resize_rootfs: true
+# The image's apt sources are final. Left to manage them, cloud-init rewrites
+# /etc/apt/sources.list.d/ubuntu.sources from its template on first boot with
+# the release it reads from lsb_release; the image has no lsb_release, so the
+# suites came out as "UNAVAILABLE" and apt-get update failed in every VM.
+apt:
+ preserve_sources_list: true