feat(smolmachines): run backend on Linux #284
Reference in New Issue
Block a user
Delete Branch "prd-smolmachines-linux"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #283.
PRD: prd-new-smolmachines-linux.md
Summary
Makes the
smolmachinesbackend runnable on Linux (KVM), not just macOS.smolvm/libkrun already support Linux via/dev/kvm; the gap was entirely in bot-bottle's host-side glue, which hard-coded macOS assumptions. Three fixes:smolmachines_preflightnow checks/dev/kvmis present and accessible, distinguishing "KVM not enabled" (loadkvm-intel/kvm-amd) from "no permission" (join thekvmgroup). macOS is unaffected.force_allowlistpreviously no-oped on Linux, failing open — the agent VM's egress allowlist was never enforced. It now runs on both platforms, derives the smolvm state-DB path per-OS (XDG on Linux), only patches when the persisted allowlist doesn't already match, and dies rather than booting a VM whose/32confinement it can't confirm (DB missing, row missing, or patch didn't take). This is a strict improvement on macOS too (the old code wrote unconditionally and never verified).allocatereturned the shared127.0.0.1on Linux (no isolation between bottles/host services). It now does the same per-bottle127.0.0.<N>/32allocation as macOS — and since all of127.0.0.0/8is already loopback on Linux, this needs noifconfig/sudo step. Onlyensure_pool'slo0aliasing stays macOS-only.README gains a Linux + NixOS host-setup section.
Testing
force_allowlist(DB/row missing, patch-doesn't-take, skip-when-matching), per-bottle Linux allocation + locking, and the platform-derived DB path.pyrightclean;pylint9.69/10.Pending verification (cannot run on the macOS dev box)
The author worked on macOS (
darwin, no/dev/kvm), so the Linux/KVM acceptance gate could not be executed here. Before merge, the following need to run on a NixOS/Linux host with/dev/kvm:tests/integration/test_sandbox_escape.pyagainstBOT_BOTTLE_BACKEND=smolmachines(the security acceptance gate).~/.local/share/smolvm/server/smolvm.db(if not, the fail-closed check turns it into a clear launch-time error, not a silent escape).smolvmbuild still drops--allow-cidrwith--from(the fail-closed design handles either answer).See the PRD's "Open questions / verification pending" section for detail.
a4413406dfto49c2ed0b93View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.