fix: make gosu install architecture-aware (ARM64 support) - #874
Conversation
The gosu binary URL was hardcoded to `gosu-amd64`, causing `exec format error` (exit 126) on ARM64/aarch64 hosts (e.g. AWS Graviton t4g instances). Changes: - Use `dpkg --print-architecture` to download the correct binary - Fetch SHA256SUMS from the gosu release instead of hardcoding the amd64 checksum, so verification works on any architecture
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Dockerfile's gosu installation was changed to detect architecture with Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Dockerfile (1)
30-33: Fail fast on unsupported architectures and tighten checksum matchPlease add an explicit arch allowlist (
amd64|arm64) before download, and use a stricter checksum-line pattern so build failures are clearer and matching is exact.Proposed hardening patch
-RUN GOSU_ARCH="$(dpkg --print-architecture)" \ +RUN GOSU_ARCH="$(dpkg --print-architecture)" \ + && case "$GOSU_ARCH" in amd64|arm64) ;; *) echo "Unsupported gosu arch: $GOSU_ARCH" >&2; exit 1 ;; esac \ && curl -fsSL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.19/gosu-${GOSU_ARCH}" \ && curl -fsSL -o /tmp/gosu-checksums.txt "https://github.com/tianon/gosu/releases/download/1.19/SHA256SUMS" \ - && grep "gosu-${GOSU_ARCH}$" /tmp/gosu-checksums.txt | sha256sum -c - \ + && grep -E "^[a-f0-9]{64}[[:space:]]+gosu-${GOSU_ARCH}$" /tmp/gosu-checksums.txt | sha256sum -c - \ && rm /tmp/gosu-checksums.txt \🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Dockerfile` around lines 30 - 33, The Dockerfile currently computes GOSU_ARCH and downloads gosu without validating the architecture or strictly matching the checksum line; update the RUN block that sets GOSU_ARCH and calls curl to first validate GOSU_ARCH against an allowlist (amd64|arm64) and exit non-zero on mismatch, then download gosu and the SHA256SUMS and verify using a stricter grep pattern that anchors the exact filename (e.g., grep -E "^[0-9a-f]{64}[[:space:]]+gosu-${GOSU_ARCH}$") or equivalent so the checksum line matches exactly; ensure the failure paths (unsupported arch or checksum mismatch) immediately stop the build.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@Dockerfile`:
- Around line 30-33: The Dockerfile currently computes GOSU_ARCH and downloads
gosu without validating the architecture or strictly matching the checksum line;
update the RUN block that sets GOSU_ARCH and calls curl to first validate
GOSU_ARCH against an allowlist (amd64|arm64) and exit non-zero on mismatch, then
download gosu and the SHA256SUMS and verify using a stricter grep pattern that
anchors the exact filename (e.g., grep -E
"^[0-9a-f]{64}[[:space:]]+gosu-${GOSU_ARCH}$") or equivalent so the checksum
line matches exactly; ensure the failure paths (unsupported arch or checksum
mismatch) immediately stop the build.
The gosu binary URL was hardcoded to `gosu-amd64`, causing `exec format error` (exit 126) on ARM64/aarch64 hosts (e.g. AWS Graviton t4g instances). Changes: - Use `dpkg --print-architecture` to select the correct binary - Pinned SHA-256 checksums for both amd64 and arm64 - Fail fast with clear error on unsupported architectures
48a6576 to
5aa6fb5
Compare
|
Duplicate of #861 |
Summary
The gosu binary URL in the Dockerfile is hardcoded to
gosu-amd64, causingexec format error(exit code 126) when building on ARM64/aarch64 hosts (e.g. AWS Gravitont4ginstances).Changes
dpkg --print-architectureto download the correct gosu binary (gosu-amd64orgosu-arm64)SHA256SUMSfrom the gosu release instead of hardcoding the amd64 checksum, so verification works on any architectureBefore (broken on ARM64)
After (works on both amd64 and arm64)
Testing
Tested on AWS EC2
t4g.medium(ARM64 Graviton):nemoclaw onboardcompletes successfully withgosu-arm64, sandbox reaches Ready state.Introduced in #721.
Summary by CodeRabbit