scrotwmos
SWMTOOL(8) System Manager's Manual SWMTOOL(8)

swmtool — install and repair scrotwmos, and run byol's own VMs and containers

swmtool command [argument ...]

swmtool lays the scrotwmos appliance down on a disk and changes it afterwards. The install stick runs plan and install. The rescue world, or the stick's shell, runs the rest. A byol box runs vm, its own VMs on Void's qemu, and ct, its own containers, Void roots (ct start | stop | restart | list | top | console, ct enable | disable | exec, ct create | clone | rm | pass | port, ct image list | check | rm | build void, ct allow | deny), itself.

Who may run what:

Any user
, plan, survey, release sign, release verify, kernel-verify, install --dry-run, vm list, vm top, vm image list and ct top. A state that only root reads shows as ?.
An allowed user
on their own containers, once root ran ct allow: ct list, top, create, clone, rm, pass, port, ct start, stop, restart, console, exec, enable and disable. Their ct create takes no -P, -p or static -a, and their ct start no --temp.
Root alone
every other command: ct allow, deny, image, ct list -a, ct top -a, and every vm command but the three above. Each vm command that writes root's files (image build, image rm, create, clone, start, stop, restart, enable, disable, rm, port, run and term) run by another user prints vm <command>: needs root, such as vm stop: needs root, and exits 1 before it does anything. vm console and vm pass read what root alone may read: another user gets an error.

The root vm commands first check each program and file they run; any missing: vm: missing <packages>; xbps-install -S <packages>, exit 1. swmtool installs no package.

At a question a password and a username are not shown as they are typed: the username picks the world. A recovery phrase is, and on a terminal the screen and its scrollback are cleared once a phrase is taken. Ctrl-C at any question, the stick's update's too, ends it: interrupted: nothing taken, and the command stops as it does at the end of its input, by its own way out (session and world write nothing and exit 3; session removes what an add made).

An installed disk holds a boot partition, labeled ESP, an encrypted data partition, swmdata, and, last, the ESP's twin, which is a copy of the ESP. Each world has its own master key. Its disk images in swmdata are encrypted under keys that only that master key opens. keys.wrap, on the ESP, has one entry for each username. An entry opens its world's master key with that username's password and nothing else. So root on the machine can erase a world but cannot read one: every command that touches a world asks for that world's credentials. A change to a world's configuration takes effect at that world's next boot.

passwd, update, update-boot, firmware refresh, totp, session, and world ask for the username. The username is typed with no echo, like the password. No message names it. unlock, add, update-root, open, close, points, and share take the username as an argument.

The repair commands share these options:

file
Read the credentials from file instead of the terminal: one username password pair per line. The file is a pipe on -, the standard input, or a regular file of the caller's own, mode 0600 or tighter; 8 KiB at most.
dev
Use dev as the boot partition, mounted only while the command runs. Without it, the one partition labeled ESP is taken. None gives ‘ESP: none’. Two or more, on a terminal and without --passwords, are listed with their disk, size, bus, model, and kind. ‘Update [part]:’ asks which. Enter takes the first of kind dom0, or for recover the first of kind byol; with none of that kind, the first. Otherwise they are refused: ‘ESP: 2 found; --esp <part>’. For add, update-root, open, points, share, unlock, and recover, ‘ESP [part]:’ asks instead. With swmdata open, all but recover take the boot partition on its disk and ask nothing.
url
Fetch packages from url, an http or https URL, or an absolute path. For session, world, and firmware, it replaces the default Void mirror. For add, update, and update-root, it is added to the root's repositories. With neither it nor --passwords, they ask “Package repository”, and Enter takes the default Void mirror.

[-B dom0 | byol] [-K layout] [-o file]
Ask the install questions and write the answers as a plan, in the format of swmtool-answer(5), to file or the standard output. The plan is checked by install's parser before it is written. -B gives the base instead of asking for it, and -K the keyboard layout; a layout given that is not valid is refused. The install stick asks for the keyboard layout first and puts its console in it at once, so every later answer, a password too, is typed in it; it then asks update, the appliance or byol, and gives both to plan.
[--dry-run | --which-disk] [--force] [--allow-real-disk] [--batch] [--passphrase-file file] [--passwords file] [--place-passwords file] [--log file] plan
Lay down what plan describes. The plan, the release, the disk, and the passwords are checked before anything is written, and so is every package the plan names: one that no repository has is named, and it, or a mirror out of reach, refuses the install with nothing written. It asks for each username's password twice, unless --passwords gives them. It fetches the machine's firmware, partitions the disk, and builds every world from the package repository. A byol plan's sessions are built the same way, each root by fill root, and named in /etc/scrotwmos/swm-wl.conf. Every root is dark (GTK and Firefox). A byol's root is dark only with dark = yes. The terminal's and the bar's fonts are 18 pixels, or 28 on a screen of 170 dpi or more.

keys.wrap is written near the end and the boot loader last, so a failed install boots nothing. A failure before keys.wrap also removes what the install wrote on the ESP. A failed byol install unmounts its root and closes its root's mapper, so the same command runs again; what it cannot undo it names, with the command to run. The images left in swmdata are under a disk key that is gone.

Check the plan, the release, and the disk. Print the steps. Ask, fetch, and write nothing.
Print the disk the plan names, after an install's checks of it, and stop. Read and write nothing else.
Erase a disk that holds data, as erase = yes does. Without either, such a disk is refused. A disk in use is always refused.
Write a real disk. Without it, only a loop device is written.
Ask nothing.
file
For a byol plan: byol's one password (the login's, the boot's, and the disk's) from the first line of file, a file as --passwords takes: - is the standard input. Without it, asked for on a terminal unless --batch: twice, or, when the plan holds a password_hash, once, until it is the one the hash is of. A wrong password is refused.
--place-passwords file
For a byol plan with restore (swmtool-answer(5)): the place's password, from the first line of file, a file as --passwords takes. Without it, asked for on a terminal unless --batch. A restore is an install whose root comes from the place: the disk laid out as for an install, the root's image pulled from the place and mapped by the key the place holds, and none of the root's fill. The new box boots the old box's root. The place is a directory that the user mounted, read on the box by a root child process; the box's kernel parses its file system.
file
Append the output of the tools swmtool runs to file, a regular file of the caller's own. swmtool's own steps, warnings, and questions stay on the standard output and the standard error.

[--passwords file] [--esp dev] user
On the install stick, which has no world open: open swmdata at /swmdata with user's credentials, so that open, points, share, totp, world, and each place command but place list and place open work. session, add, update, and update-root open it themselves and close it after. add, update-root, open, and share refuse a swmdata from another disk. Only a power off closes it.
[--rw] [--point n] [--passwords file] [--esp dev] [--session name] user
Mount the root and home of the world that user opens at /mnt/user/root and /mnt/user/home, read-only unless --rw is given. --point n also mounts point n of the home, numbered as points lists them, always read-only, at /mnt/user/point: a file copied from it to the home, opened with --rw, is put back. --session name mounts the root of that world's session, a container's or a VM's, at /mnt/user/root instead, with no home, and refuses --point.
user
Unmount and lock what open or place open opened.

[--passwords file] [--esp dev]
Change one username's password. It asks for the username, the password, and the new one twice. Only that username's entry in keys.wrap changes. Nothing is encrypted again.
on | [--passwords file] [--esp dev] [--stub path | url] [release]
 
on | [--esp dir]
The TOTP codes: the loader shows a loader code before the prompt, and the boot asks a login code first. On a byol box, its ESP mounted at /boot/efi or dir with EFI/scrotwmos/keys.wrap on it, the codes are byol's; else they are the dom0's, its ESP found as update finds it. A byol disk found from the install stick is refused: run swmtool totp on the byol box.

byol's codes need preboot tpm password first, and a terminal: the secrets are shown. on asks for the username and the password, makes two secrets and shows them one at a time, loader then login, as letters, an ‘otpauth://’ URI and a QR code, asks that one's code back, and seals them with the TPM's key. It refuses when the RTC is not the system clock: the loader reads the RTC. off asks for the username and the password and seals the key alone. Each makes a new TPM key, so an old sealed file opens nothing.

From the install stick, the dom0's TOTP codes, the box's, for every world, the decoy too. It asks one world's username and password, any world's. The install offers them with its other questions, before the disk is written, and lays them with keys.wrap. It writes keys.wrap, so swmdata must be open (unlock): a change of worlds cut off before is taken back first. on makes two secrets and shows them one at a time for the phone's authenticator app, ‘dom0-loader’ then ‘dom0-login’, as letters, an ‘otpauth://’ URI and a QR code, asks that one's code back and clears the screen. The TPM seals them to the loader, which must be the stub beside release, or what --stub names (the stick's by default); no copy is kept. keys.wrap then says the codes are on, and which seal. Each boot then shows the loader code before the prompt: if it shows none, or one that is not the phone's, the boot has been tampered with; type nothing and power off. Then it asks the login code, first, before the username and the password; Return on an empty login code shows a fresh loader code. A seal taken off the ESP while keys.wrap says on, or one put on while it says off, halts the boot after the password. update-boot with a new stub turns the old codes off, then asks for new ones; with no tty, a no, or new ones not typed back, they stay off. With the codes on and a new stub, it needs swmdata open (unlock), or it writes nothing: before it writes keys.wrap it takes back a change of worlds cut off before. A keys.wrap whose mark does not agree with the ESP is said, codes gone, before the codes are turned off. Enroll on the box's own screen: a serial console keeps the secrets in its log. When the TPM gives no code (a firmware update, a new board), the boot halts: off, then on. off marks keys.wrap off, then takes the seal out; the next boot asks the username and password alone. The codes are a second factor of sorts: a copy of the disk, or anyone who can write the ESP and has a world's password, opens a world with its password alone.

[--esp dir] [--luks dev] user
On a byol box, change its one password. Elsewhere, as on the install stick, it refuses: byol only. The login and the screen lock ask for it. The boot asks for it as user, to start the newest kernel, or as rescue, to pick a kernel from a list. dracut asks for it as the disk's passphrase when the boot's key does not open the root. Use this command, not passwd(1), which changes the login's alone. It asks for the password and the new one twice, or reads them as three lines. The boot's keys are in EFI/scrotwmos/keys.wrap on the ESP, /boot/efi or dir. The disk is the one /etc/kernel/cmdline names, or dev. Nothing is encrypted again. The login changes first, then the disk, then keys.wrap. To finish a stopped run, run it again with the same answers.

Anyone who can read keys.wrap can guess the password offline, at the cost of bcrypt_pbkdf, not of the disk's argon2id. The ESP is mounted umask=0077: only root reads it.

A damaged LUKS header loses the root, even with the password. Keep a copy of it on media of your own, stripped to the disk key's keyslot, so that an old password never opens it. As root:

umask 077
cryptsetup luksHeaderBackup /dev/<root> \
    --header-backup-file /mnt/usb/root.hdr
cryptsetup luksRemoveKey /mnt/usb/root.hdr
cryptsetup luksDump /mnt/usb/root.hdr

luksRemoveKey asks for the password and removes its keyslot, whatever its number. The dump shows one keyslot left, pbkdf2's.

With the TPM and the password (preboot tpm password), the root has no password keyslot. Strip the recovery phrase's keyslot instead: cryptsetup luksKillSlot /mnt/usb/root.hdr 31. After a restore, preboot passwd adds no keyslot. A password change leaves the copy good. Make it again after cryptsetup reencrypt and after preboot make, which gives the disk a new key. To restore it, with the root closed, from a live system:

cryptsetup luksHeaderRestore /dev/<root> \
    --header-backup-file /mnt/usb/root.hdr

Then boot: the boot's key opens the root, which needs the ESP. Then run preboot passwd. The disk opens with its key alone, and the command gives the disk the new password's keyslot again, which dracut asks for. A damaged header and a dead ESP together are total loss: the copy holds no password's keyslot, and byol has no ESP twin.

With the TPM and the password (preboot tpm password), the root has no password's keyslot: luksRemoveKey asks for the recovery phrase instead: its 12 words, lower case, one space apart. After a restore, run preboot tpm password off, then preboot tpm password, which gives the disk the recovery phrase's keyslot again.

on | | | | | | [--esp dir]
On a byol box: whether the TPM opens the disk with no password, or with the password only. Elsewhere, as on the install stick, they refuse: byol only. on asks for the password once, lays the tree's boot stub on the ESP, adds a TPM slot to keys.wrap, keeps its key in /etc/swm/tpm.kek, and seals. The password slots stay: the stub asks for the password whenever the TPM does not open the disk. A boot the TPM opened starts with the screen locked. off removes the TPM slot, each sealed file, and the key. The boot asks for the password again. It does not revoke: a copy of the ESP from before, put back, boots by the TPM again. on and off refuse while password is on.

password makes the boot take the TPM and the password together: neither opens the disk alone. It asks for the username and the password, shows the recovery phrase, and asks for the phrase again. The phrase is 12 words, from the box's own keys, the same every time, shown on a terminal alone. Then it seals, puts the phrase in keyslot 31 of the root's LUKS, removes the password's keyslot, and replaces the password slots of keys.wrap with TPM and password slots and a recovery phrase slot. When the TPM does not open the disk (a changed boot, a new board, the TPM cleared), the boot halts and asks nothing: swmtool recover, from the install stick, takes the phrase. So do dracut and swmtool update. swmtool recover and swmtool update take each word's first four letters, in any case; dracut takes the words in lower case, one space apart. Without the phrase, the disk does not open. To finish a stopped run, run it again. password off asks for the username and the password, puts the password's keyslot back, makes the boot the TPM alone again, and removes the phrase's keyslot. phrase asks for the username and the password and shows the recovery phrase again.

seal seals each kernel listed in EFI/scrotwmos/kernels to what its boot measures: the stub on the ESP (a new one the kernel hook laid, too), the Secure Boot state, the kernel, its initrd, and the command line. The kernel hook runs it, and so does a service at each boot the password opened. Nothing is written to the TPM. After a seal, a pending boot (an install's, or a recover's) loses its password slots, and a password's keyslot 0. pending does that alone: the same service runs it at each boot the TPM and the password opened.

[--esp dev]
On a byol disk whose boot takes the TPM and the password (preboot tpm password), from the install stick or any Linux with the disk attached, as root, when the TPM does not open it: the boot halts with ‘TPM gave no key: recover from install stick’ or ‘boot changed since last seal: tampering suspected; power off’. It finds the ESP and the root as update does. It asks for the recovery phrase (shown as typed), the username and a new password twice, and changes nothing unless the phrase opens the recovery slot of keys.wrap. It opens the root by the disk key and reads the TPM's key from /etc/swm/tpm.kek; with TOTP codes on, it asks whether to drop them (a lost phone). Before any change it checks the login (a UID of 1000 or more), the keyslots against their roles (keyslot 0 the password, 1 the disk key, 31 the phrase; a password keyslot anywhere but 0 is an error), and that the root's own boot stub never asks the phrase (a system from before recover is refused: update first); a key file that is there but bad is replaced only when asked. Then, in this order: it sets the login's password on the root, by the root's own chpasswd; kills a password's keyslot 0 when the disk key is at 1, and gives keyslot 31 the phrase again when the header has it not (no password keyslot is added); writes the key file with a new key (the codes after it unless dropped; with no key file, none); runs the root's kernel hook for each kernel, which lays the kernels, initrds, command line and boot stub of the root on the ESP; wraps keys.wrap's TPM and password slots again under the new password and the new key, with password slots beside them; and removes each sealed file and the phrase marker. The recovery slot and keyslot 31 stay: the phrase is the same. A stop says what changed and what the boot does then; running it again finishes it. The next boot asks for the new password once, as an install's first boot does; its seal service seals if the TPM answers, and the password slots go: the TPM and the new password from then on. It exits 0 when the recovery is done, also when the disk did not close after it, which it says.
esp user luks-device layout
 
[--esp dir] --root dir
 
[--esp dir] --root dir --luks dev
The installer's steps for a byol. Each reads the password on the standard input. make adds a new disk key to a keyslot of luks-device and writes esp/EFI/scrotwmos/keys.wrap with user's and rescue's slots and the disk key, sealed, and names layout, which the boot reads the password in. ready, for tpm = yes, makes on's slot and key, the key under --root dir, and seals nothing. password, for tpm = password, reads the username and the password, one a line. It makes a new key under --root dir, adds the recovery phrase as keyslot 31 of dev, and adds the TPM and password slots and the phrase's slot to keys.wrap. It shows nothing and seals nothing, and the password's slots and keyslot stay. The first boot opens with the password, and the boot shows the phrase until a key is pressed; once its seal seals, it removes them.
[--esp dev]
Make the ESP again from its twin, the last partition of an appliance disk. Every change to the ESP copies it there (doc/design-points-later.md, F). Run it in rescue, from the stick (Ctrl-C at a question). Run it when the loader does not start, or when the ESP does not mount or does not open. No password is asked for. The twin is found by its label, and the ESP beside it; or the twin beside --esp, which must be an appliance's ESP. Refused, with nothing written: a twin that is not whole (a file that does not read, or a copy cut off, its files not of the one time of its keys.wrap), and a twin older than a whole ESP's keys.wrap, which would bring back what a later change took away. Otherwise the ESP's file system is made again and the twin is copied onto it, its time kept. If it is cut off, run it again.

[--force] [--passwords file] [--esp dev] [--repo url] [--kernels dir | url] [--stub path | url] [release]
update-boot, then update-root, with one set of questions: the package repository, then the slots' usernames and passwords. Both slots' credentials are checked before anything is written, and asked for again on a terminal after a wrong one. swmdata is opened with slot A's and closed after, done or not. With swmdata already open, after unlock or in rescue, it refuses before it asks anything: use update-boot and update-root. After an A/B world's update, a NOTE says that rescue and the decoy are not updated. To update each, run update again with its username and password as slot A and slot B empty.

On a byol disk (its ESP has EFI/scrotwmos/keys.wrap) with no release, it lays this stick's scrotwmos instead: the tree under /usr/lib/scrotwmos, the install's scripts and config, the boot stub and each kernel's initrd, and then each session's root as update-root updates a world's, the stick's packages first. A root from before vm gets what the install lays for it: the vm user when it has none (an owner's own vm is kept), the build range of vm image build void when it has none, and lan0 of a wired uplink when it has no /etc/sv/dhcpcd/lan0. Every root gets the NAT bridge vmnat0: its service /etc/sv/vmnat, on, and /etc/qemu/bridge.conf without the allow lan0 and allow vmnat0 an install before wrote, the file's other lines kept; lan0 and the VMs are left as they are. The root is the partition on the ESP's disk whose LUKS uuid is the one rd.luks.uuid names in the ESP's EFI/scrotwmos/cmdline; none, or two, is refused. A config file still as the install wrote it (each is recorded in /etc/scrotwmos/generated) takes the release's. An edited one is left. It is shown when the release changes that file, and a line the release adds to it is shown, to add by hand. The root's /etc/kernel/cmdline gets rootflags=prjquota, said, unless it names a project quota already: ct's disk limits are on from the next boot. It asks for the password that opens the disk. A wrong one changes nothing, and on a terminal, it is asked for again. A release older than the box's is refused without --force. With the TPM on, it says that the next boot asks for the password once; with the TPM and the password, it asks for the recovery phrase, and seals each new kernel from the stick with the root's key, as the kernel hook seals it. A seal that fails, or a stick the firmware measured otherwise than the disk, leaves a next boot that may halt: recover opens it. Nothing of the user's changes.

update-boot [--force] [--passwords file] [--esp dev] [--stub path | url] [release]
Put a new release on a world: this changes what boots, not a root. release is a path or an http or https URL to a signed release, checked before anything is asked. Without it, the release beside swmtool is used: on the stick, /opt/scrotwmos/release/dom0.signed. It asks for slot A's username and password, then slot B's. Slot A gets the new release, and slot B gets what A had. B then always boots the last release that ran. An empty slot B username updates slot A alone: the decoy and the rescue world have one slot each, and an A/B world's B keeps its release. A write that stops inside slot A's pair leaves a world with no B unbootable until update-boot runs again, from rescue or the stick. A release older than A's is refused, and so is an update that would give B a release older than B's. --force lifts both refusals.

The release's stub, the loader the firmware starts, comes with it: swmstub.signed beside the release, or what --stub names, a path or an http or https URL. When the sibling is missing, swmtool leaves the stub and says so. A named one must read. The stub must be signed by the release key, carry this release's version and date, be a stub and not a boot image, and pin the release key the slots are signed with: a key rotation is a new install. It is written first, and only when the loader differs, so a write that stops anywhere leaves a loader that boots, and a rerun changes only what it meant to.

A box whose loader is gone or will not start boots the stick. Its update-boot, from a stick at least as new as slot A, writes the loader before the slots. An older stick needs --force, which also puts the stick's release in A.

update-root [--passwords file] [--esp dev] [--repo url] [--kernels dir | url] user
Update the VM kernels in the world's kernel store, then every package in every root of the world that user opens: the world's own root and each session's. A session essential the release added since the world was installed is brought in first. Then every package, the user's too, is updated. The kernels come from the release's kernels/ beside swmtool, or from --kernels: a release's kernels/ directory, or its http or https URL. Every kernel is checked against the signed index before the store changes, and the old set stays whole until the new one is laid. This does not change what boots. A root that is an empty file, as place world leaves one with no copy on the place, is made anew first, from the release, as the install makes a session's root: the base system only. The session's own packages, and a VM's GPU drivers, come back with add. With no --repo to make it from, it is refused, and nothing changes. Each root's package manager runs in a jail that sees only that root, and its output is shown only when it fails. The rescue world's root is in use while rescue runs. Update it from the install stick. With swmdata shut, as on the install stick, it opens swmdata first with user's credentials, as update does, and closes it after.
[--passwords file] [--esp dev] [--repo url] [--session name] user package ...
Install package into the root of the world that user opens, in the jail of update-root, or with --session name into the root of that world's session, a container's or a VM's. It opens and closes a shut swmdata as update-root does.
[--repo url]
Show the firmware this machine's devices need, each file from the Void repository, and the total. Nothing is written.
[--repo url] [--passwords file] [--esp dev]
Fetch the firmware again and give it to one world, whose usernames and passwords it asks for. The new firmware goes on the boot partition beside the old, and only that world's slots take it, from their next boot. Refresh each world that needs it.

[--passwords file] [--new file] [--esp dev] [--repo url]
Add or remove a whole world. It asks for the credentials of a world already there, then whether to add or remove. To add, it asks plan's world questions and asks for the new usernames' passwords, or reads them from --new file, in the format of --passwords. A new container world takes the language of a world on the box, else C.UTF-8. To remove, it asks for the credentials of the world to remove, or reads them from --new. It takes the world's usernames out of keys.wrap first, then deletes its images, its kernel store, and its points. The world used to open cannot be removed.
[--passwords file] [--esp dev] [--repo url] [--release dir] [list | dump]
Change, add, or remove the sessions of a world. It asks for the world's credentials, lists its sessions, and asks which one to change, or add. A session can change its network and process limit. An extra session can be removed. add asks plan's session questions and a container's process limit, and builds the session's root. A container takes its world's language, and package sets default to shell. On a box with a GPU besides the display GPU, a VM is asked whether it takes that GPU. For an NVIDIA GPU, yes installs the nvidia package set in the VM's root there and then: the root must not be in use. list shows each session's settings and images, and dump prints both slots' configuration. Neither needs swmdata. On the install stick, it opens swmdata with slot A's credentials and closes it, as update does.

On byol there are no worlds or slots. On the running box, as root, with /etc/scrotwmos/swm-wl.conf and /etc/sv/swm-wl/run, nothing is asked first. From the stick, it finds the byol disk as update does, asks ‘Password:’ once, and opens and mounts the root until the end. It lists the sessions and asks which, or add. add asks the install's session questions (name, isolation, workspaces, network, package sets and packages, and the share), builds the root as the install does, a container's in /srv/<name>, a VM's disk in /var/lib/scrotwmos/vm/<name>.img, and writes the session's lines. A container takes the box's keyboard language. A session picked can change its network, add packages to its root, join or leave the share, or be removed: its lines go, its root only on a yes, and its home stays. A root and its packages come from the release's repository, beside swmtool on the stick, or --release dir on the running box. On the running box, it ends with ‘RESTART: swm-wl’: the compositor takes the change at its next start.

[--passwords file] [--esp dev] join | user session
puts session of the world that user opens in the world's share: one directory, at /share, on an image of its own under that world's key, made at the first join. Only the sessions put in it see it, and no other world's. A session not in it has no route to it. part takes session out of the share, from the world's next boot. The share and its data are kept. join asks for the password of user, then slot B's username and password. Run it from the world's rescue: it is refused on the install media. To finish a join or part cut off between the two slots, run the same command again.

[--share | --root] [--back n] [--passwords file] [--esp dev] [--session name] user
List the points of the home of the world that user opens, newest first, numbered as --point takes them: each one's local time and its age. A point is the home as it was at that hour. The booted world's root monitor takes one each hour the home changed, keeps every one of the last day, one a day for the week before, then one a week for two years at most. It takes none while the store has less than 5% free. Under 1%, it deletes them all.

--back n rolls the home back to point n instead, in rescue, the world not open. Nothing is lost: the home as it was becomes this hour's point, 1 in the list, and every other point stays, so --back 1 undoes it. The next copy to the world's place is a whole one.

--share does the same for the world's share, every file's owner, group, and mode as they were at that hour. A world with no share is refused. --session name does it for that session of the world: a VM session's points are of its disk, which holds the guest's home, and --back rolls the whole disk back. --root does it for the session's root, the system it runs: its points are taken the hour after rescue changed it (add, update-root), and --back needs the world not open. A VM session's root is its disk.

[--passwords file] [--esp dev] [--session name] [at] user place path
Make the backup place of the world that user opens: the directory path on place, which keeps its other files. place is one of:
disk
A USB disk, such as /dev/sdb: the directory on its one file system, or on the one --uuid names.
IP:/export
An NFS export, by its server's address. It must be sync, not async: an async server says a write is done before it is on its disk, and a copy checked as written can still be lost.
account@IP/share
An SMB share, logged in to as account.

Once the place is made, or adopted, the world's recovery phrase is shown, as place phrase shows it; off a terminal, run that to see it.

The place commands take, as at:

uuid
A disk's file system that holds the place, by its UUID in lowercase, as lsblk -f shows it. It is needed only on a disk with more than one.
tap
A network place's: the tap ttvm's NIC is put on, up and on a bridge, made as in EXAMPLES. A tap that is not there, or is down, is refused. The server sees the box's own address: export the place to it.
ip
The VM's address on it, as the kernel's ip= takes it, client::gateway:netmask:::off, the client in 100.64.0.0/10, as every VM's is. The VM resolves no name: the server is named by its address.
file
An SMB share's account password from file, a line account password as in --passwords; Without it, the password is asked for. The account, its password, and the path take no comma: the SMB mount reads one as its next option.

path is made when it is not there. A leading ‘/’ is the file system's root, and ‘/’ or ‘''’ is the root itself, where F11 makes a place. ‘..’ and links are refused. The file system must keep holes, punched holes, and hard links (XFS, btrfs, or ext4; not vfat or exFAT). Without reflink, every copy is whole, one a day. Two small header files are written there, and the world's record of the place in the store. A place that already holds this home's header, from an earlier install, is adopted with its copies. The boot disk is refused, and so is a world that has a place. With --session name, the place is that session's, in its own directory beneath path. A VM session's copies are of its disk, under the disk's own key.

The booted world copies each new point to the place while it can reach it: a USB disk while it is plugged in and admitted, at boot or in F7's scan window (or always, with allow_hotplug = 1 in dom0.conf); a network place while the world's network reaches it. Copies are thinned as points are: every copy of the last 24 hours, the newest of each of the last 7 days, and the newest of each week before. No copy is made that would leave less free than the smaller of 5% of the file system and 64 GiB: each copy thins first, and while the copies kept still fill it, F6 says the place is full. While points are off (F11 or dom0.conf), nothing is copied.

[--passwords file] [--esp dev] user
Say where the world's place is, or that it has none.
[--passwords file] [--esp dev] user
Show the world's recovery phrase: 12 words, from the world's own keys, the same every time. It is shown on a terminal alone, never into a pipe or a file. With a place, they open the world's backups when the password is forgotten, on any box (doc/design-points-later.md, F). Keep them on paper, away from the box and from the place.
[--passwords file] [--session name] [--share | --root] [--check] [--phrase] [at] place path user
List the copies at a place, newest first: each one's hour in UTC, the word place open takes, in local time, and its size. A copy whose manifest does not open is said to be damaged. With --phrase, the place opens with the world's recovery phrase, asked for, not the password. Only the place and the world's password are needed: the box need never have seen the world. The place is mounted read-only and nothing on it is written, so a full or read-only place lists too. --check reads every chunk of every copy against its manifest and says each copy checked, or damaged with how many chunks are bad and the byte of the first. On a place that reflinks, one bad block can harm many copies.
[--passwords file] [--store dir] [--session name] [--share] [--damaged-ok] [--phrase] [at] hour place path user
Restore the copy of hour into the store (/swmdata/images, or --store), check every chunk of it against its manifest, and mount it read-only at /mnt/user/place, alone or beside an open of the world, run first. The store must have room for the copy's data and 1% of the store besides. The restored copy holds no name in the store: its close, or a power cut, frees its space. A copy damaged on the place is refused, its first bad chunk named. --damaged-ok opens it with each bad chunk as zeros and names the bad chunks, then each file with data in one. A bad chunk in the file system's own blocks can keep the copy from opening at all. The place is mounted read-only. user names the mount and whose password is asked for. The place opens with the password alone, so any name does. With --phrase, the recovery phrase opens it instead, as in place list.

With --share, place list and place open take the world's share's copies instead, in the directory share of the session's: the same password opens them, and a user copies their own files out of the share as it was.

[--passwords file] [--esp dev] [--new file] [--phrase] [at] place path user
Bring a dead box's world back on a new box (doc/design-points-later.md, F). The world installed here, slot A user, becomes the dead box's world again, under that world's own keys, so place restore can bring back its homes, roots and VM disks. Run it in rescue, with the place there, before the world installed here is ever booted, with the install's username and password. Slot B's are asked for next, or read from --new file, which holds slot B's line alone, when the world has two slots.

The world's file, in the world's directory on the place, opens by the place's header with either slot's password when it is the dead box's. With a new password, give --phrase and type the recovery phrase. By the password, it runs on a terminal alone: it shows the phrase's first four words to check against the paper, and asks for yes, since anyone with the place and the password could have written that file.

The world gets back its sessions, Wi-Fi networks and settings. Each home is made empty, and each root and VM disk an empty file, until place restore puts its copy there; it names each one. An image with no copy on the place is named too: a home starts empty; a root or VM disk stays an empty file, and the boot refuses its session, saying so, until update-root makes it anew. The world's VM kernels are laid from the release beside swmtool, with no network. This box keeps its own disk key, boot image and fstab, and the GPU and network-card approvals its install made, sealed again under the world's keys, so the world has its network at its first boot.

Refused, with nothing written: a world on this box that has those keys already, a world installed here that has points, another number of slots, an image the world names that is here already, a world with a share installed with none, and a rescue with no VM kernels beside swmtool. If it is cut off, run it again: the next run takes away what the first made, or finishes what it left, and names each image again.

[--passwords file] [--esp dev] [--session name] [--share | --root] [--remake-homes] [--phrase] [at] hour place path user
Put the copy of hour in place of the world's home, every chunk of it checked first. Run it in rescue, for the world user of this install, with the password of the world the place was made by, or with --phrase and the world's recovery phrase. Refused: a place other than the world's, a world whose session is running, and a password change not yet done on the place.

On a new box or a reinstall, the copy is first opened as a home under the place's key. A copy that does not open is refused, and the home is kept. Then the home takes the place's key, the world's points go, and the world has the place from then on, as place init would adopt it. The world's sessions share one home key, so each other session's home is then restored the same way, with --session, from its own copy on the place, and the restore says so. A session with no copy there is made anew, empty, under the new key with --remake-homes. Without it, the restore is refused and names the session. On the world's own place, the home as it is now is gone unless a point holds it. The points stay. Either way, the next boot's copies go on beside the old ones.

--share restores the world's share instead, from the directory share of the session's, every file's owner, group, and mode as they were at hour. On a new box, the share takes the place's share key. --root restores the session's root, from the directory root of the session's, only on the box whose world made it, or after place world: another world does not make the root's key, and the restore is refused.

On a byol, the root is an image, root.img, in an XFS store on the disk's LUKS2 volume, mounted at /swmdata; see scrotwmos-byol(7). ttd(8) takes its points and its copies. These commands ask it over its socket, as root. Each answers in lines; a refusal's last line starts refused:.

Time travel on or off, the store's size and free space, each point's hour and size, and the place: its kind, its disk or address, its newest copy, its state, and its last job's end. With no place, the USB disks the box takes as one.
|
Turn time travel on or off. On, ttd(8) takes this hour's point at once, unless the store has one of this hour or this ttd tried one this hour. Then it takes one each hour that the root changed. The bare tt(8) takes no point at on: it takes a point only at its take or copy. Off deletes every point, once none is mounted and no job runs.
Take a point now.
Delete every point.
| hour
Mount the point of hour, YYYYMMDDTHHZ, read-only at /points/hour, or unmount it.
hour |
Make the point of hour the root the next boot boots, and lay its kernels on the ESP; or, with undo, the root as it was before the last rollback. The root now is kept as root.prev.img. A second tt back before the boot is refused. A kernel update, or the stick's update, cancels a rollback not yet booted.
dir
Make the directory dir, an absolute path that the user mounted, the root's backup place: XFS, ext4, btrfs, FAT or exFAT on a disk, an NFS export, or an SMB share. FUSE is refused. A directory that is not mounted is absent: no copy is made, and the points go on. It asks for the place's password twice, the one a restore asks for. The copies follow: the first is the whole root, the next only what changed. They are ciphertext: the root's image is LUKS2. A disk the box boots from is refused.
| | | | | | | ...
The store's own steps, which the install, the stick and the initramfs take: make the store and the root's image in it, open or close them, name or mount the root, pull the root from a place (restore), or cancel a rollback. They are not for use by hand.

layout | plan |
Put the console's keys in layout, one the boot reads, by the console map of loadkeys(1); with -p, in the keyboard of plan, read as install reads it; with -b, in the layout the installed box's keys.wrap names, US for none. The install stick runs it at its first question, with -p for a plan on the stick, and with -b before an update: every later answer, a password too, is typed in it.
[--json | --nic address]
Print what the machine offers the appliance: the IOMMU, the TPM, the security tokens, and the PCI devices with their IOMMU groups. Without root, the ACPI tables and the TPM may show empty. Each GPU shows the rows the GPU table has for its id. Each GPU but the display GPU is shown as dom0 holds it, with no driver. With --json, the gpu object gives each GPU's rows as indexes into the table, per path (native context, Venus, VFIO, SR-IOV), -1 for none. swmtool does not read the bridges on a GPU's path or its group's state. dom0's F9 shows whether a VM gets it. --nic prints only the network function at address, and only when dom0 gives it to no VM: its address, ids, and reason in the words of dom0's F5 (its IOMMU group shared or none, or its row not listed, excluded, or impossible). --json and --nic together are refused.
-r | | -s key.sec -p key.pub -v version -d date -o out kernel
Sign a kernel, or the stub, as a release. -r signs a dom0 kernel with the release key. -b signs the stub with the release key, with no handoff, so the stub refuses it as a boot image and update-boot takes it as the stub. -i signs an installer kernel with the installer key. -s and -p name the signify secret and public keys. The public key must be the one swmtool was built with. -v is the version, and -d is the date in UTC seconds. The signed image is checked, then written to out, which must not exist. A secret key's passphrase is read from the standard input.
-r | | -v version -d date -m kernel signed
Check an image that a signer sent back: the image signed must be kernel signed as release sign signs it, byte for byte after its header, with the version and date given, under the key swmtool was built with for that kind. A release built with a signer runs it on each image. Exit 0 when the image is good, 1 when it is not.
[-i index] flavor [blobdir]
Check a VM kernel, or an archive a guest's kernel unpacks, as the launcher will. Run it in a scrotwmos tree: the key is its kernel/keys/kernel.pub. The index, blobdir/index or index in blobdir, must verify under its signature .sig beside it. The blob that names flavor must have the index's digest. blobdir is build/kernel when none is given. For nctx-mesa and gpu-fw-family, the archive is then listed as -c lists one.
-c archive [nctx-mesa | gpu-fw]
List a zstd newc archive, of the kind named (nctx-mesa when none is), as the build does before it signs one. It is refused when it is not one archive and zeros, when an entry is named init, is setuid or setgid, is a hard link, or runs through a link, or when the file or what it unpacks to is larger than the kind's bound. An nctx-mesa archive holds the directory nctx-mesa and files and directories under it. A gpu-fw archive holds gpu-compositor/scrotwmd, gpu-compositor/gpu-probe, and lib/firmware/, its links relative and under lib/firmware/nvidia/.
step ...
The steps the other commands run to fill a root, a home, a share, or a kernel store. Nobody runs them by hand.
[--temp] name
byol: run the VM name, Void's qemu under runit. The VM is its qemu command line as YAML, /var/lib/scrotwmos/vm/name.yaml: one map, each key an option, -key, each value one word after it, as written (no YAML typing: no, 22:22 and 0x10 stay words), a list the option once an item, an empty value a bare flag. Only maps, lists and plain or quoted scalars are taken: an anchor, an alias, a tag, a directive, a block scalar, a second document, a map under a key or in its list, or a key twice, is refused with its file and line. A value with a comma goes in a block list, not a flow one: in [a,b] the comma parts two items. swmtool adds -name name,process=vm-name,debug-threads=on, QMP on /run/vm/name/qmp, and a console on /run/vm/name/console: a virtconsole (hvc0), or a serial port (COM1) when the YAML has console: serial (console: virtio is the default), and a -sandbox (below); nothing else. A YAML that sets name, qmp, qmp-pretty, monitor, mon, daemonize, readconfig, gdb, s, qtest, incoming, S, run-with or sandbox, a value that starts mon: (a monitor on a chardev), or an id swm*, is refused. The list guards the tool's own options and its hold on qemu, no more: a VM's YAML is root's. qemu runs in the foreground in /var/lib/scrotwmos/vm as the VM's own uid, never root, kvm its one other group, under -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny: no exec, no helper spawned, no new privilege. The uid, its gid the same number, is the start of the VM's line -vm-name:start:65536 in /etc/subuid and /etc/subgid, from the containers' window; vm create and vm clone make it, vm rm spends it, never given again. The VM's disk, seed, UEFI vars and /run/vm/name are that uid's: one VM's qemu reaches no other VM's. A VM from before its own uid, its files the vm user's, takes one at its next start or clone: each file its YAML's drives name in /var/lib/scrotwmos/vm that the vm user owns is made the new uid's, said once in its service's log. A disk its YAML names elsewhere is yours to give to that uid. After an update from before the VMs' own uids, restart each VM that is up (vm restart name), or reboot the box: a qemu still running as the vm user keeps the disk it opened. Its service, /etc/sv/vm-name, is linked in /var/service; runit starts it again after a crash. runit's own stop, sv down or the box's power off, is the VM's power button: the service's control/t sends QMP's system_powerdown and waits 60 s for the guest to power off before runit's TERM. A down file there keeps it from starting at boot. A tap on the bridge lan0: netdev: bridge,id=n0,br=lan0 and device: virtio-net-pci,netdev=n0,mac=52:54:00:12:34:01. The run makes the tap itself, as root, before it becomes the VM's uid: named swmq, the MAC's last three bytes and the NIC's number (swmq1234010), not persistent and with no owner, a port of the bridge, up; qemu gets its fd in place of the YAML's word (tap,id=n0,fd=N). A tap of that name held by a running VM, whose MAC ends in the same three bytes, refuses the start: give one of them another MAC. A bridge but lan0 and vmnat0, or a bridge NIC with no MAC, is refused. qemu-bridge-helper is not used. The install, or an update of a box with none, makes lan0 of a wired uplink, the NIC in it and dhcpcd on it and on the real NICs; a Wi-Fi uplink cannot be bridged: no lan0. Each VM on lan0 needs its own fixed MAC in mac=: qemu gives every VM the same one, and a MAC that changes is a new lease. A tap on the NAT bridge vmnat0 the same: netdev: bridge,id=n0,br=vmnat0. Every install and update lays it, on any uplink (vmnat): the host the gateway, the guests' addresses fixed, no DHCP, the subnet masqueraded out the host's uplink; guests reach each other, the host and the LAN, and nothing on the LAN opens a flow to them. A VM may have a NIC on each.

--temp, or a YAML with snapshot, runs a temporary VM, for a dirty task: qemu's -snapshot, its writes discarded. Its service is in /run, started once, never at boot, and gone after the VM stops.

name
QMP's system_powerdown, then, the VM up 60 s on, a kill; with no QMP, the kill at once. QMP that sends no reply in 5 s, its events or not, is no QMP. A kill, here or at the box's power off, leaves /var/lib/scrotwmos/vm/name.killed (a guest that did not power off: no ACPI daemon); a stop the guest ends removes it.
name
Stop, then start; a temporary VM again temporary.
[-v]
Each VM's name, state (up, temp, down), pid, uptime, boot, mac and ip; -v adds its address on vmnat0, its YAML's vmnat0 key, up or down (- when it has no NIC there), stop, kill when its last stop needed the kill (vm stop), - else, its port forwards (vm port), - none, and the image it was made over (a clone's, its source's; - for one whose YAML names none).
when it starts with the box (vm enable), off for its down file: vm disable, or a vm start never enabled; - when not linked in /var/service (never enabled, or a --temp run alone), ? when this user cannot read its service
the first mac= of a device or nic in its YAML, its first NIC's; - when none: qemu's own MAC, user net; ? when its YAML is not read or not a VM's
its IPv4 addresses while up, comma separated, lan0's first: on lan0, its first NIC's MAC's in lan0's neighbor table, read once, nothing sent, none until heard; on vmnat0, its YAML's vmnat0 key, the address create picked and seeded, its first NIC or not. - when down, or none known. The table holds the guest once it announces its address with a gratuitous ARP, as dhcpcd, NetworkManager and OpenBSD's kernel do as the lease comes: lan0-link sets lan0's arp_accept to 2: an address of lan0's subnet alone. It is the guest's word: never trust it.

Not root, ? for a VM whose state only runit's supervise, root's alone, holds; lan0: none when the box has no lan0.

A top for the VMs, on this terminal: a row each, a second apart, the rows the VMs vm list finds, scrolled to the selected one when the screen holds fewer. The columns:
the VM; a name too long for the terminal, 80 columns or wider, cut, ~ its last
, temp, down or, not root, ? as vm list says it
qemu's CPU time over the second, of one CPU: past 100 with more
qemu's resident memory
, write/s
the disks' bytes a second, QMP's query-blockstats
, tx/s
the net's bytes a second as the guest sees them, its taps summed: rx/s the taps' tx_bytes in /sys/class/net, tx/s their rx_bytes; a tap is each of qemu's /dev/net/tun fds, its fdinfo's iff
since qemu started

Sizes are humanize_number(3)'s: 340K, 1.5G. A - is no value: a VM down, its first second, its QMP not answering in the second, or no tap (user net). qemu's /proc and its taps' counters are read in a child and QMP without waiting: the screen never stalls on a VM. Keys, on the selected VM:

; Ctrl-] back to the top
, Down
select a VM
quit

start, stop and restart run beside the screen, their lines on its last line. The terminal is as it was after, whatever ends it: q, a signal, an error.

name
The VM's console on this terminal, raw; Ctrl-] leaves. The terminal is as it was after, whatever ends it: Ctrl-], the end of input, the console closed, a signal.
| name
Start the VM at boot, or not: its service without, or with, its down file. A temporary VM is never started at boot.
name image size [-s disk] [-n nics] [-p]
byol: a VM over the base image image, /var/lib/scrotwmos/vm/images/image.qcow2. Its disk, /var/lib/scrotwmos/vm/name.qcow2, is a sparse qcow2 with the image as its backing file, the VM's uid's. Its YAML is machine: q35,accel=kvm, cpu: host, display: none, then the image's fragment, image.yaml beside it, if there is one, then the size's, /etc/scrotwmos/vm/recipes/sizes/size.yaml or else /usr/lib/scrotwmos/vm/recipes/sizes/size.yaml; a key in a later one replaces an earlier one's values. The sizes: small 1 CPU, 1G, a 20G disk; medium 2, 4G, 40G; large 4, 8G, 100G. A size's disk key is the disk's size, not a qemu option; -s gives another. Then the disk's drive, the seed's (read-only), and each NIC's net and device are added. -n picks the NICs: lan0 (bridge,id=n0,br=lan0), vmnat0 (bridge,id=n0,br=vmnat0), or both (lan0's n0, then vmnat0's n1); a bridge the box has not is refused. No -n: lan0 when the box has it, else user,id=n0. A NIC on vmnat0 gets an address from 10.83.87.2 to .191 (the rest left free), no other VM's YAML's: the one past the highest taken, else the lowest free, so a removed VM's comes back last. It is the YAML's vmnat0: 10.83.87.x, the tool's, not qemu's, and goes to the seed; there is no DHCP on vmnat0. The MAC is 52:54:00 and the first three bytes of the name's sha256, or, when another VM's YAML has that one, of the name with #1, #2, ... update: boot in the YAML is the tool's, not qemu's: it goes to the seed. vars in an image's fragment is the tool's too: a UEFI vars template, copied to /var/lib/scrotwmos/vm/name.vars.fd, the VM's uid's, its pflash drive added; vm clone copies it, vm rm removes it. A random password is made; -p asks for one, no echo. An existing name is refused. -n vmnat0 or both over an image from before vmnat0 is refused: its fragment has no seed: 2, and its first boot would set no address. Create and clone hold /var/lib/scrotwmos/vm/.lock from the names, MACs and addresses they read to the YAML they write, and no longer: two at once take two addresses, and one that waits says vm: waiting for another vm create or clone. -p asks the password before. The build after it, the disk, vars, password and seed, holds /var/lib/scrotwmos/vm/name.build: vm rm, vm start, another create of name, and a clone to it or from it refuse, <name>: being built. The VM is in vm list while it builds; a build cut short leaves its YAML and its address held, or, cut before its YAML, its build file alone, and vm rm takes either. A VM's YAML that create or clone cannot read stops it, the file named: its address would be given again.

The seed, /var/lib/scrotwmos/vm/name.seed.img, is what the image's first boot reads: a vfat file system, label SWMSEED, no partition table, made by qemu-img's vvfat driver, no mount. Its files hold one value each, no newline after it:

hostname
the VM's name
user
the byol user, SWM_USER of /etc/sv/swm-wl/run
authorized_keys
that user's own key, ~/.ssh/id_ed25519.pub, alone: the VM is the box's, its login the box user's. With none, or an empty one, vm create and vm clone refuse; a passphrase on it is the user's to choose (ssh-keygen -t ed25519).
update
or no
id
32 hex digits, new each create and clone: a new one makes the guest make new ssh host keys and machine-id
passhash
the password's bcrypt hash; never the password
nat_mac, nat_addr, nat_gw, nat_dns
only when the VM has a NIC on vmnat0: its MAC, its address (10.83.87.x/24), the gateway (10.83.87.1), and the resolver, the gateway again: vmnat sends its 53 on to the host's. A VM made before keeps the host's resolver at its create till made again. The image's first boot sets that NIC static, found by its MAC; its default route after a DHCP NIC's.
Each image's first boot mounts the seed root's alone, lays authorized_keys as the user, never as root, and sets passhash in no argument a ps(1) shows.
src dst
A full copy of the stopped VM src: its disk by qemu-img convert, no backing file; its YAML with dst's disk and seed, a new MAC for each NIC, a new address on vmnat0 when it has one; a copy of its UEFI vars, if it has them, no larger than its image's template; a new seed and password; a new uid. The copy runs as dst's uid in src's group, which reads src's disk alone. Refused while src is up or being built (<src>: being built), or when dst exists.
name [-k]
The VM's YAML, service, seed, UEFI vars, password (zeros written over it first) and disk, and its uid spent; -k, before or after name, keeps the disk, its owner the spent uid. Refused while the VM is up.
name
The VM's password, /var/lib/scrotwmos/vm/name.pass, root's alone.
name add | proto:host:guest
A port forward to the VM, added to or removed from its YAML's forward list: proto tcp or udp, host the host's port and guest the VM's, 1 to 65535. A packet from any device but vmnat0 and a session's port, from a source off 10.83.87.0/24, to one of the host's own addresses on that port goes to the VM's vmnat0 address and its port; the host's own connection to its own address too, but to a loopback address. Then vmnat is sent its HUP to lay them; not running, its next start does. Refused: a VM with no vmnat0 address, a host port another VM or container forwards, one the host listens on, and the box's own whether one listens or not: TCP 22, TCP and UDP 53, UDP 67, 68, 123, 546 and 547; a lay skips these too. ct port is the same for a container. vm rm of a VM with forwards or a vmnat0 address sends the HUP; vm create and vm clone give none.
Each base image's name, size and date.
image
The image, its .sha256, .log and .yaml. Refused while a VM's disk has it as its backing file.
[--repo url] [--dir dir]
A Void base image for vm create, made on this box: nothing mounted, no installer. Into /var/lib/scrotwmos/vm/images (or dir): void-YYYYMMDD.qcow2, 8G, sparse, 0444; its .sha256, .log, and .yaml, the qemu options it needs beyond vm create's. Its packages from the box's mirror (or --repo), signatures checked: base-minimal, linux, openssh, dhcpcd, opendoas, openntpd, e2fsprogs. The build runs as root of a user and a pid namespace of its own, its ids the build range scrotwmos-build in /etc/subuid and /etc/subgid, never as the box's root: the packages' scripts, dracut, GRUB's tools, sfdisk, mke2fs and qemu-img run there, with no tty, and Landlock lets them write only in the build's work directory and to /dev/null. A kernel without Landlock refuses the build. The work directory is in one of root's, 0700, that only the range's first uid may pass (a POSIX ACL); a file system without POSIX ACLs refuses the build. The range is 65536 ids or more, from 100000 up and below the uids scrotwmos gives sessions and their services; it meets no other line of its file and holds no uid of /etc/passwd or gid of /etc/group (those files alone: LDAP and other NSS sources are not read). Without one, the build is refused before it starts. The install and update lay it when it is missing, at the lowest free start, a multiple of 65536. GRUB boots it by BIOS; its console is hvc0. At each boot it reads its seed, a FAT file system labeled SWMSEED: hostname, user, authorized_keys, passhash (bcrypt, the user's password: the console and doas), update (boot: xbps-install -Syu), id (a new one: new host keys and machine-id). Each boot it grows its root to the disk's end, partition and ext4: vm create's disk is larger than the image. sshd takes keys alone, never root. A second build the same day is refused: its image is there already. It is run by root and needs xbps-install, sfdisk, mke2fs, chroot, usermod and qemu-img; GRUB comes from the mirror into a tools root of its own.
[--dir dir]
A base image for vm create, by its OS's unattended net install from a recipe, its OS's version in its name; a new version is a new name. The release's CHECKSUM is fetched and checked by gpgv(1) against the release's key, baked in; the netinst kernel, initrd and installer image (images/install.img) are fetched and checked against the recipe's sha256s. Any mismatch: nothing built, no qemu run. Then a temporary qemu, user-mode net alone, installs the OS into a new sparse qcow2, 16G, from a kickstart and the checked installer image its guestfwd serves (swmtool vm image serve); the packages come from the release's mirrors, each one's signature checked against the same key before any is laid down; a bad one fails the install. The build ends when qemu exits. fedora-45.qcow2, 0444, boots by BIOS; beside it .sha256, .log, the install's console, and .yaml, the qemu options the OS needs past a VM's own: no machine, CPU, memory, disk or net. Into /var/lib/scrotwmos/vm/images (or dir), made root's 0755 when missing. The fetches and the install run as for void: root of namespaces of their own, the build range's ids, never a VM's uid. For KVM the host's kvm group is mapped past the range and is the work's one group, and Landlock lets it write /dev/kvm too. No /dev/kvm (no kvm module, or nested virtualization off), or no kvm group or one of gid 0: refused before anything is made. The image is root's. It needs qemu, qemu-img, curl and gpgv.

Each boot it grows its root to the disk's end, partition and ext4: vm create's disk is larger than the image. Then it reads its seed: a FAT12 file system on a whole disk, labeled SWMSEED, its files hostname, user (made in wheel), authorized_keys, passhash (a bcrypt hash: the console's and sudo's password; sshd takes keys alone), update (boot: dnf upgrade once a boot, or no), and id: a new one makes new ssh host keys and a new machine-id.

[--dir dir]
A base image for vm create by OpenBSD 8.0's autoinstall, under UEFI. SHA256.sig from cdn.openbsd.org is checked against OpenBSD 8.0's signify key, baked in, then each file fetched against it: cdbr, cdboot, BOOTX64.EFI, bsd.rd, bsd, bsd.mp, base80, comp80, man80, BUILDINFO. Any mismatch: nothing built. An ISO of cdbr, cdboot and bsd.rd, by mkisofs(8), boots by BIOS and UEFI, its console com0. A temporary qemu, OVMF (qemu's firmware JSON) and user-mode net alone, boots it with a new sparse qcow2, 12G; the tool answers the CD's (I)nstall, (U)pgrade, (A)utoinstall or (S)hell? with a; the installer reads its answers and the sets from guestfwd (swmtool vm image serve). Root's password is locked; its ssh key is the build's own, for one prep boot that lays the seed's script and takes the key, that boot's host keys and random seed out again. openbsd-8.0.qcow2, 0444, with .sha256, .log, both boots' console, and .yaml: UEFI, the console a serial port, no VGA. As for fedora-45, the work runs as the build range's root, with kvm, and the image is root's. It needs qemu, qemu-img, qemu-firmware, curl, ssh and mkisofs.

/ is 8G and does not grow; /home is the disk's last partition and grows to its end each boot, before sshd, once vm create's disk is larger. Each boot it reads its seed, the sd with no DUID and 2880 sectors: hostname, user (made in wheel; doas permit persist :wheel), authorized_keys, passhash (a bcrypt hash: the console's and doas's password; sshd takes keys alone), update (boot: syspatch and pkg_add -u each boot, or no), and id: one not the kept one makes new ssh host keys and a new random seed.

lan0-link
byol's service /etc/sv/lan0-link, not a command to type: lan0 follows its NIC's carrier. A bridge has carrier while any port has, and a VM's tap keeps it with the cable out: dhcpcd would keep lan0 's lease and default route, over Wi-Fi's. The NIC loses carrier, lan0 goes down and dhcpcd drops its lease; the carrier back, lan0 goes up. Each new lan0 gets arp_accept 1: a guest's gratuitous ARP of its address is a neighbor entry, its MAC and address, for vm list. No lan0: nothing.
byol's service /etc/sv/vmnat, not a command to type: the NAT bridge vmnat0, laid at each boot and watched. The bridge made when missing, its MAC 02:00:0a:53:57:01; its address 10.83.87.1/24, the guests' gateway; IPv6 off on it; IPv4 forwarding on; then the rules, in the table swm-nat over netlink, no nft: the subnet masqueraded out any other device, from vmnat0 an invalid or untracked packet and a source not of the subnet dropped, into vmnat0 from any other device nothing that is no reply, no IPv6 through it; UDP and TCP 53 from vmnat0, from the subnet, to the gateway sent on to the host's resolver, the first IPv4 server of /etc/resolv.conf a guest can reach and not on the subnet, the port kept; nothing else sent there. With none (no file, no IPv4 server, a loopback stub alone such as systemd-resolved's 127.0.0.53, link-local, or on vmnat0), UDP and TCP 53 from vmnat0 to the gateway's address is dropped, and said once with why: “no DNS”. Only that is dropped: a DNS server of the host's still answers a guest on the host's other addresses, as any port of the host's does. Each guest is pinned, in the bridge family's table swm-nat, laid before vmnat0 comes up: a frame in from a port of vmnat0 passes only as its guest's own, from the VMs' and containers' YAMLs. IPv4 from a guest's MAC with that guest's address; ARP Ethernet's for IPv4, its source and sender MAC a guest's with that guest's address, or a probe's (sender 0.0.0.0) from a guest's MAC whose sender MAC is its source; nothing else: no IPv6, no VLAN tag, no other type. A container's port (swmc*) and a VM's tap (swmq*) send their own MAC alone, and a guest's MAC comes from its port alone. Out a port, at the bridge's forward and the host's own output, a guest's MAC goes to its own port alone, and a VM's tap takes no unicast frame but its guest's. A frame to a link-local destination is dropped at the bridge's input, and no MAC is learned from one. So no container takes another guest's address or MAC, and no guest a free address or the gateway's. A guest with no YAML sends nothing; a second YAML at an address taken is not pinned, and said. A second YAML with a MAC taken is not pinned either. vm create, vm clone, vm start, ct create and ct clone send the service its HUP, which pins the new guest; the new pins take over at once, whole, from the old. lan0 is the LAN's: a root container's port there is not pinned; a VM's tap is, by its MAC alone, and sends no DHCP server's (UDP from 67), router's advertisement or DHCPv6 server's (UDP from 547) frame. The holder of a tap's fd may set the tap's MAC, and the bridge would then send it that MAC's frames: the service watches the links and deletes a VM's tap whose MAC was set since it was made, said. Each step sets what it sets: a run again changes nothing. No DHCP: vm create picks each guest's address. Then it watches, no timer: it joins nftables' change group before the first lay, and on each deletion it hears of, nft flush ruleset or a stop or restart of Void's nftables service, whose finish flushes the ruleset, it counts its rules, each chain's, and lays them again when one is gone or off, then flushes the flows a host outside opened into the subnet meanwhile; said the first time, then at the 2nd, 4th, 8th ... time with the count. Void's nftables service's load at boot is such a flush: no wait. With no /etc/nftables.conf that service's run exits at once and runit runs its finish, a flush, each second: said, and every rule on the box goes each second, vmnat's back each time; give nftables a conf, or turn it off. It watches /etc/resolv.conf too, inotify on /etc and on the directory a link names, or on its nearest ancestor while that directory is not made yet: written in place, replaced by rename, or a link turned to another target, it is read again a quarter second after the last change, the DNS rule alone laid again for the new resolver, the DNS flows to the gateway flushed from conntrack so the next query is the new resolver's, and the resolver said, one line. Its HUP (vm port, ct port, a removal of a guest with forwards, or sv hup vmnat after a YAML edited by hand) reads every VM's and container's YAML again and lays the port forwards alone again, then flushes from conntrack the flows to the host's own addresses on each added or removed forward's port, said: from any device but vmnat0 and a session's port, from a source off its subnet, a packet to one of the host's own addresses on a forward's protocol and port DNAT'd to its guest's vmnat0 address and port, at prerouting; the host's own the same at output, but to a loopback address; and accepted into vmnat0. The forwards are counted and laid again with the rest after a flush, eight to a transaction. A forward of a guest with no address, on a host port one before took, or on a port the host listens on by then, is skipped and said; a YAML not read or not parsed is skipped and said, its guest's forwards none. The pins and the rules are laid before vmnat0 comes up, IPv4 forwarding after them. A failure to lay, to read the rules, to flush or to write the DNS rule is said in its log, svlogd's in /var/log/vmnat, vmnat0 is taken down, said, and the run ends a minute on: runit runs it again, which lays the rules and brings it up. IPv4 forwarding is the box's, every link's, not the bridge's alone; a byol VM session sets it too. These rules and the session NAT's, whose forward chain drops a flow into a session's client from any other link, hold what crosses into and out of vmnat0 and the sessions' ports, so a guest opens no flow to a client; between two other links of the box no rule of byol's stands.
[--temp] name
byol: run the container name, a Void root under runit with no kernel of its own. The container is its root, /var/lib/scrotwmos/ct/name/root, in a wrapper, /var/lib/scrotwmos/ct/name, root's, its group the range's, mode 0710: no other host user reaches the root. Its YAML is /var/lib/scrotwmos/ct/name.yaml. A root in the old layout, the range's own /var/lib/scrotwmos/ct/name, is moved into its wrapper, and said, before start, restart, enable, exec, clone or rm takes it. A root made before the host set its NICs has its own dhcpcd on: its first start since takes that service link away, says so, and marks its wrapper, so it is done once. A dhcpcd link the container lays after that is its own and stays. The YAML is read as a VM's is: one map of plain or quoted scalars and lists, with no YAML typing. Its keys are the tool's, not a command line:
the program the container starts, as its uid 0. A list's item is one argument; a scalar is split at blanks; 32 words at most. The first word must be an absolute path. Refused: a program named init, runit or runit-init, and any path under /etc/runit/: runit's stages are the box's work. Not given: /usr/bin/runsvdir -P /etc/runit/runsvdir/default, which runs every service the root has on.
the cgroup's memory.max: bytes, or digits with K, M, G or T. With it, memory.swap.max is 0.
its cpu.max, 1 to 1024 CPUs.
its pids.max, 1 to 4194304.
, a loopback alone; host, the host's network; lan0; vmnat0; or a list of lan0 then vmnat0, each once.
one MAC for each NIC, in the order of net, each of the pool's, 52:54:00:xx:xx:xx.
the NIC's address on vmnat0: required with a NIC there, refused without one.
the NIC's address on lan0, addr/bits via gw, then dns addr if it names its resolver; or dhcp, the host its DHCP client: required with a NIC there, refused without one. A container made before the host set its NICs has net: lan0 and no lan0 key: its start is refused and says the line to add.
host:path or host:path:ro, each absolute, with no . or ..: a host directory or file seen at path, which must exist in the root, and not under /proc or /sys, nor /dev itself. Under /dev, the container's own, the host side must be a character device, as /dev/dri/renderD128; its file and directories there are made first, and anything else is refused at start. No link may be in the host path, and the container's ids must reach it. 32 at most.
the port forwards that ct port adds.

The container's root is uid 0 of a user namespace over 65536 ids of its own, from 2^30 up: a line -ct:start:65536 in /etc/subuid and in /etc/subgid, a name no account has, so newuidmap maps it for no one. Host root never runs in it, and its ids are nobody's on the host. The two files hold 64K each: some 1400 containers; past that, ct create and ct clone are refused. Its service, /etc/sv/ct-name, runs as root only to lay the cgroup /sys/fs/cgroup/scrotwmos-ct/name with its limits, to make /run/ct/name and the NICs, and to fork the process that writes the container's id maps and moves the NICs into it. Then it runs as the container's own run uid for good, never root: the start of its line -ct-name:start:65536 in /etc/subuid and /etc/subgid, its gid the same number, from the same window; ct create and ct clone make it, ct rm spends it, never given again. /run/ct/name and its cgroup are that uid's: one container's run reaches no other container's. A container from before its own run uid takes one at its next start, said once in its service's log, and its range's ct: lines, the ct user's, become -ct: lines, said. After an update, restart every container: till then its old run is the ct user's, and a break into it reaches every container not yet started again. runsv starts it again after a crash. A down file keeps it from starting at boot.

The container has its own mount, pid, UTS, IPC and cgroup namespaces, and its own net namespace except with net: host. It runs under a seccomp filter that refuses, among others, every namespace, mount, module, key, BPF and clock call. A denied argument is compared by its low word alone, the int the kernel reads, so a value with its high word set is no way past a rule. A NIC on lan0 or vmnat0 is a veth: its host end, named swmc, the MAC's last three bytes and the NIC's number (for example, swmc4b5e570), is a port of the bridge; its other end is the container's ethn. The host sets each NIC before init: lo up, then ethn's address and a default route from the YAML. A NIC on lan0 takes its lan0 key's address and gateway, with IPv6 on and the router's advertisements taken, so SLAAC, link-local and mDNS work; a NIC on vmnat0 takes its vmnat0 address, a route through 10.83.87.1 at metric 2000 (after lan0's), and no IPv6. On lan0: dhcp the host runs the tree's own DHCP client for it, in its net namespace (a keeper the run's uid's with CAP_NET_ADMIN alone, its engine its own uid, 499999, which must be no account's and on no /etc/subuid or /etc/subgid line): the lease's address and route, held to the rule of a static address, renewed while the container runs, taken off when lost; a lease refused costs the address, never the keeper; its resolver in /var/lib/scrotwmos/ct/name/resolv.conf, bound read-only over the root's /etc/resolv.conf. No container runs a DHCP client, and none keeps CAP_NET_ADMIN or CAP_NET_RAW: it changes no link, address, route, qdisc or filter, opens no raw or packet socket, and makes the kernel load no module for one. The filter also refuses an nftables or xfrm netlink socket, an old table's write (iptables, ip6tables, arptables or ebtables) by (), and an AF_ALG or AF_VSOCK socket. ping goes by ping_group_range: a container with a net of its own, its own; on net: host, the host's. On net: host the container has no /sys, and a Landlock scope keeps it from the host's abstract sockets; that needs Landlock ABI 6.

The limits: a container shares the host's kernel, and a kernel bug is a way out that a VM does not have. On net: host it binds no port below 1024: that network is the host's user namespace's. Moving the ids drops file capabilities.

Refused: a YAML that does not read, a root owned by root or not in its range, and a container up in the other mode (--temp or not). When the container is not up in 15 s, start says so and names its log, /var/log/ct-name/current.

--temp runs it over a tmpfs: an overlay on its root, its writes in memory (at most its memory, else 1G), gone when it stops. Its service is /run/ct/name.sv, started once, never at boot, and gone when it stops; its log is /var/log/ct-name.temp.

name
runit's stop: each of the container's services down by its runsv (runit's stage 3), or a TERM to any other init. 60 s on, the run kills its cgroup, and 75 s on, stop does if the run has hung; ct list -v then says kill.
name
Stop, then start; a temporary container again temporary.
[-v] [-a]
Each container's name, state (up, temp, down), PID, uptime and boot, as vm list says them. -v adds:
, host, lan0, vmnat0 or both
its address on lan0: its static one, or, on dhcp, the lease's while it holds one and is up, dead when its DHCP keeper ended before it; - none
its range's first id, its root's owner
when its last stop needed the cgroup's kill, - else
while up, its NICs' IPv4 addresses in their order, comma separated: on vmnat0, its YAML's, or for a user's container vmnat's record's; on lan0, its static one or its lease's. vmnat's record and lease are root's, their directory readable by the user's own group alone, so a user's own list reads them and no other user's. - when down or with no NIC, ? for one not known
its forwards
its root's blocks used and its disk limit, 1.2G/10G; - with no limit or the project quota off; ? for a user, whom the kernel tells no project's numbers
A ? is a YAML or a root that does not read. As a user, ct list lists their own containers alone. -a, root's alone, adds an owner column after the name, and each allowed user's containers after root's, read by what is root's alone, their place's roots/ and their cgroup, never their own files: a row's state and PID its cgroup's, its range its root's owner, its ip vmnat's record's and lease's, its boot and -v's other YAML words ?.
[-a]
's screen, keys and terminal for the containers ct list finds, with mem in place of rss and each number from the container's cgroup, /sys/fs/cgroup/scrotwmos-ct/name:
cpu.stat's usage_usec over the second, of one CPU: past 100 with more
memory.current
, write/s
io.stat's rbytes and wbytes, its devices summed
, tx/s
the host ends of its NICs, swmc, as a VM's taps: rx/s their tx_bytes, tx/s their rx_bytes
since its run started

A - is no value: a container down, its first second, no NIC (net: none or host), or a controller the box could not give its cgroup: io and memory are asked for, and a refusal is said in its log, fatal only for a limit the YAML sets (cpus, memory, pids). Not root and not allowed, every state is ? and the status line says not root: states unread. Keys, on the selected container, as vm top's: u ct start, d ct stop, r ct restart, c ct console (Ctrl-] back to the top), Up, Down and q.

An allowed user's ct top shows their own containers. -a, root's alone, adds each allowed user's after root's, a row user/name, its numbers its cgroup's, none of its NICs'; u, d, r and c on such a row are refused: they are the user's to use.

name
The container's console on this terminal, raw: /dev/console, its init's output. A container from ct image build void runs Void's agetty-console there, a login: prompt (TERM xterm-256color); press Enter for a fresh one. ct create turns it on in a container from an older image that ships the service. Under runit's runsvdir, init leaves the console free for that getty, as Void's stage 2 does. Ctrl-] leaves. The terminal is as it was after, whatever ends it: Ctrl-], the end of input, the console closed, a signal.
name [command ...]
command in the running container, as its uid 0, in its namespaces, its cgroup and its filter; /bin/sh -l when none. It always has a session of its own: with no pty, it has no controlling terminal. Each of the caller's terminals among the standard input, output and error is a pty of the container's; the others pass as they are, so ct exec web sh -c 'cat > f' < f copies a file in. A file it writes is the container's.
| name
Start the container at boot, or not: its service without, or with, its down file. A temporary container is never started at boot.
name image size [-n net] [-a addr/bits via gw [dns addr]] [-d disk] [-P pkg,...] [-p]
byol: a container from the image /var/lib/scrotwmos/ct/images/image. Its root is a copy, reflinked where the file system can, with each id moved into a new range. Its YAML is its size's, /etc/scrotwmos/ct/recipes/sizes/size.yaml, or else /usr/lib/scrotwmos/ct/recipes/sizes/size.yaml: small 1 CPU, 1G, 1024 pids and a 10G disk; medium 2, 4G, 4096 and 40G; large 4, 8G, 16384 and 100G.

The disk is a hard limit on the root's blocks, and on its inodes, one per 4K of it: an XFS project quota. A write past it fails with ENOSPC, as XFS answers a project's limit. It holds against the guest, not against host users: see ct allow. The root takes the project id its range's first id / 65536, laid with inheritance on the directory the copy is made in, before the copy, so every file in the root has it; a copy past the limit fails. -d disk, bytes or digits and K, M, G or T, replaces the size's. The limit is kept, root's, in /var/lib/scrotwmos/ct/name/disk, not in the YAML, and laid again at each start. When the root's file system is XFS mounted without prjquota, create says “disk quota: off until reboot” and goes on; the id is laid all the same. byol's install puts rootflags=prjquota on the kernel's command line and update adds it, so quota is on from the next boot. Not XFS, it says “disk quota: none, not XFS”.

-n is lan0, vmnat0, both, none or host. A NIC on lan0 takes its address from -a, written as its YAML's lan0 key: an address and its prefix, its gateway, and its resolver if given, for example -a '192.168.1.50/24 via 192.168.1.1 dns 192.168.1.1'. lan0 without -a is refused, and so is -a without a NIC on lan0; -a dhcp: the LAN's DHCP server leases it, the host its client. Not given: lan0 when -a is (refused when the box has no lan0), else vmnat0, else none, and it says so. A lan0 address another container holds is refused. A NIC gets a MAC, and on vmnat0 an address, from the pool the VMs take theirs from. The root's /etc/resolv.conf is never the image's: the lan0 key's resolver when it names one; else on vmnat0, its gateway, 10.83.87.1, alone (vmnat sends its queries on to the host's resolver); else a copy of the host's. A random password is made; -p asks for one, with no echo.

The seed, the VM seed's files, goes in the root's /etc/swmseed. With the default init, the root's rc.local reads it at each start, before runsvdir, and lays: the byol user, SWM_USER of /etc/sv/swm-wl/run, with that user's own key, ~/.ssh/id_ed25519.pub; the password's hash; the hostname; and the NIC's static address.

-P installs the packages, separated by commas, with xbps-install in the container as its root before it is first used, then turns on each service they ship. It is one run on the host's network, by a mark that run takes, with the host's resolver bound over the root's for it; the YAML and the root's resolver are not touched, and a later start never takes the host's network. When it fails, the container stays, made; remove it with ct rm.

The copy is made in /var/lib/scrotwmos/ct/.new.name and moved to its name only once its ids are its range's: a create that is cut leaves that directory and its range, and ct rm name takes both. Refused: a name already taken, no image, no size, no byol user or key.

src dst
A full copy of the stopped container src in a range of its own: its YAML, with new MACs, a new vmnat0 address and no forwards; a new seed and password. Its disk limit is src's. Refused while src is up, when dst is taken, or when src has a NIC on lan0: its address is src's.
name [-k]
The container's YAML, service, password (zeros written over it first), cgroup, /run/ct/name, root, and its range freed, its disk limit gone, its run uid spent (-k too); for a container with forwards, vmnat is sent its HUP. -k, before or after name, keeps the root and its range: a later ct rm name takes both. Refused while it runs. When its cgroup still holds a process, rm removes the service, keeps the YAML, the password, the root and the range, says so and exits 1: a new container must not get that process's ids.
name
The container's password, /var/lib/scrotwmos/ct/name.pass, root's alone.
name add | proto:host:guest
for a container; refused without a vmnat0 address.
Each image's name, size (always -: an image is a directory), date and sum: yes when its .sha256 is there, - when not (an image built before sums). ct image check reads the tree.
image
The image's tree summed again against ~ image.sha256, its sum when it was built: each entry's path, type, mode, owner, group, xattrs, a file's size and content's sha256, a link's target, a device's number, a hard link's first path, sorted by path, no link followed. ok exits 0; bad, or no sum, exits 1. ct create sums its copy of the image before any id moves and refuses one that is not the sum's, and refuses an image with no sum: build it again.
image
The image, its .log and its .sha256. A container made from it does not stop it: a container is a copy.
[--repo url]
A Void root for ct create, named void-yyyymmdd, built as vm image build void builds a VM's, in the build range: base-minimal, openssh, opendoas and xbps, sshd and the console's getty on (ct console), no kernel and no DHCP client.
user [-m size] [-p pids] [-d disk] [-f ports] [-l lan0]
Lets user have containers of their own, run as them: their record, /var/lib/scrotwmos/ct-users/user.yaml, root's, with their uid, the limits and the grants; -m and -p the limits all their containers share (their runsvdir-user tree alone: a namespace they make from a login shell is not under them); -d, 1G at least, the cap of their disk: their place's own 1G and their roots' limits summed, a create or clone that would pass it refused; -f the host ports their forwards may take, a comma apart; -l, one each time it is given, up to 8, a lan0 address one container of theirs holds at a time, addr/bits via gateway, then dns addr if it names its resolver, or dhcp; their place, /var/lib/scrotwmos/ct-users/user/; the service runsvdir-user, which at each boot sets their cgroup, scrotwmos-ct-users/uid, and runs their containers' services as them; and ctplace, the root service their ct create, clone and rm ask to make, copy and remove a root. It says
user: allowed, uid uid, n port(s), n lan0(s)
with “memory limited”, “pids limited” and “disk capped” after the uid when -m, -p or -d is given. Their place takes a project id of its own, 65536 plus their uid, its limit 1G, for their YAMLs, seeds, services and logs; each root its own, as root's, laid by ctplace. The limits hold against the guest, which as root of its own user namespace cannot change a project id. They do not hold against the owning user, nor any host user: a user who maps their range and their uid in a namespace moves a root's files off its id, and any host user can set a project id on a file of their own and fill a container's limit with it. A wall against host users needs a store where no host user owns a file. Without -d, an allow again keeps the cap. A user's create needs a limit: a size with a disk, or -d. Allowed already: the limits replaced; a kind of grant given, -f or -l, replaced, each old one not given again said, user: port port no more granted or user: lan0 lan0 no more granted; a kind not given kept. As user, ct create with -n none, host, lan0, vmnat0 or both, and -a dhcp with lan0, start, stop, restart, console, enable, disable, list, top, exec, pass, clone, rm and port work on their own containers; -a's address, -P, -p, --temp and ct image stay root's. Each create and clone takes a new range in their name; a user's create says no address: vmnat picks it.

A user's container on a bridge takes its NICs from vmnat, root's: their run hands vmnat, on /run/ct-nat.sock, the container's net namespace; vmnat checks that it is theirs, makes the veth, picks its MAC and vmnat0 address, keeps them in its own record of the container, and pins its port to them; the user's YAML asks for a NIC, never names one. lan0 and forwards are root's grants at ct allow, off until then. lan0: a static grant no other container of theirs holds, or, with -a dhcp and the dhcp grant, a DHCP keeper in the container's namespace, in a cgroup of its own; vmnat learns the lease on the host's side, from the LAN server's DHCPACK the bridge sends out the container's port, never from what the namespace hears, and pins the port to it while it holds. On a user's lan0 port, IPv6's router advertisements and DHCPv6 server replies are dropped, and its source is pinned to its MAC's link-local and SLAAC address, or :: for DAD. Forwards: ct port on the granted host ports alone, never a port a root's guest holds; vmnat checks. A user's ct top shows no NIC numbers for a container whose YAML only asks for NICs: their names are vmnat's.

A user's ct clone, the source down, takes a new range; the place helper's child, the root of a user namespace that maps both ranges and no host id, copies the root and shifts it into the new range. The source's forwards and MACs are not kept. ct rm asks ctplace to remove the root, its range retired; -k keeps the root and the range. Root's walls against a user are vmnat's and ctplace's checks, the pins, the grants and the cgroup's limits: a user runs their own pid 1, so the container's own walls guard the guest, not the host.

user [-f] [-k]
Undoes ct allow: refused while a container of theirs is up, -f stops them. Then their service and cgroup go, every process with an id of their ranges is killed, the ranges are retired for good (named - in /etc/subuid and /etc/subgid), and their record and place are removed; -k keeps their roots, root's to take or remove.
[--temp] name, vm term name, vm image serve dir path ..., ct run [--temp] name, ct finish name, ct userboot user, ct placed
Not commands to type. vm run is a VM service's run: qemu, exec'd as the vm user. vm term is its control/t, the power button runit's stop presses. vm image serve is a build's guestfwd: one HTTP request from the guest on the standard input, a GET of one of the paths in dir, answered on the standard output; anything else is 404. ct run and ct finish are a container's service's run and finish: ct run starts the container; ct finish removes what its run left. ct userboot user is runsvdir-user's run; ct placed is ctplace's.
List the commands, one line each. man swmtool shows this page, on the stick too.

keys.wrap
on the ESP: one entry for each username
/swmdata/images
the store of every world's images
/swmdata/images/root.img
on a byol, the root's image; beside it root.next.img, a rollback not yet booted, and root.prev.img, the root before the last rollback
/swmdata/images/tt/
on a byol, the root's points and its place's record
/points/hour
on a byol, a point mounted read-only (tt mount)
/run/ttd.sock
ttd(8)'s socket, root's, which tt asks
/usr/local/release/kernels
in rescue's root: the release's VM kernels, for the worlds it adds; update-root replaces it with the kernels it laid
/scrotwmos
in rescue, dom0's tree, read-only: ttvm place boots
/mnt/user
's root, home, and point, and place open's place
/run/plan
the plan, on the install stick
/run/install.log
the install log, on the install stick

byol's VMs:

/var/lib/scrotwmos/vm/name.yaml
the VM: qemu's command line, 0644
/usr/lib/scrotwmos/vm/recipes/sizes/size.yaml
's sizes: small, medium, large
/etc/scrotwmos/vm/recipes/sizes/size.yaml
your own sizes, read first
/var/lib/scrotwmos/vm/name.qcow2
the VM's disk, its uid's, 0600
/var/lib/scrotwmos/vm/name.seed.img
the VM's seed, its uid's, 0400
/var/lib/scrotwmos/vm/name.pass
the VM's password, root's, 0600
/var/lib/scrotwmos/vm/name.killed
there when the VM's last stop needed the kill (vm stop)
/var/lib/scrotwmos/vm/.nat_top
the last vmnat0 address create or clone gave, root's: the next is past it, so a removed VM's comes back last
/var/lib/scrotwmos/vm/name.vars.fd
the VM's UEFI vars, for a UEFI image alone, its uid's
/var/lib/scrotwmos/vm/images/image.qcow2
a base image, 0444, never changed; beside it .sha256, .log, and, when the OS has one, .yaml
/etc/sv/vm-name
the VM's runit service: run, control/t, runit's supervise, and a down file unless enabled
/var/service/vm-name
its link, once started or enabled
/run/vm/name.sv, /var/service/vm-name.temp
a temporary VM's service and its link, gone when it stops
/run/vm/name
the vm user's, 0700: qmp and console, the VM's sockets
/etc/runit/shutdown.d/06-vm.sh
the box's power off presses each VM's power button, and stops each container, first
/var/lib/scrotwmos/ct/name.yaml
the container, 0644
/var/lib/scrotwmos/ct/name
its wrapper: root's, its group the range's first gid, 0710, so no other host user reaches the root
/var/lib/scrotwmos/ct/name/root
its root, its range's
/var/lib/scrotwmos/ct/name/disk
its disk limit, bytes, root's, 0644; a user's in their roots/name
/var/lib/scrotwmos/ct/name/hostnics
root's: the host sets its NICs, its own dhcpcd taken off once, or never on
/var/lib/scrotwmos/ct/name/resolv.conf
's resolver, root's, 0644: the lease's name servers, written by the host's DHCP client, bound read-only over the root's /etc/resolv.conf
/var/lib/scrotwmos/ct/name.pass
its password, root's, 0600
/var/lib/scrotwmos/ct/name.pkgnet
's mark, root's: its one run on the host's network, which that run takes
/var/lib/scrotwmos/ct/.new.name
a create or clone not yet done, root's, 0700: ct rm takes it and its range
/var/lib/scrotwmos/ct/name/root/etc/swmseed
its seed, its range root's, 0400
/var/lib/scrotwmos/ct/images/image
an image, never changed; images root's alone, 0700; beside it .log and .sha256, its sum when it was built, 0444
/usr/lib/scrotwmos/ct/recipes/sizes/size.yaml
's sizes: small, medium, large
/etc/scrotwmos/ct/recipes/sizes/size.yaml
your own sizes, read first
/etc/sv/ct-name, /var/service/ct-name
its runit service: run, finish, log/run; and its link
/run/ct/name.sv, /var/service/ct-name.temp
a temporary container's service and its link
/run/ct/name
the container's run uid's, 0700: pid, console, killed when its last stop needed the kill, and lease, lan0: dhcp's address while it holds one
/var/log/ct-name, /var/log/ct-name.temp
its service's log, svlogd's, and a temporary run's
/sys/fs/cgroup/scrotwmos-ct/name
its cgroup: its limits, root's; ct, the container's; keeper, lan0: dhcp's DHCP keeper and engine, killed at the run's end
/var/lib/scrotwmos/ct-users/user.yaml
an allowed user's record, root's, 0644: ct allow's uid, limits and grants, the host ports of -f and the lan0 addresses or dhcp of -l
/var/lib/scrotwmos/ct-users/user
their place, root's, 0711: roots/, root's, 0711, each name in it a container's wrapper, root's, its group the range's first gid, 0710, and in the wrapper root, the container's root, its range's; ct/, the user's: their containers' YAMLs, seeds, passwords and services
/etc/sv/runsvdir-user
their containers' runsvdir, root's service, run as them; at each boot it lays their cgroup and /run/ct-users/user
/run/ct-users/user
the user's run directory: each container's pid and console
/etc/sv/ctplace, /run/ct-place.sock
the place helper's service and socket, root's: a user's create's copy and shift
/sys/fs/cgroup/scrotwmos-ct-users/uid
an allowed user's cgroup, by uid: their limits, root's; below it, delegated to them, each container's
/var/lib/scrotwmos/ct-users-net/user/name.yaml
vmnat's record of a user's container with NICs, root's; ct-users-net is 0711 and user/ 0750, its group the user's own (a user with none: 0700): its net, MACs, vmnat0 address, lan0 and forwards
/run/ct-nat.sock
vmnat's socket for users' containers, root's, 0666: their NICs and forwards
/run/ct-users-net/user/name.lease
a user's lan0: dhcp's lease, addr/bits, vmnat's, learned on the host's side; gone at a boot
/sys/fs/cgroup/scrotwmos-ct-keepers/user.name
a user's lan0: dhcp's DHCP keeper's cgroup, root's
/etc/subuid, /etc/subgid
a -ct:start:65536 line and a -ct-name:start:65536 line each container, a -vm-name:start:65536 line each VM
/etc/qemu/bridge.conf
without allow lan0 or allow vmnat0: no user's tap in either bridge by qemu-bridge-helper; the file's other lines kept
/etc/sv/dhcpcd/lan0
the wired uplink's MAC: the NIC that goes in lan0, and the mark that lan0 is laid
/etc/sv/dhcpcd/conf
dhcpcd's flags: it makes lan0 and keeps dhcpcd off the NIC in it, the VMs' taps, the containers' veths, vmnat0 and the sessions' links, lan0 or none: a user's own tap, an OpenVPN tap0, gets no dhcpcd either
/etc/sv/lan0-link
the service lan0-link
/etc/sv/vmnat
the service vmnat: the NAT bridge vmnat0 and its rules, laid and watched
/var/log/vmnat
its log
/etc/passwd
the vm user: a system user, home /var/lib/scrotwmos/vm, shell /sbin/nologin, in kvm
/etc/subuid, /etc/subgid
byol: the build range scrotwmos-build, the ids vm image build runs as

install exits 0 when installed, 1 when it failed after it wrote the disk, 2 on a bad command line, and 3 when it refused before it wrote anything. update and update-boot exit 3 when they refused before writing anything, with nothing left open: a prompt gave nothing (Ctrl-C, Ctrl-D), a password refused, a keys.wrap that does not parse, or, on dom0, an older release. A keys.wrap from before the TOTP mark, or one cut short, says “keys.wrap: no TOTP mark: older install, or cut; reinstall”. session and world exit 3 when any of their questions gave nothing; they wrote nothing. The other commands exit 0 on success, 2 on a bad command line, and another value on failure.

On the install stick, open swmdata once, by any world's credentials, for open and the others that need it (unlock):

# swmtool unlock alice

Update to the release on the stick, from a mirror on your own network, or back to an older release:

# swmtool update
# swmtool update --repo https://example.org/current
# swmtool update --force /mnt/usb/dom0.signed

Install packages into alice's world, and chromium into its VM session vm:

# swmtool add alice htop mpv
# swmtool add --session vm alice chromium

Put back a file from the home as it was three points ago:

# swmtool points alice
   1  Wed 2026-10-28 14:00 CET  (0 h ago)
   2  Wed 2026-10-28 13:00 CET  (1 h ago)
   3  Wed 2026-10-28 12:00 CET  (2 h ago)
# swmtool open --rw --point 3 alice
# cp -p /mnt/alice/point/notes.txt /mnt/alice/home/
# swmtool close alice

Back up alice's home to a USB disk, then, on any box, read a file back from its copy of 09:00 UTC:

# swmtool place init alice /dev/sdb backups
# swmtool place list /dev/sdb backups alice
# swmtool place open 20261025T09Z /dev/sdb backups alice
# cp -p /mnt/alice/place/notes.txt /root/
# swmtool close alice

A network place in rescue: ttvm's NIC on a tap, up and on a bridge, the bridge its gateway. swmtool makes no route or firewall rule: forward and masquerade from the bridge to the server yourself.

# ip link add br0 type bridge
# ip addr add 100.64.0.1/24 dev br0
# ip link set br0 up
# ip tuntap add tap0 mode tap
# ip link set tap0 master br0 up
# swmtool place init --tap tap0 \
    --ip 100.64.0.2::100.64.0.1:255.255.255.0:::off \
    alice nfs:192.0.2.5:/backup backups

A dead box. It needs the world's place and the world's password, or the recovery phrase when the password is lost. While the box lives, F6 shows each session's images and when each was last backed up. An image shown as ‘never’ or ‘NOT enabled’ has no backup and comes back empty.

  1. Install a new box with a world of the same name and the same usernames. Add slot B and a share if the dead box had them. The password may be new.
  2. Boot its rescue world, not the world. Plug in the place's USB disk. Admit it in F7.
  3. Make the world the dead box's again with place world. It names each image and the restore that brings it back.
  4. Restore each image from an hour that place list shows. Add --root for a root or VM disk. If the password is new, add --phrase to each command. Then type the phrase.
  5. Boot the world. Its homes are the copies'. New copies go to the same place. In F9 and F5, approve each GPU and network card that the install did not approve.
# swmtool place world /dev/sdb backups alice
# swmtool place list /dev/sdb backups alice
# swmtool place restore --session alice 20261025T09Z /dev/sdb backups alice

To copy back only some files instead, open the new world's home with --rw and the copy beside it, as above. A new world of another name opens under its own name, and the copy under the old one, at /mnt/old/place.

byol: a first VM. Build a Void image, make a small VM over it, start it, read its password, log in on its console, and start it with the box from now on. The image is named for the day it was built:

# swmtool vm image build void
# swmtool vm image list
# swmtool vm create web void-20261115 small
# swmtool vm start web
# swmtool vm pass web
# swmtool vm console web
# swmtool vm enable web

On a box with lan0, vm create writes this YAML, its first line the command as a comment; the MAC comes from the name, so it never changes:

# cat /var/lib/scrotwmos/vm/web.yaml
# swmtool vm create web void-20261115 small
machine: q35,accel=kvm
cpu: host
display: none
device:
  - virtio-rng-pci
  - virtio-net-pci,netdev=n0,mac=52:54:00:4b:5e:57
smp: 1
m: 1G
drive:
  - file=/var/lib/scrotwmos/vm/web.qcow2,format=qcow2,if=virtio
  - file=/var/lib/scrotwmos/vm/web.seed.img,format=raw,if=virtio,readonly=on
netdev: bridge,id=n0,br=lan0

A Fedora VM and an OpenBSD VM, the second with a 30G disk:

# swmtool vm image build fedora-45
# swmtool vm create db fedora-45 medium
# swmtool vm image build openbsd-8.0
# swmtool vm create fw openbsd-8.0 small -s 30G

A VM moved over from another box, on lan0 with the MAC it had there, so the LAN's DHCP server gives it the same address. A relative path is in /var/lib/scrotwmos/vm. Its disk must be the VM's own uid's. The first start gives the VM its ids: its -vm-mail line of /etc/subuid. That start fails: qemu cannot read the disk. Give the disk to the ids. runit starts qemu again, and qemu opens the disk:

# cat /var/lib/scrotwmos/vm/mail.yaml
machine: q35,accel=kvm
cpu: host
m: 2G
smp: 2
display: none
drive: file=mail.qcow2,if=virtio,format=qcow2
netdev: bridge,id=n0,br=lan0
device: virtio-net-pci,netdev=n0,mac=52:54:00:12:34:01
# swmtool vm start mail
# u=$(awk -F: '$1 == "-vm-mail" { print $2 }' /etc/subuid)
# chown $u:$u /var/lib/scrotwmos/vm/mail.qcow2
# chmod 600 /var/lib/scrotwmos/vm/mail.qcow2

The same VM on qemu's user net, with no lan0 or off the LAN, its ssh on the box's port 2222 alone, reached from the box:

netdev: user,id=n0,hostfwd=tcp:127.0.0.1:2222-:22
device: virtio-net-pci,netdev=n0
$ ssh -p 2222 alice@127.0.0.1

Copy a stopped VM whole, then remove the copy but keep its disk:

# swmtool vm stop web
# swmtool vm clone web web2
web2: cloned, web, 52:54:00:14:6d:31
# swmtool vm rm web2 -k
web2: removed, disk kept

A temporary VM for a dirty task: its writes are gone when it stops.

# swmtool vm start --temp web
web: up, temp, pid 3190

Watch the VMs: once, then live, a second apart:

# swmtool vm list
name             state pid      uptime  boot mac               ip
db               up    2817     3h4m    on   52:54:00:7b:dc:25 192.0.2.50
fw               down  -        -       off  52:54:00:07:f7:ab -
web              temp  3190     45s     on   52:54:00:4b:5e:57 192.0.2.51
# swmtool vm top
name state  cpu%  rss  read/s write/s rx/s tx/s uptime
db   up      2.1 3.9G    120K    340K 1.5K 900B 3h4m
fw   down      -    -       -       -    -    - -
web  temp    0.3 1.0G      0B     12K   0B   0B 45s

Stop a VM and keep it from starting with the box:

# swmtool vm stop web
# swmtool vm disable web

A container on vmnat0 with nginx: made, started and reached from the host, whose address is 192.0.2.10; then from the LAN, through a forward of the host's port 8080; then by ssh through the host:

# swmtool ct image build void
# swmtool ct image list
name                             size  date       sum
void-20261117                    -     2026-11-17 yes
# swmtool ct create web void-20261117 small -n vmnat0 -P nginx
web: created, void-20261117, small, range 1073741824, net vmnat0, 10.83.87.2/24
web: packages, on the host's network
web: up, pid 18060
[*] Updating repository ...
nginx-1.30.6_1: installed successfully.
service nginx: on
web: stop
web: down
# swmtool ct start web
web: up, pid 18384
$ curl http://10.83.87.2/
# swmtool ct port web add tcp:8080:80
web: forward tcp:8080:80 added
$ curl http://192.0.2.10:8080/
$ ssh -J 192.0.2.10 alice@10.83.87.2

Edit a file in it, as its root, on this terminal:

# swmtool ct exec web vi /etc/nginx/nginx.conf
# swmtool ct exec web sv restart /etc/runit/runsvdir/default/nginx

Log in on its console, as the user its seed made, with its password; Ctrl-] leaves:

# swmtool ct pass web
# swmtool ct console web

web login: alice
Password:

Watch it, a second apart:

# swmtool ct top
name state  cpu%  mem  read/s write/s rx/s tx/s uptime
web  up      0.3 8.1M      0B     12K  42B   0B 9s

The same container, run once as a temporary one: its writes are gone when it stops.

# swmtool ct stop web
web: stop
web: down
# swmtool ct start --temp web
web: up, temp, pid 3311
# swmtool ct list -v
name             state pid      uptime  boot net    lan0               range  stop ip                              forward
web              temp  3311     12s     off  vmnat0 -                  1073741824 -    10.83.87.2                      tcp:8080:80

A user's own containers: root allows alice once, with limits all her containers share and one host port for her forwards; she makes, starts and uses hers; root sees them beside its own, then denies her.

# swmtool ct allow alice -m 4G -p 2000 -f 8081
alice: allowed, uid 1001, memory limited, pids limited, 1 port, 0 lan0s
$ swmtool ct create box void-20261118 small -n vmnat0
box: created, void-20261118, small, range 1073807360, net vmnat0
$ swmtool ct start box
box: up, pid 4410
$ swmtool ct exec box id -u
0
$ swmtool ct port box add tcp:8081:80
box: forward tcp:8081:80 added
# swmtool ct list -a
name             owner            state pid      uptime  boot
web              root             up    3311     2m      on
box              alice            up    4410     5s      ?
# swmtool ct deny alice -f
alice: denied, 1 range retired

scrotwmos.conf(5), swmtool-answer(5), scrotwmos(7), scrotwmos-byol(7), swm-tt(8), swm-vmm(8), swmstub(8), ttd(8)

Marco Peereboom <marco@peereboom.us>

October 27, 2026 Void Linux