bootloader: fix refind install crash when /boot is seperate#198
Open
ptr1337 wants to merge 1 commit into
Open
Conversation
refind-install does not always create /boot/refind_linux.conf, e.g. when /boot is on a separate fat32 partition. The code unconditionally tried to open the file for reading, causing a FileNotFoundError. If the file exists after refind-install, update it as before. Otherwise, generate it manually with the correct kernel parameters. Issue: https://www.reddit.com/r/cachyos/comments/1rzytkb/trying_to_install_cachyos_get_an_error/ Signed-off-by: Peter Jung <[email protected]>
There was a problem hiding this comment.
Pull request overview
Fixes a crash in the Calamares bootloader module when installing rEFInd in setups where refind-install does not create /boot/refind_linux.conf (notably when /boot is on a separate FAT32 partition). The change makes the installer resilient by only modifying the file when present, otherwise generating a minimal, correct configuration.
Changes:
- Guard reading
/boot/refind_linux.confwith an existence check to avoidFileNotFoundError. - When missing, generate
refind_linux.confwith entries using the computed kernel parameters. - Preserve the existing behavior of updating
refind.confviaupdate_refind_config().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ventureoo
reviewed
Mar 26, 2026
| elif line.startswith('"Boot to single-user mode"'): | ||
| line = f'"Boot to single-user mode" "{kernel_params}" single' | ||
| refind_file.write(line + "\n") | ||
| if os.path.exists(conf_path): |
Member
There was a problem hiding this comment.
Why do we even want to read old config though?
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.
refind-install does not always create /boot/refind_linux.conf, e.g. when /boot is on a separate fat32 partition. The code unconditionally tried to open the file for reading, causing a FileNotFoundError.
If the file exists after refind-install, update it as before. Otherwise, generate it manually with the correct kernel parameters.
Issue: https://www.reddit.com/r/cachyos/comments/1rzytkb/trying_to_install_cachyos_get_an_error/
Log (before termbin deletes it):
refind.log