public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] node: add guard for missing secure-boot efi var
@ 2023-11-28  6:58 Fabian Grünbichler
  2023-11-28 12:42 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2023-11-28  6:58 UTC (permalink / raw)
  To: pve-devel

some (old) systems might have efivars, but don't have the SecureBoot one.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    reported on the forum for a Dell server from 2009(!):
    https://forum.proxmox.com/threads/error-failed-to-read-secure-boot-state-from-pveproxy-since-updating-to-6-5-11-4-pve-8-1-3.137225/

 PVE/API2/Nodes.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 94b201726..3619190de 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -365,8 +365,10 @@ my sub get_boot_mode_info {
 	mode => $is_efi_booted ? 'efi' : 'legacy-bios',
     };
 
-    if ($is_efi_booted) {
-	my $efi_var_sec_boot_entry = eval { file_get_contents("/sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c") };
+    my $efi_var = "/sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c";
+
+    if ($is_efi_booted && -e $efi_var) {
+	my $efi_var_sec_boot_entry = eval { file_get_contents($efi_var) };
 	if ($@) {
 	    warn "Failed to read secure boot state: $@\n";
 	} else {
-- 
2.39.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-28 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28  6:58 [pve-devel] [PATCH manager] node: add guard for missing secure-boot efi var Fabian Grünbichler
2023-11-28 12:42 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal