Skip to content

Make rootfs hook chown best-effort for macOS support#7

Merged
JAORMX merged 2 commits into
mainfrom
fix/best-effort-chown-macos
Mar 3, 2026
Merged

Make rootfs hook chown best-effort for macOS support#7
JAORMX merged 2 commits into
mainfrom
fix/best-effort-chown-macos

Conversation

@JAORMX
Copy link
Copy Markdown
Contributor

@JAORMX JAORMX commented Mar 3, 2026

Summary

On macOS, non-root users cannot os.Chown to a different UID, causing VM startup to fail. The guest init now handles authoritative ownership fixup as PID 1, so the host-side chown only needs to be best-effort.

Test plan

  • task fmt && task lint && task test passes
  • Existing recordingChown tests pass unchanged (mock returns nil)
  • Manual: run bbox on macOS as non-root — VM boots, SSH connects, git config and MCP configs readable by sandbox user

Depends on: stacklok/go-microvm#7

🤖 Generated with Claude Code

JAORMX and others added 2 commits March 3, 2026 12:43
After each session, per-VM log directories at
~/.config/broodbox/vms/<name>/ persist indefinitely when the process
crashes or is killed. The data/ subdirectory is cleaned by propolis
via WithCleanDataDir(), but the parent directory and broodbox.log
accumulate as orphans.

Add PID-sentinel-based cleanup following the exact pattern from
CleanupStaleSnapshots: write a .bbox-sentinel file when creating the
log directory, then scan for stale directories on CLI startup where
the owning process has died.

Extract isProcessAlive into a shared internal/infra/process package
so both workspace snapshot cleanup and VM log cleanup use the same
implementation without duplication.

Closes #5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace os.Chown with bestEffortLchown in InjectGitConfig and
InjectMCPConfig hooks. On macOS, non-root users cannot chown files
to a different UID, causing VM startup to fail with EPERM.

bestEffortLchown uses os.Lchown (symlink-safe) and swallows
permission errors. The guest init in propolis now handles
authoritative ownership fixup at boot time as PID 1.

Depends on stacklok/go-microvm#7.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JAORMX JAORMX merged commit ba5876c into main Mar 3, 2026
7 checks passed
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.

1 participant