banger/internal/system
Thales Maciel 0e28504892
daemon: rewrite ensureWorkDisk no-seed path to skip the mount + cp
The no-seed branch used to mount the base rootfs read-only, mount
the freshly mkfs'd work disk read-write, sudo-cp /root from one to
the other, then flatten any accidental /root/root/ nesting. Five
sudo call sites packed into a fallback that the common image path
doesn't even exercise.

Replace with: `mkfs.ext4 -F -E root_owner=0:0` and nothing else.
mkfs already stamps inode 2 as root:root:0755 — sshd's StrictModes
walks that dir's ownership when the work disk mounts at /root in
the guest, so getting it right from mkfs means authsync can just
write authorized_keys without any repair pass.

Tradeoff: no-seed VMs lose the base rootfs's default /root dotfiles
(.bashrc, .profile). The no-seed path is explicitly the degraded
fallback — `banger doctor` already warns about it — and users who
want those back have two documented knobs: rebuild the image with
a work-seed, or land them via [[file_sync]].

Sudo call sites removed: 5 (MountTempDir × 2, sudo cp -a,
flattenNestedWorkHome's chmod/cp/rm). flattenNestedWorkHome itself
stays alive for now — authsync + image_seed still call it — and
gets deleted in commit 5 once its last caller goes away.

While here: fix the freshly-added EnsureExt4RootPerms helper.
`set_inode_field <2> mode N` overwrites the full i_mode word
instead of preserving the type nibble, so the initial
implementation that passed just the permission bits (0755) would
reset the fs root to regular-file shape and break the next kernel
mount with "Structure needs cleaning." The corrected call OR's in
S_IFDIR (0o040000) explicitly. Test updated to match.

Smoke: 21/21 scenarios green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 18:09:32 -03:00
..
ext4.go daemon: rewrite ensureWorkDisk no-seed path to skip the mount + cp 2026-04-23 18:09:32 -03:00
ext4_test.go daemon: rewrite ensureWorkDisk no-seed path to skip the mount + cp 2026-04-23 18:09:32 -03:00
extra_test.go coverage: easy-wins batch across cli, system, paths, vmdns, toolingplan 2026-04-18 17:57:05 -03:00
files.go Add experimental Void guest workflow and vsock agent 2026-03-19 14:51:25 -03:00
preflight.go Refactor VM lifecycle around capabilities 2026-03-18 19:28:26 -03:00
report.go Refactor VM lifecycle around capabilities 2026-03-18 19:28:26 -03:00
report_test.go Refactor VM lifecycle around capabilities 2026-03-18 19:28:26 -03:00
system.go daemon: fix vm start (on a stopped VM) + regression coverage 2026-04-23 12:01:46 -03:00
system_test.go Stop using kernel IP autoconfig for runtime VMs 2026-03-21 21:54:18 -03:00