From 9299c328ac95940d22fe4ad6881e995e5000884c Mon Sep 17 00:00:00 2001 From: WilliButz Date: Tue, 29 Sep 2026 11:46:48 +0200 Subject: [PATCH] tpm2-util: print log message when search for NvPCR definition fails Before this change it took some effort to find out why NvPCR related functions would fail. Specifically, missing NvPCR defintions would let the `systemd-pcrlogin@` services fail with the following log message: ``` Could not extend NvPCR: No such file or directory ``` There are two annoyances with this: even with log level debug there was no indication of what is missing, and then there is (at least) one other reason for the same error to be logged, which is the absence of the PCR pubkey. The latter can be discovered by setting log level debug for the affected service. (cherry picked from commit b43fed88efe34889a49a7710a92141849dc4906d) --- src/shared/tpm2-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c index f6bf2cc35a..e76d0c6977 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -8770,7 +8770,7 @@ static int nvpcr_data_load(const char *name, NvPCRData *ret) { _cleanup_fclose_ FILE *f = NULL; r = search_and_fopen_nulstr(fname, "re", /* root= */ NULL, CONF_PATHS_NULSTR("nvpcr"), &f, &path); if (r < 0) - return r; + return log_debug_errno(r, "Failed to open NvPCR definition '%s': %m", fname); _cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL; r = sd_json_parse_file(