Skip to content

fix: make gosu install architecture-aware (ARM64 support) - #874

Closed
iForests wants to merge 2 commits into
NVIDIA:mainfrom
iForests:fix/gosu-arm64-compat
Closed

fix: make gosu install architecture-aware (ARM64 support)#874
iForests wants to merge 2 commits into
NVIDIA:mainfrom
iForests:fix/gosu-arm64-compat

Conversation

@iForests

@iForests iForests commented Mar 25, 2026

Copy link
Copy Markdown

Summary

The gosu binary URL in the Dockerfile is hardcoded to gosu-amd64, causing exec format error (exit code 126) when building on ARM64/aarch64 hosts (e.g. AWS Graviton t4g instances).

Changes

  • Use dpkg --print-architecture to download the correct gosu binary (gosu-amd64 or gosu-arm64)
  • Fetch SHA256SUMS from the gosu release instead of hardcoding the amd64 checksum, so verification works on any architecture

Before (broken on ARM64)

RUN curl -fsSL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.19/gosu-amd64" \
    && echo "52c8749d...  /usr/local/bin/gosu" | sha256sum -c - \

After (works on both amd64 and arm64)

RUN GOSU_ARCH="$(dpkg --print-architecture)" \
    && 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 - \

Testing

Tested on AWS EC2 t4g.medium (ARM64 Graviton): nemoclaw onboard completes successfully with gosu-arm64, sandbox reaches Ready state.

Introduced in #721.

Summary by CodeRabbit

  • Chores
    • Build/install now detects CPU architecture and selects the appropriate helper binary automatically, improving cross-platform compatibility.
    • Downloads are verified against the corresponding upstream checksums at install time to ensure integrity.
    • The build fails explicitly on unsupported architectures and removes temporary verification artifacts after installation, improving reliability and safety.

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
@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 11bde572-c1d8-4e67-9de0-b8fd429a48c5

📥 Commits

Reviewing files that changed from the base of the PR and between 48a6576 and 5aa6fb5.

📒 Files selected for processing (1)
  • Dockerfile
🚧 Files skipped from review as they are similar to previous changes (1)
  • Dockerfile

📝 Walkthrough

Walkthrough

The Dockerfile's gosu installation was changed to detect architecture with dpkg --print-architecture, pick the matching gosu binary and SHA-256 via a case statement, fail on unsupported arches, verify the download by piping the selected checksum into sha256sum -c -, then chmod +x and run gosu --version.

Changes

Cohort / File(s) Summary
gosu Installation Update
Dockerfile
Replaced fixed gosu-amd64 install with an architecture-aware flow: determine GOSU_ARCH via dpkg --print-architecture, use a case to choose download URL and corresponding SHA-256 for amd64 or arm64, error on unsupported arch, verify the downloaded binary by piping the chosen checksum into sha256sum -c -, then chmod +x and run gosu --version.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰
I sniff the arch, then choose my treat,
amd64 or arm64 — both neat.
I check the sum, then hop away,
Clean paws, green grass, and build hooray! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making gosu install architecture-aware with ARM64 support, which directly addresses the core problem in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
Dockerfile (1)

30-33: Fail fast on unsupported architectures and tighten checksum match

Please 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d50900cc-adb6-4574-bb9f-dca000399429

📥 Commits

Reviewing files that changed from the base of the PR and between cec1e42 and 4e57a47.

📒 Files selected for processing (1)
  • Dockerfile

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
@iForests
iForests force-pushed the fix/gosu-arm64-compat branch from 48a6576 to 5aa6fb5 Compare March 25, 2026 06:29
@cv

cv commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

Duplicate of #861

@cv cv closed this Mar 25, 2026
@wscurran wscurran added the bug-fix PR fixes a bug or regression label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants