SYSTEMD-TPM2-SETUP.SERVICE(8)

๐Ÿ’– systemd-tpm2-setup.service(8) โ€” the manual page, but make it make sense ๐Ÿ’–

okay bestie, gather round, because this is systemd-tpm2-setup.service(8) and she is lowkey the reason your TPM2 keys exist at all. no cap.


โœจ NAME โœจ

systemd-tpm2-setup.service, systemd-tpm2-setup-early.service, systemd-tpm2-setup โ€” Set up the TPM2 Storage Root Key (SRK), Endorsement Key (EK), and initialize NvPCRs at boot


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

systemd-tpm2-setup.service
/usr/lib/systemd/systemd-tpm2-setup

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so here's the tea. systemd-tpm2-setup.service</p> and systemd-tpm2-setup-early.service</p> are services that generate the Storage Root Key (SRK) and Endorsement Key (EK) if they have not been generated yet, and stores them in the TPM. and if NvPCRs (additional PCR registers in TPM NV Indexes) are defined, these are initialized with the anchoring secret. she's doing the most, and honestly? iconic. ๐Ÿ‘‘

the services will store the public key of the SRK key pair in a PEM file in /run/systemd/tpm2-srk-public-key.pem and /var/lib/systemd/tpm2-srk-public-key.pem. they will also store it in TPM2B_PUBLIC format in /run/systemd/tpm2-srk-public-key.tpm2_public and /var/lib/systemd/tpm2-srk-public-key.tpm2b_public. two formats, two homes, main character energy fr fr. โœจ

systemd-tpm2-setup-early.service runs very early at boot (possibly in the initrd), and writes the SRK public key to /run/systemd/tpm2-srk-public-key.* (as /var/ is generally not accessible this early yet), while systemd-tpm2-setup.service runs during a later boot phase and saves the public key to /var/lib/systemd/tpm2-srk-public-key.*.

so like: early girl drops the key in /run/, later girl moves it home to /var/. the way that /var/ just isn't there at 3am boot time ๐Ÿ˜ญ it's giving "we'll deal with it when the filesystem shows up".


๐ŸŒธ FILES ๐ŸŒธ

  • /run/systemd/tpm2-srk-public-key.pem, /run/systemd/tpm2-srk-public-key.tpm2b_public โ€” The SRK public key in PEM and TPM2B_PUBLIC format, written during early boot.

Added in version 255.

  • /var/lib/systemd/tpm2-srk-public-key.pem, /var/lib/systemd/tpm2-srk-public-key.tpm2_public โ€” The SRK public key in PEM and TPM2B_PUBLIC format, written during later boot (once /var/ is available).

Added in version 255.

  • /usr/lib/nvpcr/*.nvpcr โ€” Definition files for NvPCRs.

Added in version 259.

๐Ÿ™ˆ friendly reminder that the filenames above are exactly what the page says โ€” /run/... has the tpm2b_public one and /var/lib/... has the tpm2_public one. don't come for me, come for the source. iykyk ๐Ÿ’…

๐Ÿซถ SEE ALSO ๐Ÿซถ

systemd(1)


and that's the whole vibe check, bestie ๐Ÿ’– this page lives in systemd 262.1 and it's the SYSTEMD-TP...UP.SERVICE(8) manual โ€” go forth and slay your boot sequence. periodt. ๐ŸŒˆโญ๐ŸŽ€

๐Ÿ“ฆ where this page comes from
  • arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms