From 9bae8e67d2fcb5e0c557edb85c9fc7bd926c4dfa Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 19 Nov 2023 16:14:53 -0500 Subject: [PATCH] efi: Only try to update firmware if booted via EFI Otherwise we'll just fail. --- src/efi.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/efi.rs b/src/efi.rs index 4d18bdcee..ffe4b8167 100644 --- a/src/efi.rs +++ b/src/efi.rs @@ -128,6 +128,10 @@ impl Efi { #[context("Updating EFI firmware variables")] fn update_firmware(&self, device: &str, espdir: &openat::Dir) -> Result<()> { + if !is_efi_booted()? { + log::debug!("Not booted via EFI, skipping firmware update"); + return Ok(()); + } let efidir = &espdir.sub_dir("EFI").context("Opening EFI")?; let vendordir = super::grubconfigs::find_efi_vendordir(efidir)?; let vendordir = vendordir