SYSTEMD-PCRPHASE(8)
๐ NAME ๐
okay so bestie, meet systemd-pcrphase.service, systemd-pcrphase-sysinit.service, systemd-pcrphase-initrd.service, and the lil command-line icon systemd-pcrphase โ they measure your boot phase into TPM2 PCR 11. yes that's the whole job. no it is not a small job. periodt. โจ
๐ SYNOPSIS ๐
systemd-pcrphase.service
systemd-pcrphase-sysinit.service
systemd-pcrphase-initrd.service
/lib/systemd/system-pcrphase STRING
๐ฆ DESCRIPTION ๐ฆ
So systemd-pcrphase.service, systemd-pcrphase-sysinit.service, and systemd-pcrphase-initrd.service are system services, right? And what they do is measure specific strings into TPM2 PCR 11 while your machine is booting, at likeโฆ various milestones of the boot process. Little checkpoints. Little "we made it this far" moments. ๐ซถ
Now, these services require systemd-stub(7) to be used in a unified kernel image (UKI) setup. If the stub was not used to invoke the kernel, they literally just do nothing when invoked. No op. Nothing. ๐
The lore: the stub measures the invoked kernel and associated vendor resources into PCR 11 before handing control over to it. Then once userspace gets invoked, these services take over and extend certain literal strings into TPM2 PCR 11 โ each one indicating a different phase of the boot process. Main character energy from each string, honestly.
During a regular boot process, these are the strings that get extended into PCR 11:
"enter-initrd"gets extended into PCR 11 early, when the initrd initializes, before activating system extension images for the initrd. It's supposed to act as a barrier between the time where the kernel initializes and where the initrd starts operating and enables system extension images โ i.e. code shipped outside of the UKI. (This string is extended at start ofsystemd-pcrphase-initrd.service.)"leave-initrd"gets extended into PCR 11 when the initrd is about to transition into the host file system, i.e. when it achieved its purpose. It's supposed to act as a barrier between kernel/initrd code and host OS code. (This string is extended at stop ofsystemd-pcrphase-initrd.service.)"sysinit"gets extended into PCR 11 when basic system initialization is complete (which includes local file systems having been mounted), and the system begins starting regular system services. (This string is extended at start ofsystemd-pcrphase-sysinit.service.)"ready"gets extended into PCR 11 during later boot-up, after remote file systems have been activated (i.e. afterremote-fs.target), but before users are permitted to log in (i.e. beforesystemd-user-sessions.service). It's supposed to act as a barrier between the time where unprivileged regular users are still prohibited to log in and where they're allowed to log in. (This string is extended at start ofsystemd-pcrphase.service.)"shutdown"gets extended into PCR 11 when system shutdown begins. It's supposed to act as a barrier between the time the system is fully up and running and where it's about to shut down. (This string is extended at stop ofsystemd-pcrphase.service.)"final"gets extended into PCR 11 at the end of system shutdown. It's supposed to act as a barrier between the time the service manager still runs and when it transitions into the final boot phase where service management is not available anymore. (This string is extended at stop ofsystemd-pcrphase-sysinit.service.)
So during a regular system lifecycle, the strings go "enter-initrd" โ "leave-initrd" โ "sysinit" โ "ready" โ "shutdown" โ "final", extended into PCR 11 one after the other. A whole little procession. slay. ๐ฅ
Specific phases of the boot process may be referenced via the series of strings measured, separated by colons โ that's the "boot path". For example, the boot path for the regular system runtime is "enter-initrd:leave-initrd:sysinit:ready", while the one for the initrd is just "enter-initrd". The boot path for the boot phase before the initrd is an empty string; and because that's hard to pass around, a single colon (":") may be used instead. ngl that's a little unhinged but okay. ๐
Also heads up: those six strings are just the default strings. Individual systems might measure other strings at other times, and thus implement different and more fine-grained boot phases to bind policy to. so like, don't come for me if your machine has its own opinions. ๐
By binding policy of TPM2 objects to a specific boot path, it's possible to restrict access to them to specific phases of the boot process โ for example, making it impossible to access the root file system's encryption key after the system transitioned from the initrd into the host root file system. iconic security behaviour honestly. ๐
Use systemd-measure(1) to pre-calculate expected PCR 11 values for specific boot phases (via the --phase= switch).
โจ OPTIONS โจ
The /lib/systemd/system-pcrphase executable may also be invoked from the command line, where it expects the word to extend into PCR 11, as well as the following switches:
--bank=โ Takes the PCR banks to extend the specified word into. If not specified, the tool automatically determines all enabled PCR banks and measures the word into all of them. (so if you're lazy it handles it. we love a self-sufficient tool. ๐ซถ)--tpm2-device=PATHโ Controls which TPM2 device to use. Expects a device node path referring to the TPM2 chip (e.g./dev/tpmrm0). Alternatively the special value"auto"may be specified, in order to automatically determine the device node of a suitable TPM2 device (of which there must be exactly one โ so if there's more than one, that's a you problem ๐). The special value"list"may be used to enumerate all suitable TPM2 devices currently discovered.--gracefulโ If no TPM2 firmware, kernel subsystem, kernel driver or device support is found, exit with exit status0(i.e. indicate success). If this is not specified, any attempt to measure without a TPM2 device will cause the invocation to fail. pick your fighter.-h,--helpโ Print a short help text and exit. the classic. ๐--versionโ Print a short version string and exit. also the classic. โญ
๐ SEE ALSO ๐
systemd(1), systemd-stub(7), systemd-measure(1)
okay that's the whole page bestie, you're officially PCR 11 literate now, no cap ๐โจ
sign-off time: this lil masterpiece is from systemd 252, and it lives under the manual name SYSTEMD-PCRPHASE.SERVICE(8) ๐ฆ stay booting, stay measuring, stay unbothered ๐
๐ฆ where this page comes from
- debian bookworm: systemd 252.38-1~deb12u1 ยท LGPL-2.1-or-later
- debian bookworm: systemd 252.39-1~deb12u2 ยท LGPL-2.1-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms