| SWMSTUB(8) | System Manager's Manual | SWMSTUB(8) |
NAME
swmstub.efi,
byolstub.efi, swminstall.efi
— scrotwmos UEFI boot loaders
SYNOPSIS
\EFI\BOOT\BOOTX64.EFI
DESCRIPTION
The three loaders are x86_64 UEFI applications, installed on the EFI system partition (ESP) at the removable-media path, so the firmware boots them with no boot entry. A loader takes no arguments, reads its files off its own ESP, and refuses a file larger than its cap. It turns off the firmware watchdog, so the box does not reset at the prompt or after a halt.
A halt stops the CPU; only a power cycle or a reset continues. A
loader halts when another handle already offers the Linux initrd
(LoadFile2). swmstub.efi and
byolstub.efi wipe the initrd buffer and the stack
before a halt, and wipe the secret archive after the kernel copies it.
The prompt
swmstub.efi and
byolstub.efi ask for
USERNAME: and PASSWORD:; the
password does not echo. The loader accepts only printable ASCII and discards
keys typed before a prompt. It stores the username nowhere. It runs the pair
through bcrypt_pbkdf(3) with the
salt of each password slot of keys.wrap. The slot
whose copy of the master key the result opens (XSalsa20-Poly1305) unlocks. A
wrong username and a wrong password give the same message.
After a failure, the loader wipes both and asks again after a wait that starts at 1 second and doubles. After three failures, it halts with interrupts off: Ctrl-Alt-Del does nothing; only the power button continues. The loader clears the screen at the lockout and after an unlock.
swmstub.efi
The appliance loader; the banner is green. After the unlock, it opens sealed blobs (XSalsa20-Poly1305) from the ESP root, in order: the world's config, the disk key of the swmdata volume, the home key when the world has a home image, the firmware when the config names it, and the boot image. The loader refuses a blob that does not authenticate. The config holds dom0.conf, dom0.fstab, the hostname, and the digests of the boot image's header and of the firmware; a config that does not open and check halts the loader. The firmware must match its digest; if not, the loader warns and boots without it. The boot image is an Ed25519 signature under the release key built into the loader, a header, and the kernel. The header must be for this architecture and this loader's handoff version and match the config's digest, and the kernel must match the header; any failure halts. The loader also reads keymap.xkb, not sealed; when it is missing or too large, the image's own keymap stays.
The kernel gets one initrd, unpacked over its built-in initramfs: the firmware, when it opened, under /lib/firmware/ with the Intel and AMD early microcode; dom0.conf, dom0.fstab, and, when read, keymap.xkb under /etc/scrotwmos/; /etc/hostname, /etc/scrotwmos/boot-partuuid (the GPT partition GUID of the loader's ESP, when the firmware names one), and /swm-handoff, mode 0400, the one secret passed on: the master key, a bcrypt hash of the password for the screen lock, the disk key, and the home key or zeros. The loader lays it only when the disk key opens. Without it, the box boots, but dom0 keeps its data shut. The root monitor reads it, zeroes it, and removes it. The loader wipes the master key, the password, and the username before the kernel starts.
byolstub.efi
The byol loader; the banner is amber. keys.wrap holds one master key under two password slots, the login user's name and “rescue”, each with the disk's password, and may hold a TPM slot.
With a TPM slot, the loader measures the newest kernel, its
initrd, and the command line into PCR 8 and unseals that version's
tpm file, sealed to PCRs 4, 7, and 8. Whatever the
TPM answered, it then extends PCR 8 once more, so the booted system cannot
unseal the key again. If that extend fails, the loader wipes the master key
and asks for the password. A TPM boot adds swm.tpm=1
to the command line, after the measure, and the session starts locked. With
no TPM, no TCG2 protocol, no tpm file, or a refusal,
the loader says why and asks for the password. A key held down while the
banner types skips the TPM.
The master key opens the sealed disk key, a LUKS key slot of the
root. The username “rescue” lists the kernels to pick one,
Enter for the newest; any other username boots the newest. The kernel's
initrd is the version's initrd, padded to 4 bytes,
then /swm-root.key, mode 0400: the disk key. The
initramfs opens the root with it
(rd.luks.key=/swm-root.key:/) and asks for the
password when it does not open. The typed password never leaves the
loader.
swminstall.efi
The install media's loader; the banner is green. It asks for nothing and holds no secret. It boots installer.signed: an Ed25519 signature under the installer key built into the loader, not the release key, a header for this architecture that takes no handoff, and the installer kernel, whose initramfs is built in. Any failure halts.
FILES
Appliance ESP, swmstub.efi:
- \EFI\BOOT\BOOTX64.EFI
- the loader
- \keys.wrap
- the key slots, one per username
- \keymap.xkb
- the compiled keymap
- \xxxxxxxxxxxxxxxx
- sealed blobs: each world's config and boot image, the disk key, home keys, and the firmware
byol ESP, byolstub.efi:
- \EFI\BOOT\BOOTX64.EFI
- the loader
- \EFI\scrotwmos\keys.wrap
- the key slots
- \EFI\scrotwmos\xxxxxxxxxxxxxxxx
- the disk key, sealed
- \EFI\scrotwmos\kernels
- kernel versions, the newest first; the loader reads at most 16 and skips a line that is not 1 to 63 of [A-Za-z0-9._+-] or that starts with a dot
- \EFI\scrotwmos\cmdline
- the kernel's command line, one line of ASCII
- \EFI\scrotwmos\ver\vmlinuz
- a kernel
- \EFI\scrotwmos\ver\initrd
- its initramfs
- \EFI\scrotwmos\ver\tpm
- its key sealed to the TPM, when enrolled
Install media ESP, swminstall.efi:
- \EFI\BOOT\BOOTX64.EFI
- the loader
- \installer.signed
- the signed installer kernel
DIAGNOSTICS
A message that starts with ‘?’ ends the boot unless noted. A message between ‘**’ marks is a warning; the boot goes on.
- ?FILE NOT FOUND ERROR -- cannot read keys.wrap
- (swmstub.efi) Missing or too large.
- ?BAD DATA ERROR -- keys.wrap is corrupt
- It does not parse.
- ?ACCESS DENIED -- unlock failed
- Wrong username or password; the prompt returns.
- ?TOO MANY TRIES -- power off to retry
- Three failures; power off.
- ?FILE NOT FOUND ERROR -- cannot read boot image
- (swmstub.efi)
- ?LOAD ERROR -- boot image failed
- The world's config or boot image does not open, does not verify, or the
two are not one pair; or another initrd provider is up. The message does
not say which.
byolstub.efigives it only for another initrd provider. - ** HANDOFF FAILED -- NO DATA UNLOCK **
- ** SCREEN HASH FAILED -- NO DATA UNLOCK **
- (swmstub.efi) The box boots, but dom0 cannot open its data.
- ** TEST KEY -- NOT FOR PRODUCTION **
- ** NIGHTLY KEY -- NOT A RELEASE **
- (swmstub.efi, swminstall.efi) Under the banner on every boot: the loader trusts a test key, whose secret is public, or a nightly key, not a release's.
- totp: disk key failed; codes not checked; power off
- (swmstub.efi) The world's disk key is missing or does not open. Every world has one, and the TOTP mark in keys.wrap is checked with it, so the loader halts.
- totp: codes gone; tampering suspected; power off
- (swmstub.efi) The TOTP mark in keys.wrap does not match the ESP: it says on and the totp seal is gone or another, it says off and a seal is there, or its MAC fails.
- totp: seal not read; tampering suspected; power off; from the stick: swmtool totp off, then on
- totp: boot changed since the seal; tampering suspected; power off; from the stick: swmtool totp off, then on
- totp: TPM gave no code; power off; from the stick: swmtool totp off, then on
- (swmstub.efi) Before the prompt: the totp seal is there but cannot be read, the TPM refuses it for this boot's PCRs, or no TPM opens it.
- totp: PCR 8 cap failed; power off
- (swmstub.efi) The final extend that keeps the booted image from the seal failed.
- ** FIRMWARE FAILED -- BOOTING WITHOUT **
- (swmstub.efi) The firmware blob is missing, does not open, or does not match. Devices that need it do not work.
- ?FILE NOT FOUND ERROR -- path
- (byolstub.efi) The named file under \EFI\scrotwmos is missing or too large.
- ?FILE NOT FOUND ERROR -- no kernel listed
- (byolstub.efi)
- NOTE: TPM seal missing. Login required to reseal TPM.
- (byolstub.efi) The newest kernel has no tpm file: the first boot after an install or an update. The loader asks for the password.
- ?TPM ERROR: disk not opened
- (byolstub.efi) The TPM did not open the disk: no TPM 2.0, a bad tpm file, or a cleared TPM. The loader asks for the password.
- WARNING: no install or update since last boot: power off; tampering suspected
- (byolstub.efi) On the line after ‘
?TPM ERROR: disk not opened’, when PCR 4, 7, or 8 is not the sealed value: the loader, Secure Boot, the kernel, the initrd, or the command line changed, and no install or update removed the tpm file. The loader asks for the password. - ?TPM ERROR: PCR 8 cap failed
- (byolstub.efi) The TPM opened the disk, but the final extend failed. The loader wipes the master key and asks for the password.
- ?ILLEGAL QUANTITY ERROR
- (byolstub.efi) Rescue: not a listed kernel number; the loader asks again.
- ?LOAD ERROR -- disk key failed
- (byolstub.efi) The sealed disk key is missing or does not open.
- ?OUT OF MEMORY ERROR
- (byolstub.efi) No firmware memory for the command line.
- ?FILE NOT FOUND ERROR -- cannot read installer.signed
- ?LOAD ERROR -- another initrd provider is up
- (swminstall.efi)
- ?LOAD ERROR -- installer.signed failed its check
- (swminstall.efi) Bad signature, wrong key, wrong architecture, or the image wants a handoff.
- ?LOAD ERROR -- LoadImage failed
- ?LOAD ERROR -- no loaded image
- The firmware refused the kernel.
- ?BREAK ERROR -- boot image returned
- ?BREAK ERROR -- the kernel returned
- ?BREAK ERROR -- the installer returned
- The kernel exited back to the loader.
SEE ALSO
bcrypt_pbkdf(3), scrotwmos(7), swmtool(8)
AUTHORS
Marco Peereboom <marco@peereboom.us>
CAVEATS
The loaders are not signed for UEFI Secure Boot.
byolstub.efi verifies nothing it boots. It
uses the kernel, the initrd, and the command line as the ESP holds them, and
the disk key goes to whatever kernel is there. With a TPM slot, a changed
kernel, initrd, or command line only stops the TPM from unsealing and shows
a warning; the password still boots it.
The firmware's console driver keeps the typed keys in its own memory, where the loader cannot wipe them.
The lockout does not survive a reset: a reset before the third failure gives three more tries.
keys.wrap can be attacked offline; the password is the barrier.
| November 13, 2026 | Void Linux |