From 2da1cea25c7330857896003ccbf0e0a18e964470 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sat, 26 Sep 2026 18:19:55 -0700 Subject: [PATCH] fix(autoconfigure): skip filesystems that can't be opened If the device path or filesystem protocol of any detected filesystem could not be opened, autoconfiguration failed entirely and boot was aborted. Log a warning and skip that filesystem instead, so the other filesystems are still autoconfigured. --- crates/boot/src/autoconfigure.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/crates/boot/src/autoconfigure.rs b/crates/boot/src/autoconfigure.rs index 8a1fddf..04d22c6 100644 --- a/crates/boot/src/autoconfigure.rs +++ b/crates/boot/src/autoconfigure.rs @@ -1,5 +1,6 @@ use anyhow::{Context, Result}; use edera_sprout_config::RootConfiguration; +use log::warn; use uefi::fs::FileSystem; use uefi::proto::device_path::DevicePath; use uefi::proto::media::fs::SimpleFileSystem; @@ -25,15 +26,24 @@ pub fn autoconfigure(config: &mut RootConfiguration) -> Result<()> { // For each filesystem that was detected, scan it for supported autoconfig mechanisms. for handle in filesystem_handles { // Acquire the device path root for the filesystem. - let root = { - uefi::boot::open_protocol_exclusive::(handle) - .context("unable to get root for filesystem")? - .to_boxed() + // A filesystem that can't be opened is skipped, as it should not prevent + // autoconfiguring the other filesystems. + let root = match uefi::boot::open_protocol_exclusive::(handle) { + Ok(root) => root.to_boxed(), + Err(error) => { + warn!("skipping filesystem, unable to get its root: {}", error); + continue; + } }; // Open the filesystem that was detected. - let filesystem = uefi::boot::open_protocol_exclusive::(handle) - .context("unable to open filesystem")?; + let filesystem = match uefi::boot::open_protocol_exclusive::(handle) { + Ok(filesystem) => filesystem, + Err(error) => { + warn!("skipping filesystem, unable to open it: {}", error); + continue; + } + }; // Trade the filesystem protocol for the uefi filesystem helper. let mut filesystem = FileSystem::new(filesystem);