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

Signed-off-by: Fabian Grünbichler <f.gruenbich...@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to