# \[GUIDE\] Setup TPM2 Autodecrypt

**URL:** <https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005>\
**Category:** Linux\
**Created:** [October 29, 2023, 5:41pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005 "2023-10-29T17:41:13Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Kiryl\_T](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@Kiryl\_T](https://community.frame.work/u/Kiryl_T)\
**Post date:** [April 14, 2024, 9:40am UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/21 "2024-04-14T09:40:17Z")

</div>

If you are using ubuntu 22.04 I am 100% sure that the issue is due to the old dracut version that is shipped with this Ubuntu.  
Run  
`dracut --list-modules | grep tpm2`  
to confirm that this module is missed or check if you have folder `/usr/lib/dracut/modules.d/91tpm2-tss/`

There is a simple fix. Copy required modules folders from the dracut-059 [Releases · dracutdevs/dracut · GitHub](https://github.com/dracutdevs/dracut/releases)

01systemd-sysusers  
01systemd-udevd  
91tpm2-tss

Detailed steps can be found on the gist - [Dual booting Windows 11 and Ubuntu 22.04 LTS with LUKS and TPM2 encryption · GitHub](https://gist.github.com/kirbah/e8691bdbdadf08a6b710138879614e0b)

---

<div class="post-metadata">

**Author:** ![Adonnen](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/adonnen/32/10221_2.png) [@Adonnen](https://community.frame.work/u/Adonnen)\
**Post date:** [February 16, 2025, 5:03pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/22 "2025-02-16T17:03:15Z")

</div>

I have been doing this for months, and for the first time it is failing.

```auto
systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=7+8 /dev/nvme0n1p5

```

(found from reddit) and

```auto
systemd-cryptenroll --wipe-slot tpm2 --tpm2-device auto --tpm2-pcrs "1+3+5+7+11+12+14+15" /dev/nvme0n1p3

```

gets

```auto
Failed to add TPM2 JSON token to LUKS2 header: No space left on device

```

---

<div class="post-metadata">

**Author:** ![Silntknight](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/silntknight/32/24995_2.png) [@Silntknight](https://community.frame.work/u/Silntknight)\
**Post date:** [March 6, 2025, 11:23pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/23 "2025-03-06T23:23:42Z")

</div>

I’m having a bit of trouble with parts of this. PCRs 0 through 7 all work fine for me, but I can’t seem to get 15 working with either the machine-id or the LUKS volume key measurements. From a couple of different sites, it looks like not having a userspace verification can lead to compromising the TPM key, so I would like to get this resolved.

I enrolled my TPM with PCRs 0+1+2+3+5+6+7. I am using a UKI, self-signed, so I excluded 4, 9, and 11 intentionally since they are covered by 7, from what I understand, and including 4 would cause my password to be required every time I updated the `initramfs`.

When I try to add 15 to the mix, my password ends up always being required, even though it matches on each boot. I checked with both `systemd-analyze pcrs` to compare the hash values in PCR 15 before and after making the change, as well as with `systemd-pcrlock log`, which indicates that the machine-id key matches.

If I try to add the LUKS volume key hash to the mix, things get even stranger. It still doesn’t work, despite the hash values being correct once the system is booted, but if I use `systemd-pcrlock log`, it provides a different hash for the LUKS volume key than the one in the PCR. Basically, the scenarios below are the ones I tested, none of which work. After enrolling the TPM, I regenerate the `initramfs` with `mkinitcpio`, which generates a UKI at `/boot/EFI/BOOT/BOOTX64.efi`

# Scenario 1 - PCR 15 with just machine-id

`systemd-cryptenroll --wipe-slot=tpm2 --tpm2-device=auto --tpm-pcrs=0+1+2+3+5+6+7+15 <partition>`

# Scenario 2 - PCR 15 with machine-id and LUKS volume key

`systemd-cryptenroll --wipe-slot=tpm2 --tpm2-device=auto --tpm-pcrs=0+1+2+3+5+6+7+15 <partition>`

Kernel command line also has `rd.luks.options=tpm2-measure-pcr=yes`

# Scenario 3 - PCR 8 with just LUKS volume key

`systemd-cryptenroll --wipe-slot=tpm2 --tpm2-device=auto --tpm-pcrs=0+1+2+3+5+6+7+8 <partition>`

Kernel command line also has `rd.luks.options=tpm2-measure-pcr=8`

This particular scenario also causes `systemd-pcrlock log` to indicate that the calculated hash value for my volume key _does not_ match with the value stored in the PCR. I also attempted this with PCR 23 instead of 8 to the same effect.

# Scenario 4 - Adding LUKS volume key at all

`systemd-cryptenroll --wipe-slot=tpm2 --tpm2-device=auto --tpm-pcrs=0+1+2+3+5+6+7 <partition>`

Kernel command line also has `rd.luks.options=tpm2-measure-pcr=8`

Despite not binding the TPM to PCR 8, if I have `systemd-cryptenroll` store the hash value to a PCR (8, 15, and 23 tested), I am asked for the password.

System information:

```auto
Framework 16 | BIOS 3.05
Arch Linux | Linux Kernel 6.13.5-arch1-1

```

---

<div class="post-metadata">

**Author:** ![Silntknight](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/silntknight/32/24995_2.png) [@Silntknight](https://community.frame.work/u/Silntknight)\
**Post date:** [March 7, 2025, 3:56am UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/24 "2025-03-07T03:56:37Z")

</div>

Can you try wiping the token first (separately), then enrolling the new one? I’ve noticed it seems to enroll the new one before unenrolling the old one

---

<div class="post-metadata">

**Author:** ![Nicholas\_Von\_Wolff](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/nicholas_von_wolff/32/23224_2.png) [@Nicholas\_Von\_Wolff](https://community.frame.work/u/Nicholas_Von_Wolff)\
**Post date:** [March 9, 2025, 1:15pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/25 "2025-03-09T13:15:50Z")

</div>

For those using Bluefin Linux, or another UBlue variant (Aurora, Bazzite, etc…), you can enable TPM unlock with a single terminal command. `ujust setup-luks-tpm-unlock` see [Bluefin on Framework Laptops | Bluefin](https://docs.projectbluefin.io/framework)

That being said the above guides, and posts, are great for understanding what is really going on. Also if you either don’t like, or want to review, the PCR’s being used.

---

<div class="post-metadata">

**Author:** ![Adonnen](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/adonnen/32/10221_2.png) [@Adonnen](https://community.frame.work/u/Adonnen)\
**Post date:** [May 21, 2025, 2:05pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/26 "2025-05-21T14:05:38Z")

</div>

Thank you! Sorry for late response - this worked!

---

<div class="post-metadata">

**Author:** ![Jack\_Hebert](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jack\_Hebert](https://community.frame.work/u/Jack_Hebert)\
**Post date:** [August 31, 2025, 7:16pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/27 "2025-08-31T19:16:45Z")

</div>

Good afternoon! I was able to enable TPM2 auto-decryption on the latest version of Fedora Kinoite (6.16.3-200.fc42.x86\_64) by using the first command “sudo systemd-cryptenroll --wipe-slot tpm2 --tpm2-device auto --tpm2-pcrs “1+7+11+12+14+15” /dev/nvme0n1p3” , but whenever I try to run “sudo dracut -f”, I get this error message:

Can’t write to /boot/efi/8e9bb3299b544cf6a6bc299dfb5f041c/6.16.3-200.fc42.x86\_64: Directory /boot/e  
fi/8e9bb3299b544cf6a6bc299dfb5f041c/6.16.3-200.fc42.x86\_64 does not exist or is not accessible.

It _seems_ like the drive encryption is successful… it’s not asking me enter my drive encryption password at boot, and whenever I try to access the partition with a Fedora 42 Boot USB via the Disks application, it is asking for the password to open the partition. I’m not complaining about the results, but why is this happening?

---

<div class="post-metadata">

**Author:** ![JakeSully](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/jakesully/32/45327_2.png) [@JakeSully](https://community.frame.work/u/JakeSully)\
**Post date:** [January 21, 2026, 6:24pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/28 "2026-01-21T18:24:58Z")

</div>

i know this is old topic.

But i tried setting this upp on zorin 18 pro os and thing is zorin doesn’t have dracut and installing it actually broke whole os from booting.

So i tried using different command and added tpm2-device=auto into option line of cryppt file and saved and rebuilt and then reboot but then it said it did not regonize tpm2-device=auto so it ignored it and laptop still asks for encryption password 😕

So anyone here have solution on how to get TPM 2 and LUKS2 to automaticly decrypt the drive so it brings me login screen instead of disk decryption password and then login screen?

---

<div class="post-metadata">

**Author:** ![Tealk](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/tealk/32/24794_2.png) [@Tealk](https://community.frame.work/u/Tealk)\
**Post date:** [May 6, 2026, 8:11pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/29 "2026-05-06T20:11:50Z")

</div>

I managed to set up my Arch with TPM autodecryption like this; it was on a Framework 16", but that shouldn’t make a difference in this case.

> **[TPM2 Autodecrypt on Arch Linux with UKI and Secure Boot](https://buck.zone/en/p/arch-tpm2-autodecrypt/)**
>
> A step-by-step guide to passwordless LUKS2 decryption via TPM2 on Arch Linux using Unified Kernel Images, systemd-boot and sbctl.

---

<div class="post-metadata">

**Author:** ![Michael\_Hanulec](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@Michael\_Hanulec](https://community.frame.work/u/Michael_Hanulec)\
**Post date:** [May 15, 2026, 9:58pm UTC](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005/30 "2026-05-15T21:58:48Z")

</div>

whatever you do, make sure to generate a 2nd tpm luks passphrase so you can save your install once something goes wrong.

[Previous page](https://community.frame.work/t/guide-setup-tpm2-autodecrypt/39005.md?page=1)
