Skip to content

microvm-rootfs: add git, drop socat + standalone init - #262

Merged
norrietaylor merged 3 commits into
mainfrom
feat/microvm-rootfs-add-git
Jun 18, 2026
Merged

microvm-rootfs: add git, drop socat + standalone init#262
norrietaylor merged 3 commits into
mainfrom
feat/microvm-rootfs-add-git

Conversation

@norrietaylor

@norrietaylor norrietaylor commented Jun 17, 2026

Copy link
Copy Markdown
Member

Align the microvm-rootfs runtime closure with the minimald-initramfs flow: it now ships base + git, dropping socat and the vestigial standalone bring-up.

Commits

  1. add git to runtime deps — the in-guest minimald session bring-up inits a minimal context that shells out to git. Without it, interactive minimal attach (PTY shell) fails at session bring-up with init 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).

  2. drop socat + the standalone bring-up initsocat was 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, the microvm-init stub, and the etc/microvm manifest.

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-rootfs passes (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

    • Updated microVM rootfs build configuration and runtime dependencies.
    • Removed guest bring-up initialization script and manifest file generation from the build process.
  • Refactor

    • Refined staging and image pruning logic for improved rootfs generation.
    • Updated build documentation to reflect changes in initialization behavior.

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

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The microVM rootfs build spec replaces socat with git as the runtime dependency, updating the import and runtime_deps list. The build script removes generation of the in-image microvm-init bring-up script and etc/microvm/manifest contract file, drops staging of the etc/microvm directory, and fixes a libss/libssl glob collision in the pruning step.

Changes

microvm-rootfs runtime closure and build script cleanup

Layer / File(s) Summary
Runtime dependency: socat → git
packages/microvm-rootfs/build.ncl
Adds import for ../git/build.ncl and replaces socat with git in runtime_deps; inline docs updated to note that minimald shells out to git in-guest.
Build script: staging, pruning, and bring-up removal
packages/microvm-rootfs/build.sh
Removes creation of $STAGE/etc/microvm, the microvm-init bring-up init script, and the etc/microvm/manifest file. Fixes libss.so* glob to avoid matching libssl.so. Updates header and /bin/sh comments to reflect minimald chroot behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • gominimal/pkgs#229: This PR directly modifies the microvm-rootfs package introduced in #229, changing runtime_deps and removing the microvm-init/etc/microvm/manifest generation paths.
  • gominimal/pkgs#231: Both PRs update packages/microvm-rootfs/build.sh pruning to tighten the libss/e2fsprogs library globs to libss.so* to avoid accidental deletion of libssl.so.

Suggested reviewers

  • twitchyliquid64
  • mitodrummer

Poem

🐇 Hippity-hop, I swapped out socat,
Now git takes its place in the rootfs flat.
No manifest, no init to write,
The image stays slim, lean, and tight.
Less is more, says the rabbit! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main changes: adding git and removing socat plus the standalone init script from microvm-rootfs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/microvm-rootfs-add-git

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

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>
@norrietaylor norrietaylor changed the title feat(microvm-rootfs): add git to runtime deps microvm-rootfs: add git, drop socat + standalone init Jun 17, 2026
@norrietaylor
norrietaylor enabled auto-merge June 17, 2026 22:34

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

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 win

Ensure /bin/bash exists for minimald.

Line 45 says minimald runs /bin/bash, but the /usr/bin/bash fallback only creates /bin/sh. In a usr-only layout, the image builds without /bin/bash and 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8144780 and 4e3d141.

📒 Files selected for processing (2)
  • packages/microvm-rootfs/build.ncl
  • packages/microvm-rootfs/build.sh

@norrietaylor
norrietaylor added this pull request to the merge queue Jun 18, 2026
Merged via the queue into main with commit cd4f58f Jun 18, 2026
4 checks passed
@norrietaylor
norrietaylor deleted the feat/microvm-rootfs-add-git branch June 18, 2026 01:34
Sign up for free to 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.

2 participants