]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-builtin-tpm2-id: gracefully skip tpm2 identification if tss2-libs are not installed
authorLennart Poettering <lennart@amutable.com>
Tue, 5 May 2026 10:43:42 +0000 (12:43 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 5 May 2026 15:21:48 +0000 (17:21 +0200)
Fixes: #41714
src/udev/udev-builtin-tpm2_id.c

index 6edf618e111129b71e0166fafe6c329f109c3faf..968677a7342bc15bc733fef18ce5c3d43edc2f87 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "device-util.h"
+#include "errno-util.h"
 #include "string-util.h"
 #include "tpm2-util.h"
 #include "udev-builtin.h"
@@ -20,6 +21,10 @@ static int builtin_tpm2_id(UdevEvent *event, int argc, char *argv[]) {
 
         _cleanup_(tpm2_context_unrefp) Tpm2Context *c = NULL;
         r = tpm2_context_new(dn, &c);
+        if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) {
+                log_device_debug_errno(dev, r, "Full TPM2 support is not available, skipping identification of TPM2 device '%s'.", dn);
+                return 0;
+        }
         if (r < 0)
                 return log_device_error_errno(dev, r, "Failed to open device node '%s': %m", dn);