microvm-rootfs: add git, drop socat + standalone init - #262
Conversation
The in-guest minimald session bring-up inits a minimal context that shells out to git. Without git in the runtime closure, an interactive `minimal attach` (PTY shell) fails at session bring-up with: init of minimal context: The git command was not found in path The non-interactive exec path is unaffected (it skips the context init), which is why this surfaced only once interactive attach was wired up on the client. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe microVM rootfs build spec replaces Changesmicrovm-rootfs runtime closure and build script cleanup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
socat was only used by the package's own /sbin/microvm-init: a standalone block-root bring-up that wrote the READY marker on vsock 7350 and ran an echo server on 2222. The minvmd flow never runs it — minimald ships as the initramfs pid-1, mounts this image and chroots in, writes READY itself, and serves SSH directly on vsock 2222 (run_on_vsock, libkrun >= 1.19, no relay). minvmd has no socat-relay fallback. Remove socat from runtime_deps and delete the now-dead microvm-init stub + its etc/microvm manifest, leaving a pure userland (base + git). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/microvm-rootfs/build.sh (1)
45-52:⚠️ Potential issue | 🟠 Major | ⚡ Quick winEnsure
/bin/bashexists for minimald.Line 45 says minimald runs
/bin/bash, but the/usr/bin/bashfallback only creates/bin/sh. In a usr-only layout, the image builds without/bin/bashand shell session startup fails after chroot.Proposed fix
-# Guarantee /bin/sh: the in-guest minimald chroots in and runs /bin/bash, but a -# /bin/sh is conventional for any script the session shells out to. -if [ ! -e "$STAGE/bin/sh" ]; then - if [ -e "$STAGE/bin/bash" ]; then - ln -sf bash "$STAGE/bin/sh" - elif [ -e "$STAGE/usr/bin/bash" ]; then - ln -sf ../usr/bin/bash "$STAGE/bin/sh" - fi +# Guarantee /bin/bash for minimald and /bin/sh for scripts it shells out to. +if [ ! -e "$STAGE/bin/bash" ]; then + if [ -e "$STAGE/usr/bin/bash" ]; then + ln -sf ../usr/bin/bash "$STAGE/bin/bash" + else + echo "ERROR: bash not found in staged rootfs; minimald expects /bin/bash" >&2 + exit 1 + fi +fi +if [ ! -e "$STAGE/bin/sh" ]; then + ln -sf bash "$STAGE/bin/sh" fi🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/microvm-rootfs/build.sh` around lines 45 - 52, The code only ensures /bin/sh exists but minimald requires /bin/bash to be present. In the usr-only layout fallback case (the elif block checking for $STAGE/usr/bin/bash), add an additional symlink creation that creates /bin/bash pointing to ../usr/bin/bash, similar to how /bin/sh is created. This ensures both /bin/sh and /bin/bash are available for minimald to use when starting shell sessions after chroot.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/microvm-rootfs/build.sh`:
- Around line 45-52: The code only ensures /bin/sh exists but minimald requires
/bin/bash to be present. In the usr-only layout fallback case (the elif block
checking for $STAGE/usr/bin/bash), add an additional symlink creation that
creates /bin/bash pointing to ../usr/bin/bash, similar to how /bin/sh is
created. This ensures both /bin/sh and /bin/bash are available for minimald to
use when starting shell sessions after chroot.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3300467e-3584-4597-9b5c-58d8c5b4d0c0
📒 Files selected for processing (2)
packages/microvm-rootfs/build.nclpackages/microvm-rootfs/build.sh
Align the
microvm-rootfsruntime closure with the minimald-initramfs flow: it now shipsbase + git, droppingsocatand the vestigial standalone bring-up.Commits
add git to runtime deps — the in-guest minimald session bring-up inits a minimal context that shells out to
git. Without it, interactiveminimal attach(PTY shell) fails at session bring-up withinit of minimal context: The git command was not found in path(minimald/src/session.rs:26). The non-interactive exec path is unaffected (it skips the context init).drop socat + the standalone bring-up init —
socatwas used only by the package's own/sbin/microvm-init(block-root bring-up: READY marker on vsock 7350, echo server on 2222). The minvmd flow never runs it — minimald ships as the initramfs pid-1, mounts this image and chroots in, writes READY itself, and serves SSH directly on vsock 2222 (run_on_vsock, libkrun ≥1.19, no relay). minvmd has no socat-relay fallback. Removes the dep, themicrovm-initstub, and theetc/microvmmanifest.Net result
runtime_deps = [ base, git ]; image is a pure userland with no standalone init (the minimald initramfs is the init).Verification
minimal check --packages microvm-rootfspasses (parse, imports, import-line, fmt, naming, build-script). Local materialize + boot validation: see originating session.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Chores
Refactor