From 642236edec2080d6bedde9662a41d58a44d20a20 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sat, 26 Sep 2026 20:17:50 -0700 Subject: [PATCH] fix(autoconfigure): skip filesystems and directories that can't be scanned Commit 2da1cea skipped filesystems that couldn't be opened, but an error while scanning an opened filesystem, such as a driver returning DEVICE_ERROR or ACCESS_DENIED, still aborted autoconfiguration for every filesystem. Log a warning and move on to the next scan instead, and do the same for each directory scanned for Linux kernels. --- crates/boot/src/autoconfigure.rs | 31 ++++++++++++++++++++------ crates/boot/src/autoconfigure/linux.rs | 9 +++++--- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/crates/boot/src/autoconfigure.rs b/crates/boot/src/autoconfigure.rs index 04d22c6..28e69cb 100644 --- a/crates/boot/src/autoconfigure.rs +++ b/crates/boot/src/autoconfigure.rs @@ -48,19 +48,36 @@ pub fn autoconfigure(config: &mut RootConfiguration) -> Result<()> { // Trade the filesystem protocol for the uefi filesystem helper. let mut filesystem = FileSystem::new(filesystem); + // A scan that fails is skipped, as a filesystem that can't be read should not + // prevent autoconfiguring the other filesystems. + // Scan the filesystem for BLS supported configurations. - let bls_found = bls::scan(&mut filesystem, &root, config) - .context("unable to scan for bls configurations")?; + let bls_found = match bls::scan(&mut filesystem, &root, config) { + Ok(found) => found, + Err(error) => { + warn!( + "unable to scan filesystem for bls configurations: {:#}", + error + ); + false + } + }; // If BLS was not found, scan for Linux configurations. - if !bls_found { - linux::scan(&mut filesystem, &root, config) - .context("unable to scan for linux configurations")?; + if !bls_found && let Err(error) = linux::scan(&mut filesystem, &root, config) { + warn!( + "unable to scan filesystem for linux configurations: {:#}", + error + ); } // Always look for Windows configurations. - windows::scan(&mut filesystem, &root, config) - .context("unable to scan for windows configurations")?; + if let Err(error) = windows::scan(&mut filesystem, &root, config) { + warn!( + "unable to scan filesystem for windows configurations: {:#}", + error + ); + } } Ok(()) diff --git a/crates/boot/src/autoconfigure/linux.rs b/crates/boot/src/autoconfigure/linux.rs index f8e6b54..b8b9860 100644 --- a/crates/boot/src/autoconfigure/linux.rs +++ b/crates/boot/src/autoconfigure/linux.rs @@ -13,6 +13,7 @@ use edera_sprout_parsing::{ LINUX_INITRAMFS_PREFIXES, LINUX_KERNEL_PREFIXES, initramfs_candidates, match_kernel_prefix, unique_hash, }; +use log::warn; use uefi::CString16; use uefi::fs::{FileSystem, Path, PathBuf}; use uefi::proto::device_path::DevicePath; @@ -169,10 +170,12 @@ pub fn scan( let root_unique_hash = unique_hash(&root); // Scan all locations for kernel pairs, adding them to the list. + // A location that can't be scanned is skipped, so the other locations are still used. for location in SCAN_LOCATIONS { - let scanned = scan_directory(filesystem, location) - .with_context(|| format!("unable to scan directory {}", location))?; - pairs.extend(scanned); + match scan_directory(filesystem, location) { + Ok(scanned) => pairs.extend(scanned), + Err(error) => warn!("unable to scan directory {}: {:#}", location, error), + } } // If no kernel pairs were found, return false.