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
Secure Boot support for OUTPUT=USB #3031
Conversation
In output/USB/Linux-i386/100_create_efiboot.sh add Secure Boot support for OUTPUT=USB by using SECURE_BOOT_BOOTLOADER as first stage Secure Boot bootloader BOOTX64.efi and grub*.efi as second stage Secure Boot bootloader files in the same was as already done for OUTPUT=ISO in output/ISO/Linux-i386/250_populate_efibootimg.sh see output/ISO/Linux-i386/250_populate_efibootimg.sh
|
First things first: Later - as needed and as time permits - I would like In particular currently I do not like that |
|
@pcahyna @rear/contributors I would very much appreciate it if you could test it |
|
@pcahyna @rear/contributors Currently those are (hardcoded) all files I wonder if it is more fail-safe to use all |
|
@pcahyna @rear/contributors |
Fixed comment: Improper text from copy&paste
|
@jsmeix thank you, this is a very important change, sorry for being late with review. I will have a look at it tomorrow. |
|
@pcahyna |
|
@jsmeix I am a bit late, but looking now. |
|
@pcahyna I can access Tomorrow I will try to understand it. |
|
Wow - I am so impressed how fast I am :-)) I think I do understand the initial decription of @rmetrich @rmetrich |
|
@pcahyna the crucial point for Secure Boot is that |
|
Regarding the second part of @rmetrich in see my second part about "currently I do not like" in |
|
@pcahyna @rear/contributors |
Add a comment that tell that the SECURE_BOOT_BOOTLOADER reladed code is based on the similar code in output/ISO/Linux-i386/250_populate_efibootimg.sh and use the same code syntax with comment also to skip build_bootx86_efi() when Secure Boot is used.
I have not tried it yet - I merely looked at the code. I can schedule a test on non-secureboot hardware to make sure that the change does not break the case that was working before. I am interested to test with Secure Boot as well, but this will have to wait a bit as I don't have a test environment set up (I will probably be able to do it over the weekend). Regarding versions: Fedora 37 and later probably won't work because of #2971 (same problem with RHEL 9), although I could probably work around this by configuring ReaR to use Secure Boot shim even if the firmware is not actually set up for Secure Boot. |
|
On non-secureboot hardware |
Why is that the case? |
|
Because SECURE_BOOT_BOOTLOADER is nowhere set to a non-empty value. The UEFI_BOOTLOADER autodetection code in Currently 'shim' (ignore case) does only appear in |
|
Right, one has to set |
|
Of course Secure Boot autodetection in ReaR But this is nothing that belongs to this pull request So I think Secure Boot autodetection in ReaR General improvements of UEFI related things in ReaR What I am currently doing here is trying to move By the way: |
|
Now it's weekend time! |
|
@jsmeix maybe you misunderstood what I meant. It is fine at this point that Secure Boot is not autodetected and has to be configured manually (which has been always the case with ISO boot, as far as I understand). What I meant is that if the hardware is not configured for secure booting, configuring Secure Boot in ReaR (by setting I tested this on RHEL 8: my UEFI hardware is not configured for secure booting and ReaR has been booting fine on it from disk (OUTPUT=USB). With your change, I can now set |
|
I see only one minor problem: during boot I get because the menu contains and xzio is apparently not present in our default GRUB image. This does not seem to cause any harm and if I don't press any key, the boot continues in about 10 seconds. I wonder whether the |
|
Regarding future plans: instead of Secure Boot autodetection, I would prefer to use the Secure Boot code path always (even if Secure Boot is not used) and get entirely rid of our own GRUB image generation for the UEFI case ( |
No. I would do what |
|
@pcahyna I think I also experienced the same as you wrote in your Regarding your I think also SUSE always boots via Shim on UEFI systems My current offhanded reasoning: When the EFI binaries of the Linux distribution Another (hopefully reasonable) assumption is that |
|
@pcahyna My "secret final plan" is to have |
|
@rear/contributors |
|
@jsmeix thanks a lot for this improvement, in the meantime I tried it on a Secure Boot enabled hardware with RHEL 8 (it works - both the rescue image an the recovered system) and on Secure Boot disabled (but with configured Secure Boot in ReaR via |
I believe that with Secure Boot, you are not allowed to insmod any GRUB modules, so this should be a reasonable assumption - the GRUB image should be indeed feature complete, avoiding the need for grub2-mkstandalone (it also does not need to have the path to the configuration file hardcoded, unlike on PC BIOS, because EFI passes to GRUB the directory it was loaded from and GRUB locates and loads grub.cfg in the same directory). |
It is not only the recovery (rescue) system (where some deviations may be necessary), it is also the recovered system. In my experience, when recovering without so, GRUB is directly booted, in contrast with the original system, which has (as it uses the shim always) - so the recovered system is different in this respect from the original system. This will be a problem if the user decides to turn Secure Boot on after the system was backed up and recovered.
regarding autodetection, I believe it is needed to examine the current boot entry (BootCurrent in efibootmgr output) during mkrescue and use it to set the variables - something that is AFAIK not being done now. |
|
FYI that's what's inside the system ESP on RHEL: and what's on the ESP of the ReaR bootable disk after your change, when |
Type: Enhancement
Impact: Normal
Reference to related issue (URL):
#3025 (comment)
I tested it same (on same VMs) as I did in
#3025 (comment)
but now with the changes here
Secure Boot with OUTPUT=USB works for me.
In output/USB/Linux-i386/100_create_efiboot.sh
add Secure Boot support for OUTPUT=USB by using
SECURE_BOOT_BOOTLOADER as first stage Secure Boot bootloader BOOTX64.efi
and using grub*.efi as second stage Secure Boot bootloader files
in the same way as already done for OUTPUT=ISO
in output/ISO/Linux-i386/250_populate_efibootimg.sh
see #3025 (comment)
My current implementation here is just a first step.
The whole code looks somewhat convoluted
and needs at least some more generic cleanup
to make it easier to further develop things in this area.