[systemd-devel] Handle device node timeout?
Mikko Rapeli
mikko.rapeli at linaro.org
Tue Jan 16 14:06:46 UTC 2024
Hi,
I have services which depend on a specific device node. How can I run
some recovery actions when the default 90s timeout for finding this
device is hit?
OnFailure= doesn't work as the service is not even started.
Specifically the case is about supporting TPM2 encrypted rootfs but falling
back to plain-text rootfs generation if there is no TPM2 device. Currently
my initramfs works with TPM2 but without it fails with:
[ TIME ] Timed out waiting for device /dev/gpt-auto-root.
[DEPEND] Dependency failed for Initrd Root Device.
[DEPEND] Dependency failed for Root Partition.
[DEPEND] Dependency failed for Initrd Root File System.
[DEPEND] Dependency failed for /sysroot/usr.
[DEPEND] Dependency failed for Initrd File Systems.
[DEPEND] Dependency failed for TPM2 PCR File System Measurement of /sysroot.
[ TIME ] Timed out waiting for device /dev/tpmrm0.
[DEPEND] Dependency failed for Repartition Root Disk.
[DEPEND] Dependency failed for TPM2 PCR Machine ID Measurement.
[ OK ] Stopped Dispatch Password Requests to Console Directory Watch.
[ OK ] Reached target Timer Units.
[ OK ] Reached target Socket Units.
[ OK ] Started Emergency Shell.
[ OK ] Reached target Emergency Mode.
Fix is to remove Encrypt=tpm2 from systemd-repart config to generate plain
ext4 rootfs. Running the recovery scripts manually in emergency console works, but I
can't figure out how to trigger this recovery automatically.
Using systemd 254.4 from yocto:
sh-5.2# systemctl --version
systemd 254 (254.4^)
+PAM +AUDIT +SELINUX -APPARMOR +IMA -SMACK +SECCOMP -GCRYPT -GNUTLS +OPENSSL +ACL +BLKID -CURL -ELFUTILS -FIDO2 -IDN2 -IDN -IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK -PCRE2 -PWQUALITY -P11KIT -QRENCODE +TPM2 -BZIP2 -LZ4 -XZ -ZLIB +ZSTD -BPF_FRAMEWORK +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=hybrid
Cheers,
-Mikko
More information about the systemd-devel
mailing list