SYSTEMD-CRYPTSETUP(8)
๐ SYSTEMD-CRYPTSETUP ๐
okay so bestie, you know how your laptop asks for a password before it even boots properly? yeah. this is That. it's systemd-cryptsetup, and it lives in the systemd-cryptsetup@.service era. full disk decryption logic. it's giving backstage pass to your encrypted drive ๐
โจ SYNOPSIS โจ
systemd-cryptsetup [OPTIONS...] attach VOLUME SOURCE-DEVICE [KEY-FILE]
[CRYPTTAB-OPTIONS]
systemd-cryptsetup [OPTIONS...] detach VOLUME
systemd-cryptsetup@.service
system-systemd\x2dcryptsetup.slice
๐ธ DESCRIPTION ๐ธ
so systemd-cryptsetup is the little icon that sets up (with attach) and tears down (with detach) access to an encrypted block device. it's mainly doing its thing via systemd-cryptsetup@.service during early boot, but you can absolutely call it manually too, no gatekeeping here ๐ซถ
the positional arguments โ VOLUME, SOURCE-DEVICE, KEY-FILE, and CRYPTTAB-OPTIONS โ mean literally the same thing as the fields in crypttab(5). same energy, same meaning.
systemd-cryptsetup@.service is the service responsible for providing access to encrypted block devices. it gets instantiated for each device that requires decryption. one device, one glow-up.
systemd-cryptsetup@.service instances are part of the system-systemd\x2dcryptsetup.slice slice, which is destroyed only very late in the shutdown procedure. why does that matter? because it lets the encrypted devices stay up until the filesystems have been unmounted. no premature breakup, periodt ๐
systemd-cryptsetup@.service will ask for hard disk passwords via the password agent logic[1], so it can query you for the password using the right mechanism at boot and during runtime.
at early boot, and whenever the system manager configuration gets reloaded, /etc/crypttab is translated into systemd-cryptsetup@.service units by systemd-cryptsetup-generator(8). slay.
now, to unlock a volume you need a password or a binary key. systemd-cryptsetup@.service tries to acquire a suitable password or binary key via the following mechanisms, tried in order:
- if a key file is explicitly configured (via the third column in
/etc/crypttab), a key read from it is used. and if a PKCS#11 token, FIDO2 token or TPM2 device is configured (using thepkcs11-uri=,fido2-device=,tpm2-device=options), the key gets decrypted before use. - if no key file is configured explicitly this way, a key file is automatically loaded from
/etc/cryptsetup-keys.d/volume.keyand/run/cryptsetup-keys.d/volume.key, if present. here too, if a PKCS#11/FIDO2/TPM2 token/device is configured, any key found this way is decrypted before use. - if the
try-empty-passwordoption is specified, then unlocking the volume with an empty password is attempted. (yes, really. it's trying its best ๐ญ) - if the
password-cache=option is set to"yes"or"read-only", the kernel keyring is then checked for a suitable cached password from previous attempts. - finally, the user is queried for a password, possibly multiple times, unless the
headlessoption is set.
if no suitable key may be acquired via any of the mechanisms described above, volume activation fails. no key, no entry, sorry bestie ๐
๐ CREDENTIALS ๐
systemd-cryptsetup supports the service credentials logic as implemented by ImportCredential=/LoadCredential=/SetCredential= (see systemd.exec(5) for details). the following credentials are used by "systemd-crypsetup@root.service" (generated by systemd-gpt-auto-generator) when passed in:
cryptsetup.passphraseโ this credential specifies the passphrase of the LUKS volume.
Added in version 256.
cryptsetup.tpm2-pinโ this credential specifies the TPM pin.
Added in version 256.
cryptsetup.fido2-pinโ this credential specifies the FIDO2 token pin.
Added in version 256.
cryptsetup.pkcs11-pinโ this credential specifies the PKCS11 token pin.
Added in version 256.
cryptsetup.luks2-pinโ this credential specifies the pin requested by generic LUKS2 token modules.
Added in version 256.
๐ SEE ALSO ๐
systemd(1), systemd-cryptsetup-generator(8), crypttab(5), systemd-cryptenroll(1), cryptsetup(8), TPM2 PCR Measurements Made by systemd[2]
๐ NOTES ๐
- password agent logic https://systemd.io/PASSWORD_AGENTS/
- TPM2 PCR Measurements Made by systemd https://systemd.io/TPM2_PCR_MEASUREMENTS
and that's the whole thing, bestie!! this was systemd 262.1, aka SYSTEMD-CRYPTSETUP(8), the manual page. go unlock something ๐๐โจ
๐ฆ 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