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.
This commit is contained in:
alex authored and Alex Zenla committed 2026-09-26 20:52:15 -07:00
1 parent b4e765279b
commit 642236edec
2 files changed
+30 -10

No files matched your search

+24 -7
View File
@@ -48,19 +48,36 @@ pub fn autoconfigure(config: &mut RootConfiguration) -> Result<()> {
// Trade the filesystem protocol for the uefi filesystem helper. // Trade the filesystem protocol for the uefi filesystem helper.
let mut filesystem = FileSystem::new(filesystem); 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. // Scan the filesystem for BLS supported configurations.
let bls_found = bls::scan(&mut filesystem, &root, config) let bls_found = match bls::scan(&mut filesystem, &root, config) {
.context("unable to scan for bls configurations")?; 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 was not found, scan for Linux configurations.
if !bls_found { if !bls_found && let Err(error) = linux::scan(&mut filesystem, &root, config) {
linux::scan(&mut filesystem, &root, config) warn!(
.context("unable to scan for linux configurations")?; "unable to scan filesystem for linux configurations: {:#}",
error
);
} }
// Always look for Windows configurations. // Always look for Windows configurations.
windows::scan(&mut filesystem, &root, config) if let Err(error) = windows::scan(&mut filesystem, &root, config) {
.context("unable to scan for windows configurations")?; warn!(
"unable to scan filesystem for windows configurations: {:#}",
error
);
}
} }
Ok(()) Ok(())
+6 -3
View File
@@ -13,6 +13,7 @@ use edera_sprout_parsing::{
LINUX_INITRAMFS_PREFIXES, LINUX_KERNEL_PREFIXES, initramfs_candidates, match_kernel_prefix, LINUX_INITRAMFS_PREFIXES, LINUX_KERNEL_PREFIXES, initramfs_candidates, match_kernel_prefix,
unique_hash, unique_hash,
}; };
use log::warn;
use uefi::CString16; use uefi::CString16;
use uefi::fs::{FileSystem, Path, PathBuf}; use uefi::fs::{FileSystem, Path, PathBuf};
use uefi::proto::device_path::DevicePath; use uefi::proto::device_path::DevicePath;
@@ -169,10 +170,12 @@ pub fn scan(
let root_unique_hash = unique_hash(&root); let root_unique_hash = unique_hash(&root);
// Scan all locations for kernel pairs, adding them to the list. // 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 { for location in SCAN_LOCATIONS {
let scanned = scan_directory(filesystem, location) match scan_directory(filesystem, location) {
.with_context(|| format!("unable to scan directory {}", location))?; Ok(scanned) => pairs.extend(scanned),
pairs.extend(scanned); Err(error) => warn!("unable to scan directory {}: {:#}", location, error),
}
} }
// If no kernel pairs were found, return false. // If no kernel pairs were found, return false.