fix: gracefully handle missing board_name DMI file#264
Open
beyondbrokkoli wants to merge 1 commit into
Open
Conversation
Replaces `.expect()` with safe error handling when reading `/sys/devices/virtual/dmi/id/board_name`. This prevents a fatal panic in virtualized environments (like default QEMU/Proxmox VMs) where SMBIOS Type 2 baseboard data is absent and the file does not exist. Profiles will now safely fail the match and move on instead of crashing the installer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Calamares crash in QEMU/Proxmox VMs caused by missing board_name
Crash Log Reference: https://paste.cachyos.org/p/6c1fa8e.log
The Issue & Cause:
When installing CachyOS inside a default Proxmox/QEMU virtual machine, the Calamares installer currently suffers a fatal crash during the
chwdphase.By default, QEMU/Proxmox does not provide SMBIOS Type 2 (Baseboard) data to the guest OS, meaning the Linux kernel never generates the
/sys/devices/virtual/dmi/id/board_namefile. A recent commit addingboard_name_patternsupport uses.expect()when reading this file, which immediately panics and kills the installer if the file is missing.The Debugging and Testing Process:
To ensure this fix is robust and behaves exactly as expected in a live environment, I ran through a complete verification session:
I originally bypassed the Calamares crash by editing my Proxmox VM configuration and manually injecting a fake motherboard via
args: -smbios type=2,manufacturer=Proxmox,product=ProxmoxVM. Because I have installed CachyOS in VMs many times and never needed this workaround, it isolated the missing baseboard file as the exact point of regression.To test the unpatched code locally, I booted a Live ISO (with 16GB RAM to handle package syncing), removed the SMBIOS workaround from the VM, and cloned the repo. To perfectly replicate how
calamares/modules/chwd/main.pyexecutes the hardware detection inside the chroot, I built the code and ran:This successfully replicated the exact
.expect()panic seen during the GUI installation.I applied this patch, which simply replaces
.expect()with anif let Ok(...)block. I rebuilt the binary and ran the exact same--autoconfigurecommand. The patched tool safely caught the missing file, assumed the hardware didn't match the profile, returned an empty vector, and successfully completed the hardware configuration without panicking.Transparency Note:
While I tracked down the hypervisor regression, isolated the bug, and structured the testing methodology through VM debugging, I do not write Rust natively. I relied on an LLM (Gemini) to help me draft the safe Rust syntax for the fix. The logic makes complete sense for the VM use-case, but I wanted to be fully transparent about how the code was generated. Let me know if any adjustments are needed!