Skip to content

bootloader: fix refind install crash when /boot is seperate#198

Open
ptr1337 wants to merge 1 commit into
cachyosfrom
refind-not-found-fix
Open

bootloader: fix refind install crash when /boot is seperate#198
ptr1337 wants to merge 1 commit into
cachyosfrom
refind-not-found-fix

Conversation

@ptr1337
Copy link
Copy Markdown
Member

@ptr1337 ptr1337 commented Mar 21, 2026

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

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]>
@ptr1337 ptr1337 self-assigned this Mar 21, 2026
@ptr1337 ptr1337 added the bug Something isn't working label Mar 21, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.conf with an existence check to avoid FileNotFoundError.
  • When missing, generate refind_linux.conf with entries using the computed kernel parameters.
  • Preserve the existing behavior of updating refind.conf via update_refind_config().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we even want to read old config though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants