Skip to content

menu: Stop the persistent EFI variables overriding default_entry - #653

Open
wehrwolfmann wants to merge 1 commit into
Limine-Bootloader:trunkfrom
wehrwolfmann:menu/default-entry-has-entry
Open

wehrwolfmann wants to merge 1 commit into
Limine-Bootloader:trunkfrom
wehrwolfmann:menu/default-entry-has-entry

Conversation

@wehrwolfmann

Copy link
Copy Markdown

Fixes #652.

On a dual-boot box default_entry stopped preselecting Windows: whatever was
booted last came up instead, so the machine booted Linux on the timeout.

The selection in _menu is a chain of if (!has_entry) steps.
LoaderEntryOneShot sets has_entry once it resolves an entry. The
default_entry block right below it sets selected_entry and leaves
has_entry alone - not in the index branch, not in the path branch. So the
next two blocks still see it false: remember_last_entry reads
LimineLastBootedEntry and overwrites the selection, and
bli_get_default_entry shadows it the same way. A numeric default_entry
goes through the same block, so switching to an index does not help either.

CONFIG.md documents the opposite, so this is a code bug and not a doc one:

remember_last_entry and the persistent LoaderEntryDefault variable are
consulted, in that order, only where this option is not set.

The patch sets has_entry in both branches, the way LoaderEntryOneShot
already does. The path branch only sets it once the path resolved, so an
unresolvable default_entry keeps falling through as before.

Built clean on trunk with ./configure --enable-uefi-x86-64 CC_FOR_TARGET=clang, and again with --enable-bios since the block is not
UEFI-only; no new warnings. On the affected machine remember_last_entry: no
brings the preselection back, which is the workaround the issue describes.

Signed-off-by: Wehrwolfmann <256216494+wehrwolfmann@users.noreply.github.com>
Assisted-by: Claude:claude-opus-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant