Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/spark-supervisor/blob/main/docs/MIGRATION.md # spark-supervisor Process supervisor and health monitor for sovereign daemons Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `spark-supervisor / docs / MIGRATION.md` 157 lines ยท 16666 bytes Raw Blame History Rendered 1 # Migration off systemd units (Spark, 2026-10-26) 2 3 Status words: MIGRATED (runs under aien-supervise, systemd unit removed), READY (service file 4 written and its sandbox qualified, systemd unit still live), REMAINING (not moved, reason given). 5 Nothing below is MIGRATED yet: cutting a live service over is the owning lane's step, after its own 6 isolation tests pass under aien-supervise (see "Cutover" at the end). 7 8 ## 1. Inventory 9 10 Source: `systemctl --user list-unit-files`, `~/.config/systemd/user/`, and the files under 11 `/etc/systemd/system/` that no package owns (`dpkg -S`). Distribution units (gdm, pipewire, 12 snapd, dgx-dashboard, nut, ...) are not AIEN services and are out of scope. 13 14 ### System units (`/etc/systemd/system`) and supervised processes 15 16 | Service | Role | Risk | Order | Status, reason | 17 | --- | --- | --- | --- | --- | 18 | allen-chat (.service) | public Allen gateway, tailnet 18110 + console 18112 | high: public input | 1 | READY: `services/allen-chat.svc.example` (real addresses kept local); AllenChat reran its gateway probe and the nested compile-sandbox tests (17/17) under aien-supervise; cutover waits until AllenRelay finishes changing the unit and the file is synced to the final unit | 19 | allen-catalog (.service + .timer) | daily public GitHub read for Allen | low | 1 | READY: `services/allen-catalog.svc` (real run inside the sandbox wrote catalog.txt) | 20 | allen-contacts-ingest (.service + .path) | moves contact drops to the private store (.om binary) | medium: private data | 1 | READY: `services/allen-contacts-ingest.svc` (aien-watch trigger) | 21 | omega-projects-pusher (.service + .path) | files Allen items on aien-dev/omega-projects | medium: token | 1 | READY: `services/omega-projects-pusher.svc`; token not provisioned on this host (queues only); TPM-sealed credential delivery needs Drake's decision (see table 2) | 22 | cortex-visitors (no unit) | visitor memory, loopback 18096 | medium | 1 | was interim under the Rust `spark-supervisor`; now a user service of aien-supervise through the same `sudo -n` launcher; READY: `services/cortex-visitors.svc` | 23 | allen-relay-mailer (no unit) | Allen relay mail (allen-relay) | medium: mail password | 2 | REMAINING: password comes from atlas-vault through `runuser` on stdin; the root helper will not run operator programs; needs `secret` delivery decision | 24 | allen-science (planned) | science tools, loopback 18113 | medium | 2 | REMAINING: draft from AllenScience, validated when it lands | 25 | atlas-account-runtime, atlas-ingress | Atlas service account, ingress nft | medium | 4 | REMAINING: oneshot root setup (Type=oneshot, RemainAfterExit); needs a root-oneshot design, not a sandboxed service | 26 | atlas-private-storage, atlas-forgejo-storage | TPM unlock of LUKS volumes | high: storage keys | 5 | REMAINING: run as root with TPM access by design; out of the sandboxed-service model | 27 | atlas-forgejo (system) | Forgejo on Spark | medium | 4 | REMAINING: depends on the storage unlock units | 28 | atlas-max-flux, atlas-max-gemma, atlas-max-lightning | MAX model servers (inactive) | GPU | 6 | REMAINING: GPU services need the exclusive-window procedure; not touched | 29 | atlas-trueforge-mcp | MCP server (inactive) | low | 3 | REMAINING: inactive; migrate or delete with its owner | 30 | ollama | model server (vendor unit, not running) | GPU | 6 | REMAINING: GPU; vendor unit | 31 | spark-cleanup (.service + .timer), spark-cleanup-lowspace (.service + .timer) | disk cleanup as root | medium: deletes files | 4 | REMAINING: root jobs; candidate for a root-oneshot design or root cron | 32 | restart-resolved | restarts systemd-resolved early in boot | low | 7 | REMAINING: belongs to the distribution's boot order | 33 34 ### User units (`~/.config/systemd/user`) 35 36 | Service | Role | Risk | Order | Status, reason | 37 | --- | --- | --- | --- | --- | 38 | cortex | Cortex memory, Rust Axum, 18080 | high: shared memory | 3 | REMAINING: moves only through CortexOmega's cutover plan | 39 | hermes-gateway | messaging gateway | high: live | 3 | REMAINING: move at a safe point agreed with its owner | 40 | omp-collab-hub (.service + .timer) | the one collab room (tmux) | high: live room | 3 | REMAINING: never kill the live room; move at a safe point | 41 | hive-feed, hive-publish | Hive telemetry collector and publisher | low | 2 | REMAINING: low-risk user services, next batch (user-service files need no root) | 42 | xerj | local search | low | 2 | REMAINING: next batch | 43 | spark-cockpit, spark-mail | cockpit 18095, local mail 18092 | low | 2 | REMAINING: next batch; spark-mail has known clients | 44 | conduit | Matrix homeserver | low | 2 | REMAINING: next batch | 45 | atlas-authelia, atlas-olivetin | Atlas login and ops panel | medium | 3 | REMAINING: after Atlas owner review | 46 | atlas-repair, atlas-vault-context7, aien-context7-sync (+timer), atlas-harvest (+timer), atlas-forgejo-backup (+timer) | Atlas jobs (several failing) | low | 3 | REMAINING: owner review; failing units first need their failure understood | 47 | atlas-brain, atlas-cortex-max-encoder, atlas-forgejo, atlas-forgejo-web, atlas-forgejo-storage, atlas-rootless-docker | Atlas (disabled) | n/a | 8 | REMAINING: disabled; delete or migrate with owner | 48 | aien-mail | webmail, restart loop on an obsolete tailnet IP | low | 2 | REMAINING: fix the address first, then move | 49 | aien-astrosage, aien-lightning, aien-seat, drake-voice-telegram, drake-voice-web, forgejo-runner, gideon-bot, gamemoded | disabled or ad hoc | n/a | 8 | REMAINING: disabled; owner decides | 50 | nvpair, openclaw-heartbeat, radicle-node, spark-dream, spark-muse-bridge, spark-runner | assorted (radicle-node restart loop) | low | 2 | REMAINING: next batch after owner check | 51 | spark-worker-L*, run-u*, probe-tfs-* | transient `systemd-run` units, all failed | n/a | n/a | REMAINING: transient; stop creating them (use aien-supervise oneshots); `systemctl --user reset-failed` clears them | 52 53 Order: 1 = Allen (new services first), 2 = low-risk user services, 3 = live or owned elsewhere, 54 4..8 = root jobs, storage, GPU, distribution, disabled. 55 56 ## 2. Allen units: every directive 57 58 Mechanism column: B = bwrap argument built by aien-supervise-root, S = setpriv, F = seccomp 59 filter generated in Omega, C = cgroup v2 leaf, N = nftables table, P = prlimit on the helper, 60 D = daemon (aien-supervise), W = aien-watch. 61 Probe column: `tests/probe.py` check name (run by `tests/sandbox.sh`: confined in the sandbox) and 62 its negative control: U = reads `open` when the same probe runs as the same user without the 63 sandbox, M = reads `open` when that one directive is removed from the service file (mutation in 64 `tests/sandbox.sh`), K = the kernel also refuses it to any unprivileged process, so only the 65 filter result itself is shown. Allen's own probes were rerun in each service's exact sandbox with 66 `tests/twin.sh` (results under "Allen probes"). 67 68 | Directive (unit) | aien-supervise mechanism | Probe | Negative control | 69 | --- | --- | --- | --- | 70 | Type=simple / oneshot (all) | D `type` | user.sh | user.sh | 71 | ExecStart (all) | D/S/B `exec`, program root-owned (helper refuses others) | sandbox.sh E "exec under /tmp", "symlink" | refusal cases | 72 | User=, Group= (all) | S `--reuid/--regid`; uid 1..999 | User | K (sandbox.sh E: user root, uid 1000 refused) | 73 | SupplementaryGroups= (chat, pusher) | S `--groups` from `groups` + checked initgroups | gw probe: create in spool-in/contacts-drop ALLOWED | sandbox.sh E: docker group refused | 74 | EnvironmentFile= (chat) | B `--setenv` from root-owned file (values never in argv) | (gateway starts with its token) | n/a | 75 | Environment= (all) | B `--setenv`; empty environment otherwise | Environment | U | 76 | UMask= (all) | helper umask, inherited | UMask | M | 77 | Nice= (all) | `nice -n` before setpriv | (ps) | n/a | 78 | Restart=on-failure, RestartSec=5 (chat) | D `restart`, `backoff 5 300` | user.sh backoff | user.sh | 79 | TimeoutStartSec= (catalog, contacts, pusher) | D `timeout` (oneshot); W 4th word (watch) | user.sh "oneshot timeout" | user.sh | 80 | NoNewPrivileges=yes (all) | S `--no-new-privs` | NoNewPrivileges | U | 81 | CapabilityBoundingSet= (all) | S `--bounding-set=-all`; userns caps dropped by bwrap | CapabilityBoundingSet | U | 82 | AmbientCapabilities= (all) | S `--ambient-caps=-all --inh-caps=-all` | AmbientCapabilities | K | 83 | PrivateUsers=yes (all) | B `--unshare-user`, single uid mapping | PrivateUsers | U | 84 | ProtectProc=invisible, ProcSubset=pid (all) | B `--unshare-pid` + own `/proc` (only own pids visible). ProcSubset=pid: non-pid `/proc` files stay readable, read-only | ProtectProc, gw "count visible pids 2", "~/.ssh via /proc//root DENIED" | U. ProcSubset=pid partly: needs Drake's sign-off | 85 | ProtectSystem=strict (all) | B read-only `/usr`, `/etc`, sandbox root (`--remount-ro /`); nothing else of the host is mounted | ProtectSystem.usr/.etc/.mntns; pusher "write /var/lib DENIED 30" | U | 86 | ProtectHome=yes (all) | B `/home`, `/root` not mounted | ProtectHome; gw "read ~/.ssh DENIED" | U | 87 | ReadWritePaths= (all) | B `--bind` (`rw`, only under /var /srv /run) | gw create in spool-in ALLOWED; pusher write spool-status ok | sandbox.sh E "rw outside" refused | 88 | ReadOnly by strict (catalog dir for chat etc.) | B `--ro-bind` (`ro`) | gw "write spool-status DENIED 30" | U | 89 | InaccessiblePaths= (chat) | not mounted (only declared paths exist) | gw "read contact store DENIED ENOENT" | U | 90 | StateDirectory=omega-pusher (pusher) | `rw /var/lib/omega-pusher` (directory already exists, 0700) | pusher "write state dir ok" | n/a | 91 | PrivateTmp=yes (all) | B private tmpfs `/tmp`, `/var/tmp` | PrivateTmp | U | 92 | PrivateDevices=yes, DevicePolicy=closed (all) | B `--dev` (null zero full random urandom tty, pts) | PrivateDevices; pusher "/dev/tpmrm0 visible False" | U | 93 | DeviceAllow=/dev/tpmrm0 (pusher) | none: only PID 1 used it to decrypt the credential | n/a | n/a | 94 | ImportCredential=omega-projects-token (pusher) | `secret NAME PATH`: root-owned 0600 file bound at /run/credentials/NAME. The host+TPM sealing of systemd-creds is not reproduced | ImportCredential | M. Plain root-only file instead of TPM-sealed: needs Drake's sign-off before the token is provisioned | 95 | PrivateIPC=yes (contacts, pusher) | B `--unshare-ipc` (all services) | PrivateIPC | U | 96 | PrivateNetwork=yes (contacts) | B `--unshare-net` (`net none`) | (contacts has no network: AF_UNIX only) | sandbox.sh F uses net none | 97 | ProtectKernelTunables=yes (all) | B `/proc/sys`, `/proc/sysrq-trigger`, `/proc/irq`, `/proc/bus`, `/proc/fs`, ... read-only; no `/sys` | ProtectKernelTunables.procsys/.sys | U | 98 | ProtectKernelModules=yes (all) | F init_module/finit_module/delete_module not allowed; no CAP_SYS_MODULE | ProtectKernelModules.init_module | K | 99 | ProtectKernelLogs=yes (all) | F syslog not allowed; no `/dev/kmsg` | ProtectKernelLogs.kmsg / .syslog | U / K | 100 | ProtectControlGroups=yes (all) | B cgroup namespace; no `/sys/fs/cgroup` | ProtectControlGroups, Cgroup.namespace | U | 101 | ProtectClock=yes (all) | F clock_settime/settimeofday/adjtimex/clock_adjtime not allowed | ProtectClock.clock_settime | K | 102 | ProtectHostname=yes (all) | B uts namespace; F sethostname/setdomainname not allowed | ProtectHostname.utsns / .sethostname | U / K | 103 | RestrictSUIDSGID=yes (all) | F chmod/fchmod/fchmodat/fchmodat2/openat/mkdirat/mknodat with S_ISUID/S_ISGID -> EPERM; openat2 -> ENOSYS | RestrictSUIDSGID | U | 104 | RestrictRealtime=yes (all) | F sched_setscheduler FIFO/RR/DEADLINE and sched_setattr -> EPERM; RLIMIT_RTPRIO 0 | RestrictRealtime, .rlimit | K | 105 | LockPersonality=yes (all) | F personality only 0 or 0xffffffff | LockPersonality | U | 106 | MemoryDenyWriteExecute=yes (all) | F mmap W+X, mprotect/pkey_mprotect +X, shmat SHM_EXEC -> EPERM (`mdwe yes`) | MemoryDenyWriteExecute.mmap/.mprotect | U, M | 107 | RestrictNamespaces=yes (catalog, contacts, pusher) | B `--disable-userns`; F unshare, setns, clone with CLONE_NEW* refused, clone3 ENOSYS | RestrictNamespaces.unshare | U, M | 108 | RestrictAddressFamilies= (all) | F socket/socketpair family allowlist -> EAFNOSUPPORT | RestrictAddressFamilies | U, M | 109 | SystemCallFilter=@system-service [@mount unshare setns] (all) | F allowlist from the systemd groups (generated, checked against systemd-analyze) | SystemCallFilter.mincore/.landlock/.ptrace | U | 110 | SystemCallFilter=~@privileged @resources (contacts, pusher) | F `syscalls-deny @privileged @resources` | (removes e.g. setrlimit; contacts .om binary and pusher ran) | n/a | 111 | SystemCallErrorNumber=EPERM (contacts, pusher) | F `syscall-error eperm`; default kill as systemd | SystemCallFilter.* (EPERM) | sandbox.sh D: kill gives SIGSYS | 112 | SystemCallArchitectures=native (all) | F non-AArch64 audit arch -> kill | (no 32-bit userland to test) | not run | 113 | KeyringMode=private (contacts) | keyctl allowed by @system-service as in systemd; session keyring is the service user's own (dedicated uid) | not probed | not run | 114 | RemoveIPC=yes (pusher) | ipc namespace is discarded with the sandbox | PrivateIPC | U | 115 | IPAddressDeny=any, IPAddressAllow= (chat) | N skuid allowlist + `net-default drop`; input: `listen` port source sets | IPAddressDeny.outbound; gw "1.1.1.1 / github / LAN timed out", "hub tailnet address :443 connected", "127.0.0.1:18091 connected" | U, M | 116 | IPAddressAllow/Deny ranges (catalog) | N `allow 127.0.0.53`, `deny` local ranges, `net-default accept` | real catalog run reached GitHub; pusher probe "api.github.com:443 ok" | U | 117 | MemoryMax= (chat 1G, contacts 128M, pusher 256M) | C memory.max | MemoryMax (64 MiB cap, 128 MiB child OOM-killed) | M | 118 | TasksMax= (chat 128, contacts 8, pusher 16) | C pids.max | TasksMax | M | 119 | CPUQuota=200% (chat) | C cpu.max "200000 100000" | CPUQuota (50%: 0.49 s CPU in 1 s with 4 spinners) | M | 120 | LimitNOFILE=1024 (chat) | P RLIMIT_NOFILE | LimitNOFILE | M | 121 | StandardOutput/StandardError=journal (all) | D pipe into `state/log/NAME.log`, rotated | user.sh rotation | user.sh | 122 | After=/Wants=network-online.target (chat, catalog, pusher) | none: a start before the network fails and backs off | n/a | n/a | 123 | WantedBy= (all) | D starts every service file found (autostart yes); boot via the one user unit `tools/aien-supervise.service` | user.sh ensure | n/a | 124 | OnBootSec=5min, OnCalendar=daily, Persistent=true (catalog timer) | D `delay 300`, `every 86400`, last success in `st/NAME.last` | user.sh oneshot every | user.sh | 125 | DirectoryNotEmpty= (contacts path) | W `watch DIR *` (hidden entries ignored) | W ran ingest on drop | n/a | 126 | PathExistsGlob=spool-in/*.json (pusher path) | W `watch DIR .json` | W | n/a | 127 128 Not reproduced, needing Drake's sign-off: ProcSubset=pid (only pids hidden, not the non-pid 129 `/proc` files, which stay read-only); ImportCredential's TPM sealing (aien-supervise reads a 130 root-only file). Everything else has a mechanism and a probe; SystemCallArchitectures=native and 131 KeyringMode=private are implemented but were not probed. 132 133 ### Allen probes rerun inside the aien-supervise sandboxes (`tests/twin.sh`, 2026-10-26) 134 135 * allen-chat, `/tmp/allenchat/gw/probe.py`: same verdicts as the systemd unit's design (home, 136 gh, gb10 lock, contact store, spool-status write, sudo, GitHub/1.1.1.1/LAN DENIED; spool-in and 137 contacts-drop create, 127.0.0.1:18091, the hub's tailnet address :443, AF_NETLINK ALLOWED; 2 visible pids). 138 * allen-chat, `/tmp/allenchat/gw/test_sandbox.py /usr/bin/busybox` (nested compile sandbox): 139 17/17 passed. 140 * omega-projects-pusher, `/tmp/allenchat/pusher/sandbox_probe.py`: home, /root, contacts, 141 /opt, /etc, /var/lib writes, credstore, AF_NETLINK, AF_PACKET, personality, mount, unshare, W+X 142 mmap all DENIED; spool-status and state dir writable; api.github.com:443 reachable; 2 pids; 143 CapBnd 0, NoNewPrivs 1, Seccomp 2; /dev/tpmrm0 absent. 144 * allen-catalog: the real `catalog.py` ran in its sandbox and rewrote catalog.txt (34 areas). 145 * allen-contacts-ingest: not yet probed under aien-supervise (AllenChat's contacts tests are parity 146 tests of the binary, not sandbox probes). 147 148 ## 3. Cutover (per service, by its owner) 149 150 1. `sudo -n sh tests/twin.sh SERVICE `: same verdicts as under systemd. 151 2. `sudo systemctl disable --now SERVICE.service` (and its `.path`/`.timer`). 152 3. Install `services/SERVICE.svc` root-owned 0644 in `/etc/aien-supervise/services/`. 153 4. `aien-supervise reload` (the daemon reads service files at start and on reload only; there is no 154 polling and no file-change trigger yet), then `aien-supervise status SERVICE`. 155 5. Rerun the probes against the running service; then remove the unit file and `daemon-reload`. 156 157 Rollback: `aien-supervise stop SERVICE`, move the `.svc` out, `systemctl enable --now` the unit.