Skip to content

fix(#433): verify amd64 emulation on Apple Silicon + start colima with VZ/Rosetta - #524

Merged
shujaatTracebloc merged 3 commits into
developfrom
fix/433-apple-silicon-emulation
Jul 31, 2026
Merged

fix(#433): verify amd64 emulation on Apple Silicon + start colima with VZ/Rosetta#524
shujaatTracebloc merged 3 commits into
developfrom
fix/433-apple-silicon-emulation

Conversation

@shujaatTracebloc

@shujaatTraceblocshujaatTracebloc commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

#433 — Apple Silicon: amd64 emulation assumed but never verified; colima lacked Rosetta

The client images are amd64-only. On Apple Silicon the installer just printed a note and proceeded, assuming Docker Desktop's emulation works — so with "Use Rosetta for x86_64/amd64 emulation" off (or colima in play), pods crash-loop with an exec-format error minutes later, no preflight/setup catch. The headless colima path was worse: colima start passed no arch/Rosetta flags → an arm64 VM running amd64 images under slow QEMU or not at all.

Fix

1. Post-Docker smoke — assert_amd64_emulation (setup-macos.sh)
Once Docker is confirmed up, force-run a tiny amd64 binary:

docker run --rm --platform linux/amd64 busybox:1.36 true

On failure, hard-fail naming the exact setting (Docker Desktop → Settings → General → "Use Rosetta for x86_64/amd64 emulation") and the colima remedy — so it's caught at setup, never as a crash-looping pod. Wired into install_macos right after Docker readiness. Intel Macs skip it (native amd64); TRACEBLOC_ALLOW_ARM64 is the escape hatch; image overridable via TB_AMD64_SMOKE_IMAGE.

2. colima VZ/Rosetta — _install_docker_colima
On Apple Silicon + macOS 13+ (VZ available), start colima with --vm-type vz --vz-rosetta for Rosetta-accelerated amd64 (matches Docker Desktop's Rosetta). Older macOS keeps colima's QEMU default (amd64 still runs, just slower — and the smoke catches a truly-broken setup either way). New _macos_supports_vz helper (TB_MACOS_VER-overridable). bash-3.2-safe: the colima arg vector is never empty, so "${_colima_args[@]}" is safe under set -u.

3. Preflight message — _pf_arch
The macOS arch note now names the Rosetta setting and says the real check runs once Docker is up, instead of "assume it works".

Acceptance criteria

  • ✅ Apple Silicon with emulation disabled is caught at setup with the named setting — never as a crash-looping pod later.

Tests / gates

Closes#433


Note

Medium Risk
Changes macOS installer bootstrap and Colima VM creation flags; failures are intentional early exits, but headless/Apple Silicon install paths are directly affected.

Overview
Apple Silicon installs no longer assume amd64 client images will run. Preflight now names Docker Desktop’s “Use Rosetta for x86_64/amd64 emulation” setting and says the real check happens once Docker is up, instead of implying emulation already works.

After Docker is ready, assert_amd64_emulation runs a time-bounded docker run --platform linux/amd64 smoke test and hard-fails with Docker Desktop and Colima remediation steps (or honors TRACEBLOC_ALLOW_ARM64). Intel Macs skip the probe.

On headless Colima paths, fresh Apple Silicon VMs on macOS 13+ start with --vm-type vz --vz-rosetta; existing VMs are left unchanged so Colima doesn’t reject a vmType change. Helpers gate VZ support and instance detection.

New setup-macos-arch.bats and an updated preflight test cover these behaviors; manifest.sha256 is refreshed.

Reviewed by Cursor Bugbot for commit 1f172ab. Bugbot is set up for automated code reviews on this repo. Configure here.

…h VZ/Rosetta
The client images are amd64-only. On Apple Silicon the installer merely printed a
note and proceeded, ASSUMING Docker Desktop's emulation works — so if "Use Rosetta
for x86_64/amd64 emulation" is off (or colima lacks it), the images crash-loop with
an exec-format error minutes later, with no preflight/setup catch. The headless
colima path was worse: `colima start` passed no arch/Rosetta flags, so an Apple
Silicon Mac got an arm64 VM running amd64 images under slow QEMU or not at all.
- assert_amd64_emulation (setup-macos.sh): post-Docker smoke — force-run a tiny amd64
binary (`docker run --rm --platform linux/amd64 busybox:1.36 true`) once Docker is
up, and HARD-FAIL naming the exact Docker Desktop setting + the colima remedy, so
the problem is caught at setup, never as a crash-looping pod. Wired into install_macos
right after Docker is confirmed ready. Intel Macs skip it (native amd64);
TRACEBLOC_ALLOW_ARM64 is the escape hatch; image overridable via TB_AMD64_SMOKE_IMAGE.
- _install_docker_colima: on Apple Silicon + macOS 13+ (VZ), start colima with
`--vm-type vz --vz-rosetta` for Rosetta-accelerated amd64 (matches Docker Desktop's
Rosetta setting); older macOS keeps the QEMU default. bash-3.2-safe: the arg vector
is never empty. New _macos_supports_vz helper (TB_MACOS_VER-overridable).
- _pf_arch (preflight.sh): the macOS note now NAMES the Rosetta setting and says the
real check runs once Docker is up — instead of "assume it works".
Tests: new scripts/tests/setup-macos-arch.bats (VZ detection, colima flag matrix,
smoke pass/fail/skip/override) + a preflight.bats assertion on the named setting.
Separate test file from setup-macos.bats to avoid a file-add clash with #429/#521.
shellcheck/style/drift clean; manifest regenerated; preflight.bats (82) green.
Closes#433
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shujaatTraceblocshujaatTracebloc self-assigned this Jul 31, 2026
@shujaatTracebloc
shujaatTracebloc marked this pull request as ready for review July 31, 2026 14:31
…con-emulation
# Conflicts:
#	scripts/manifest.sha256

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9bf1513. Configure here.

Comment threadscripts/lib/setup-macos.sh
Comment threadscripts/lib/setup-macos.sh Outdated
…64 smoke (Bugbot)
Two Bugbot findings on the Apple Silicon work:
1. (High) colima refuses to change vmType on an EXISTING instance, so unconditionally
appending --vm-type vz --vz-rosetta aborted `colima start` on a prior QEMU VM (from
an earlier install or reboot) with a generic failure. Only request VZ+Rosetta on a
FRESH start now (new _colima_instance_exists via `colima list --json`); a pre-existing
VM starts as-is, and if its amd64 emulation is broken the post-Docker smoke already
names the `colima delete && colima start --vm-type vz --vz-rosetta` recreate remedy.
2. (Medium) assert_amd64_emulation ran `docker run` via unbounded spin_cmd — a wedged
daemon or stuck pull could hang a headless install forever. Switched to
spin_cmd_bounded (TB_AMD64_SMOKE_TIMEOUT, default 120s); a 124 timeout falls through
to the same remediation, per the installer's every-docker-call-is-bounded rule.
Tests: +existing-VM colima test (no VZ flags), + bounded-smoke assertion; 11/11 in
setup-macos-arch.bats. shellcheck/style/drift clean; manifest regenerated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shujaatTracebloc
shujaatTracebloc merged commit f772e62 into developJul 31, 2026
37 checks passed
@shujaatTracebloc
shujaatTracebloc deleted the fix/433-apple-silicon-emulation branch July 31, 2026 15:02
@LukasWodka

Copy link
Copy Markdown
Contributor

/fr-pass

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@shujaatTracebloc@LukasWodka@aptracebloc