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)
This commit is contained in:
WilliButz
2026-10-16 11:36:32 +01:00
committed by Luca Boccassi
parent 26d273d804
commit 9299c328ac
+1 -1
View File
@@ -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(