Skip to content

Writing criteria for this guide

Every "for Mere Mortals" guide is written to the same nine-point standard, so a reader who trusts one can trust the rest. Here it is, with the verification notes for this particular guide below.

  1. Fix it first. Reader outcomes lead, not action items: each chapter opens by naming the outcome it delivers, shows a check the reader can run to confirm they got it, and a reasonable reader finishes able to state what was done, what it means, and what to try next.
  2. Plain language. Short sentences, everyday vocabulary, technical terms defined on first use. No slang, and no idioms that only make sense in one country — the reader may be translating as they go.
  3. No dead ends. A guide never tells the reader to do something it cannot show them how to verify. Every claim a reader relies on — an install, a command, an output — is something this guide demonstrates or clearly labels documented-only below.
  4. Live-verified where it matters. Procedures are run for real in the guide's lab wherever the build machine allows it, and the transcripts kept in the repository are the evidence. What could not be run is listed honestly below, never presented as if it had been.
  5. General audiences. Nothing in this guide — examples, fixtures, names, addresses — is modelled on any particular reader or author's real life, network, or organisations. The lab's passphrases are invented phrases, used only on throwaway files.
  6. Standalone. A reader needs this guide, its lab, and nothing else. Where another guide would genuinely help, it is pointed to once, by name, and the chapter still completes without it.
  7. Honest about limits. Chapter 15 names what the tool cannot do: the lost passphrase with no back door, the open vault that is an open book, confidentiality without integrity, the header as a single point of failure in both directions, and what leaks despite the cipher.
  8. The safety rule is in the text, early. LUKS's dangers are destruction and irreversibility, and the guide states them before any procedure depends on them: chapter 1 gives the lost-passphrase truth, chapter 3 establishes the practice-file rule — never rehearse on a real disk or the only copy of anything — and chapter 4 repeats the warning at the format command itself.
  9. Builds clean. The site builds with MkDocs in strict mode with no warnings, and a fresh reader following the chapters in order reaches the stated outcome of each.

Verification notes for this guide

The build machine is a 2-CPU, ~8 GB Ubuntu 24.04 sandbox on an AMD EPYC 9D25 processor (AES instructions present), shared with other work while the lab ran — Argon2 calibrations and benchmark figures are therefore one machine's honest numbers, and the guide presents them as such. The sandbox has no block devices at all: no disks, no loop devices, no /dev/mapper, no TPM. Everything cryptsetup does by reading and writing a header could be — and was — run for real on ordinary files in the lab folder. The one step that needs the kernel (opening a vault) could not run, and the guide says so at the step itself.

Tool provenance, disclosed in full: cryptsetup 2.7.0 (the Ubuntu noble package, cryptsetup-bin 2:2.7.0-1ubuntu4.2) was first installed from the distribution archive in the ordinary way. Mid-lab, the sandbox's package state was reset by other tenants' activity — the installed binary vanished and the package lists were wiped repeatedly. The lab finished with the identical distribution .deb, fetched directly from the Ubuntu archive and unpacked into the lab folder, run against the system's own (never-removed) shared libraries, including libcryptsetup.so.12. The version string, flags and behaviour are the distribution's by both routes; chapter 3 notes this once for the reader. Every cryptsetup command in the lab was run only against image files inside the lab folder — never against any other device.

Run for real, with transcripts as evidence (luks-lab/transcripts/):

  • Version and flags; the machine's CPU, AES flag and /dev inventory, establishing what the sandbox is (t00).
  • A 64 MB file formatted as LUKS2 and its full luksDump read field by field: 16 MiB header (metadata 16384 + keyslots area 16744448), data offset 16777216, cipher aes-xts-plain64, 512-bit key, 4096-byte sectors, slot 0 Argon2id (time cost 12, memory 105484 KiB), AF stripes 4000, and the PBKDF2 digest section (t01).
  • A second passphrase added (slot 1, its own Argon2id calibration); a wrong unlocking passphrase refused; open --test-passphrase proven to work with no device-mapper present — exit 0 for the right passphrase, No key available with this passphrase. and exit 2 for the wrong one (t02).
  • A duplicated slot killed by number (luksKillSlot), slot 1's passphrase changed (luksChangeKey) and proven both ways, then removed by identity (luksRemoveKey); luksAddKey with a wrong unlocking key shown to exit 2 with no message at all (t03).
  • A 4096-byte random keyfile created, added, proven as a sole unlocking key, and removed; and the newline trap demonstrated — the same passphrase plus one trailing newline is refused (t04).
  • A header backup made (exactly 16777216 bytes); a copy of the vault wounded in two stages: first 4 KB zeroed — luksDump still answered in full from LUKS2's second header copy; whole 16 MB zeroed — Device … is not a valid LUKS device. from both dump and passphrase test, the intact data segment notwithstanding; then luksHeaderRestore revived the copy completely, UUID, epoch and passphrase check all as before (t05).
  • A LUKS1 vault formatted and dumped: 2 MiB payload offset (4096 sectors), all eight slots enumerated ENABLED / DISABLED, PBKDF2 iterations in the millions; a second passphrase added there too (t06).
  • cryptsetup benchmark in full: PBKDF2 rates (sha256 at 2,514,570 iterations/s for a 256-bit key), Argon2id calibration (9 iterations in 2000 ms at ~117 MB), and cipher throughput — aes-xts 512-bit at 1222.9 MiB/s encrypt / 1438.9 MiB/s decrypt, aes-cbc's one-way weakness, serpent and twofish N/A on this kernel (t07).
  • Slot 31 filled and slot 32 refused by the tool itself — Key slot 32 is invalid, please select between 0 and 31. — and a LUKS2 label set and read back (t09).
  • A LUKS1 vault converted to LUKS2 in place: UUID, data offset (2 MiB) and 512-byte sectors preserved, slots keeping PBKDF2; then one slot's derivation converted to Argon2id with luksConvertKey, leaving the other on PBKDF2 (t10, t11).
  • cryptsetup erase on a converted vault: header still a valid LUKS2 device afterwards, every passphrase test answering No usable keyslot is available. (t12).

Documented only — described from the cryptsetup, systemd and kernel documentation, not run, and the text does not claim otherwise:

  • The open–filesystem–mount–close round trip of chapter 5. The sandbox cannot initialise device-mapper; transcript t08 keeps the verbatim refusal (Cannot initialize device-mapper. Is dm_mod kernel module loaded?), the failed losetup, and the resize refusal (exit 4) as the boundary's receipts.
  • Unlocking at boot (chapter 9): crypttab and fstab contents, the systemd prompt flow, and the key-file-on- root arrangement. A sandbox cannot boot; the vocabulary and every check named there rests on commands proven in earlier chapters.
  • TPM enrolment (chapter 10): the machine has no /dev/tpm0. systemd-cryptenroll's flags, PCR policy and recovery-key advice are from systemd's documentation.
  • Resizing a live mapping (chapter 12) — the grow/shrink order of container, mapping and filesystem.
  • cryptsetup reencrypt — named, bounded, and deliberately not taught (chapter 12).
  • The neighbour tools of chapter 14 (VeraCrypt, BitLocker, FileVault, ZFS native encryption, age) — characterised, not run.

Two honest blemishes in the evidence, kept rather than tidied: the shared sandbox repeatedly warned keyslot operation could fail as it requires more than available memory during Argon2 operations (other tenants held the RAM); every such operation in fact succeeded, and the warning is used in chapter 16 as the real troubleshooting entry it is. And transcript t02's first run of the add-key step accidentally created a duplicate slot before the transcript was re-shot; chapter 6 and transcript t03 show the duplicate being found and killed by number, which is how the guide came to demonstrate luksKillSlot on a slot that genuinely needed killing.

Fixtures are this guide's own and deliberately generic: three invented passphrases, one random keyfile, and files full of zeros standing in for disks. No real device, filesystem, or person's data was ever at risk in the lab.