Skip to contentSkip to conversation

tpm: include EFI status code in "unknown TPM error" message

PATCH In review [email protected] 2 participants 2 messages Mar 27

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: include EFI status code in "unknown TPM error" message

From: Mikhail Malyshev <[email protected]>

When grub_efi_log_event_status() encounters an EFI status code that doesn't match any known case, it prints the unhelpful generic "unknown TPM error" message, making root cause analysis impossible.

This was observed on Dell R630 servers booting EVE OS, where the boot process gets stuck at the "unknown TPM error" prompt after a hardware watchdog reset. The watchdog performs a hard reset without allowing the TPM to cleanly shut down, leaving the TPM in an unexpected state on the next boot that returns an EFI status code outside the handled set.

Include the raw EFI status value in hex so the actual code is visible in the GRUB output, enabling proper diagnosis.

---
 grub-core/commands/efi/tpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
grub-core/commands/efi/tpm.c +2 -1
index 1c4906403..6c1ae57a8 100644
@@ -149,7 +149,8 @@ grub_efi_log_event_status (grub_efi_status_t status)
     case GRUB_EFI_NOT_FOUND:
       return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
     default:
-      return grub_error (grub_is_tpm_fail_fatal () ? GRUB_ERR_UNKNOWN_DEVICE : GRUB_ERR_NONE, N_("unknown TPM error"));
+      return grub_error (grub_is_tpm_fail_fatal () ? GRUB_ERR_UNKNOWN_DEVICE : GRUB_ERR_NONE,
+			 "unknown TPM error: 0x%lx", (unsigned long) status);
     }
 }
 
Signature · 7 lines
2.43.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

Hi Mikhail,

Please read this new document (just merged) to turn this contribution into a MR.

https://gitlab.freedesktop.org/gnu-grub/grub/-/blob/master/CONTRIBUTING?ref_type=heads

Let me know if you have any questions.

Quoted 37 lines · On Fri, Mar 27, 2026 at 7:58 AM <[email protected]> wrote:

From: Mikhail Malyshev <[email protected]>

When grub_efi_log_event_status() encounters an EFI status code that doesn't match any known case, it prints the unhelpful generic "unknown TPM error" message, making root cause analysis impossible.

This was observed on Dell R630 servers booting EVE OS, where the boot process gets stuck at the "unknown TPM error" prompt after a hardware watchdog reset. The watchdog performs a hard reset without allowing the TPM to cleanly shut down, leaving the TPM in an unexpected state on the next boot that returns an EFI status code outside the handled set.

Include the raw EFI status value in hex so the actual code is visible in the GRUB output, enabling proper diagnosis.

---
 grub-core/commands/efi/tpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
grub-core/commands/efi/tpm.c +2 -1
index 1c4906403..6c1ae57a8 100644
@@ -149,7 +149,8 @@ grub_efi_log_event_status (grub_efi_status_t status)
     case GRUB_EFI_NOT_FOUND:
       return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
     default:
-      return grub_error (grub_is_tpm_fail_fatal () ?
 GRUB_ERR_UNKNOWN_DEVICE : GRUB_ERR_NONE, N_("unknown TPM error"));
+      return grub_error (grub_is_tpm_fail_fatal () ?
 GRUB_ERR_UNKNOWN_DEVICE : GRUB_ERR_NONE,
+                        "unknown TPM error: 0x%lx", (unsigned long)
 status);
     }

}

Quoted 9 lines

--
2.43.0

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel