Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 945734 - >=sys-apps/systemd-256.7[tpm] needs to check for some tpm kernel options
Summary: >=sys-apps/systemd-256.7[tpm] needs to check for some tpm kernel options
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo systemd Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-02 12:35 UTC by Pacho Ramos
Modified: 2024-12-03 21:19 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
systemctl list-dependencies --reverse tpm2.target output (output.txt,1.71 KB, text/plain)
2024-12-03 20:09 UTC, Pacho Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2024-12-02 12:35:37 UTC
Hello,

I was updating one of my systems and I got suprised by they taking a long time to reboot. I realized that systemd was waiting for:
systemd[1]: Expecting device /dev/tpmrm0...

But no /dev/tpm* was created at bootime.

Then, I realize that I only had:
TPM HW Random Number Generator support

kernel option enabled.

I have build all the other modules and it seems that now everything works as expected. My system uses tpm_tis module, but I don't know if other systems could need different modules to be available :/
# journalctl -b -k -g "tpm"
dic 02 13:24:46 hp-pacho kernel: efi: ACPI=0x3fbfe000 ACPI 2.0=0x3fbfe014 TPMFinalLog=0x3fac0000 SMBIOS=0x3c977000 ESRT=0x3c972b98 MEMATTR=0x3636b018 INITRD=0x36368d98 RNG=0x3fb66018 TPMEventLog=0x3fb5d018 
dic 02 13:24:46 hp-pacho kernel: ACPI: SSDT 0x000000003FBE6000 0005FB (v02 HPQOEM Tpm2Tabl 00001000 INTL 20160527)
dic 02 13:24:46 hp-pacho kernel: ACPI: TPM2 0x000000003FBE5000 00004C (v04 HPQOEM TGL-ULT  00000002      01000013)
dic 02 13:24:46 hp-pacho kernel: ACPI: Reserving TPM2 table memory at [mem 0x3fbe5000-0x3fbe504b]
dic 02 13:24:46 hp-pacho systemd[1]: systemd 256.8 running in system mode (+PAM -AUDIT -SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID -CURL -ELFUTILS -FIDO2 +IDN2 -IDN -IPTC +KMOD >
dic 02 13:24:46 hp-pacho systemd[1]: Expecting device /dev/tpmrm0...
dic 02 13:24:47 hp-pacho kernel: tpm_tis IFX0785:00: 2.0 TPM (device-id 0x1B, rev-id 22)

That would mean that, at least, CONFIG_TCG_TIS would be needed. But I also see 
CONFIG_TCG_CRB module is loaded on my system.

Thanks a lot
Comment 1 Mike Gilbert gentoo-dev 2024-12-02 18:40:31 UTC
I don't think it makes sense to add kernel checks for specific TPM hardware.

Enabling USE="tpm" shouldn't cause systemd to automatically wait for a TPM device; you must have configured something like crypttab to look for it.

If you cant figure out what caused it, maybe try providing some additional journal output.
Comment 2 Mike Gilbert gentoo-dev 2024-12-02 18:56:25 UTC
(In reply to Mike Gilbert from comment #1)
> Enabling USE="tpm" shouldn't cause systemd to automatically wait for a TPM
> device; you must have configured something like crypttab to look for it.

If you haven't configured something to depend on the tpmrm0 device, this seems like a systemd bug to me.
Comment 3 Mike Gilbert gentoo-dev 2024-12-02 19:25:00 UTC
Hmm, this dependency could be generated by tpm2.target.

Please run the following to see if something is bringing tpm2.target into the depgraph.

systemctl list-dependencies --reverse tpm2.target
Comment 4 Pacho Ramos gentoo-dev 2024-12-03 20:09:45 UTC
Created attachment 913271 [details]
systemctl list-dependencies --reverse tpm2.target output

Thanks
Comment 5 Mike Gilbert gentoo-dev 2024-12-03 21:19:01 UTC
It looks like systemd-tpm2-generator is responsible here.

systemd-tpm2-generator looks at sysfs and the EFI firmware to determine if a TPM2 module exists. If a TPM2 module exists, it adds Wants=tpm2.target to sysinit.target.

I think the issue here is that you had the tpmrm subsystem enabled, but not the appropriate hardware driver. systemd-tpm2-generator doesn't account for that possibility.

I'm not going to add a kernel check to the systemd ebuild for this; there's no way for me to know which tpm drivers are necessary for a given system.

You might consider filing an issue upstream to ask that systemd-tpm2-generator be improved, though they might just tell you to fix your kernel config (which you have already done).