Skip to content

Restore EFI/BOOT/BOOTX64.EFI fallback loader - #27

Merged
ericbsd merged 1 commit into
masterfrom
fix-377-efi-boot-fallback
Aug 12, 2026
Merged

ericbsd merged 1 commit into
masterfrom
fix-377-efi-boot-fallback

Conversation

@ericbsd

@ericbsd ericbsd commented Aug 12, 2026 •

Copy link
Copy Markdown

The UEFI default/removable-media path EFI/BOOT/BOOTX64.EFI was populated until commit e66d648, which dropped the block that copied the loader there. The EFI/BOOT directory is still created but left empty, so systems that rely on the fallback path fail to auto-boot.

This affects removable and USB-attached drives, where firmware typically does not persist the efibootmgr NVRAM entry and instead looks for EFI/BOOT/BOOTX64.EFI. Repopulate that path with rEFInd (plus REFIND.CONF, ICONS, and background.png) or the BSD loader, matching the current EFI/refind and EFI/ copies.

Fixes ghostbsd/issues#377

Summary by Sourcery

Restore population of the UEFI fallback boot path EFI/BOOT/BOOTX64.EFI for installed systems.

New Features:

  • Populate the UEFI removable-media fallback path EFI/BOOT/BOOTX64.EFI with either rEFInd or the BSD loader on installation media.

Bug Fixes:

  • Ensure removable and USB-attached drives can auto-boot by repopulating the EFI/BOOT fallback loader path.

The UEFI default/removable-media path EFI/BOOT/BOOTX64.EFI was populated
until commit e66d648, which dropped the block that copied the loader
there. The EFI/BOOT directory is still created but left empty, so systems
that rely on the fallback path fail to auto-boot.

This affects removable and USB-attached drives, where firmware typically
does not persist the efibootmgr NVRAM entry and instead looks for
EFI/BOOT/BOOTX64.EFI. Repopulate that path with rEFInd (plus REFIND.CONF,
ICONS, and background.png) or the BSD loader, matching the current
EFI/refind and EFI/<system> copies.

Fixes ghostbsd/issues#377
@ericbsd
ericbsd requested review from a team as code owners August 12, 2026 11:07
@sourcery-ai

sourcery-ai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Restores population of the UEFI fallback boot path EFI/BOOT/BOOTX64.EFI so removable/USB-attached drives can auto-boot using either rEFInd or the BSD loader, matching existing EFI layout.

Flow diagram for restored EFI fallback boot loader population

flowchart TD
    A[setup_efi_boot] --> B[Check /usr/local/refind exists]
    B --> C[Check EFILOADER = refind]
    C -->|both true| D[Copy refind_x64.efi to EFI/BOOT/BOOTX64.EFI]
    D --> E[Copy refind.conf-sample to EFI/BOOT/REFIND.CONF]
    E --> F[Copy icons directory to EFI/BOOT/ICONS]
    F --> G[Copy background.png to EFI/BOOT/background.png]
    C -->|any check fails| H[Copy boot/loader.efi to EFI/BOOT/BOOTX64.EFI]
    G --> I[umount $FSMNT/boot/efi]
    H --> I
Loading

File-Level Changes

Change Details Files
Repopulate the UEFI fallback loader path EFI/BOOT/BOOTX64.EFI with either rEFInd or the BSD loader during EFI boot setup.
  • Add logic in EFI boot setup to detect when rEFInd is available and selected as the EFI loader.
  • Copy rEFInd binaries, sample config, icons, and background image into EFI/BOOT when rEFInd is in use.
  • Fallback to copying the system loader.efi into EFI/BOOT/BOOTX64.EFI when rEFInd is not used.
  • Keep existing EFI mount/cleanup behavior unchanged while extending the setup phase.
backend/functions-unmount.sh

Assessment against linked issues

Issue Objective Addressed Explanation
ghostbsd/issues#377 Ensure that the installer populates the UEFI fallback loader path EFI/BOOT/BOOTX64.EFI on the target EFI partition so that removable/USB-attached GhostBSD installations can auto-boot. ✅

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new fallback copy logic assumes ${FSMNT}/boot/efi/EFI/BOOT already exists; consider explicitly ensuring this directory is created in this function before issuing the cp commands so the behavior remains robust if earlier setup changes.
  • Hardcoding BOOTX64.EFI for the fallback path may not be appropriate for non‑x86_64 architectures; consider making the filename conditional on the target architecture similarly to how other EFI loader paths are handled.
  • You now have two places where the main EFI loader is being copied (EFI/ and EFI/BOOT); consider refactoring into a small helper or using shared variables so both locations stay consistent if loader names or paths change in the future.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new fallback copy logic assumes ${FSMNT}/boot/efi/EFI/BOOT already exists; consider explicitly ensuring this directory is created in this function before issuing the cp commands so the behavior remains robust if earlier setup changes.
- Hardcoding BOOTX64.EFI for the fallback path may not be appropriate for non‑x86_64 architectures; consider making the filename conditional on the target architecture similarly to how other EFI loader paths are handled.
- You now have two places where the main EFI loader is being copied (EFI/<system> and EFI/BOOT); consider refactoring into a small helper or using shared variables so both locations stay consistent if loader names or paths change in the future.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericbsd
ericbsd merged commit b09658e into master Aug 12, 2026
2 checks passed
@ericbsd
ericbsd deleted the fix-377-efi-boot-fallback branch August 12, 2026 20:25
@github-project-automation github-project-automation Bot moved this from In Review to Done in Development Tracker Aug 12, 2026
@ericbsd ericbsd self-assigned this Oct 17, 2026
@ericbsd ericbsd removed the status in Development Tracker Oct 17, 2026
@ericbsd ericbsd moved this to Done in Development Tracker Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bootx64.efi does not exist in /efi/boot/

2 participants