Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard load-options that start with WINDOWS #621

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Metabolix
Copy link

Windows bcdedit.exe creates boot entries where load options begin with "WINDOWS\0" (in 8-bit chars), followed by some Windows-specific data which is useless for shim. This data causes shim error "Failed to open \EFI\mypath\䥗䑎坏S".

Resolves: #370

Windows bcdedit.exe creates boot entries where load options
begin with "WINDOWS\0" (in 8-bit chars), followed by some
Windows-specific data which is useless for shim. This data
causes shim error "Failed to open \EFI\mypath\䥗䑎坏S".

Resolves: rhboot#370
Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Metabolix added a commit to Metabolix/HackBGRT that referenced this pull request Dec 31, 2023
Shim expects a filename or nothing in the load options.

To avoid an error message during boot, do several things:

When creating the NVRAM entry, use empty load options. The current
string ("HackBGRT\0") was just a decoration, and it's luckily ignored
by shim because the length is odd.

When creating the entry with BCDEdit, manually fix the load options.
The load options in BCDEdit entries start with "WINDOWS\0" followed
by UINT32 version, as seen in ReactOS struct BL_WINDOWS_LOAD_OPTIONS.
The version is 1, but BCDEdit seems to be happy with a higher number.
By setting this version to 'X' (0x58), the string becomes a valid
UCS-2 file name. Update the installer so that the HackBGRT loader is
installed with this weird file name.

The reason why the load options cannot be deleted completely is that
BCDEdit will recreate the entry on next boot if it doesn't find the
entry it just tried to create.

See: rhboot/shim#621
See: https://github.com/reactos/reactos/blob/v0.4.7/boot/environ/include/bl.h#L911
@Metabolix
Copy link
Author

Note: Depending on the system, these characters may be rendered as blocks or not at all. Most similar reports seem to contain either filled blocks or just the letter S, which may lead to misinterpreting the issue.

Are there any active rhshim developers who could review this?

@subvert0r
Copy link

Seems like all the shim developers are either dead or not to be found, why is no one fixing this??

@THS-on
Copy link

THS-on commented Jul 30, 2024

@steve-mcintyre can you have look at this?

Copy link
Collaborator

@steve-mcintyre steve-mcintyre left a comment

Choose a reason for hiding this comment

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

Looks plausible to me

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.

It doesn't seem to find grubx64.efi under certain conditions.
4 participants