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

22 Support shim fallback bootchain #106

Open
wants to merge 11 commits into
base: 22
Choose a base branch
from
16 changes: 13 additions & 3 deletions gadget/gadget-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,22 @@ volumes:
type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
size: 1200M
update:
edition: 2
edition: 3
olivercalder marked this conversation as resolved.
Show resolved Hide resolved
content:
- source: grubx64.efi
target: EFI/boot/grubx64.efi
target: EFI/BOOT/grubx64.efi
Copy link
Collaborator

@valentindavid valentindavid Sep 25, 2023

Choose a reason for hiding this comment

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

This is right.

I was a bit confused on why we still need this. But shim is configured to boot \grubx64.efi (DEFAULT_LOADER). And generate_path_from_image_path from shim considers paths that do not start with \EFI\ to be relative.

I wonder if it would be better to sort these content entries by target directory. So it is easier to see what goes in EFI\BOOT and what goes in EFI\ubuntu.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, good to know. I totally agree about sorting, I'll fix that in a moment.

Copy link
Member Author

Choose a reason for hiding this comment

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

@alfonsosanchezbeato do you think grub${arch}.efi is required in EFI/BOOT/ because of this?

Choose a reason for hiding this comment

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

Afaict if the fallback binary is in EFI\boot, it will get run instead of grub, and even if it does not find any CSV file, grub*.efi will not be invoked, so I don't see it necessary. @valentindavid please correct if I am getting something wrong here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right. This is how it seems documented.

- source: grubx64.efi
target: EFI/ubuntu/grubx64.efi
- source: shim.efi.signed
target: EFI/BOOT/BOOTX64.efi
- source: fbx64.efi
target: EFI/BOOT/fbx64.efi
- source: mmx64.efi
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the mok manager should also go in EFI\ubuntu.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. I don't really know what the mok manager is used for, and there was some consternation about adding it in the past: #56 (comment)

It's not one of the boot assets added by the snapd PR #13205 (https://github.com/snapcore/snapd/pull/13205/files#diff-dca334c34d6acf0ce9fb49a95fb836caafe064f7fd2eda43a2185d6d9c7e20e5R464-R476), so I'm not sure if it's something we actually need to add.

What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would love to have it. The mok keys can be used to sign your own kernels. But it can also be used by anything that uses the secondary trusted keyring in the kernel: kernel modules, signed dm-verity, etc.

Also there is no security argument here, because there is a signed efi that anyone can install manually. We are just making it more annoying to install it for legitimate users.

If it causes some issues and would delay this PR, you do not have to add it.

But for sure, if we add it in EFI\BOOT, it should also go in EFI\ubuntu. It feels very weird to have it in only one. That would be, you can install machine owner keys, but only if in the bios, you force to boot the default efi bootloader (EFI\BOOT\bootx64.efi) instead of the configured BootOrder.

To sum up. Either add EFI\ubuntu\mmx64.efi or remove EFI\BOOT\mmx64.efi.

Copy link
Member

Choose a reason for hiding this comment

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

Probably we can live with MokManager only in EFI\ubuntu, as we have seen that grub will not ever run from EFI\boot if we have fbx64.efi. As MM is called either when shim tries to run grub but it has not a valid signature or when the OS modifies EFI variables related to the MoK - and the OS is expected to have been started by grub in EFI\ubuntu.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. I've removed it now, thanks!

target: EFI/BOOT/mmx64.efi
- source: BOOTX64.CSV
target: EFI/ubuntu/BOOTX64.CSV
- source: shim.efi.signed
target: EFI/boot/bootx64.efi
target: EFI/ubuntu/shimx64.efi
- name: ubuntu-boot
role: system-boot
filesystem: ext4
Expand Down
16 changes: 13 additions & 3 deletions gadget/gadget-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ volumes:
type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
size: 1200M
update:
edition: 2
edition: 3
content:
- source: grubaa64.efi
target: EFI/boot/grubaa64.efi
target: EFI/BOOT/grubaa64.efi
- source: grubaa64.efi
target: EFI/ubuntu/grubaa64.efi
- source: shim.efi.signed
target: EFI/BOOT/BOOTAA64.efi
- source: fbaa64.efi
target: EFI/BOOT/fbaa64.efi
- source: mmaa64.efi
target: EFI/BOOT/mmaa64.efi
- source: BOOTAA64.CSV
target: EFI/ubuntu/BOOTAA64.CSV
- source: shim.efi.signed
target: EFI/boot/bootaa64.efi
target: EFI/ubuntu/shimaa64.efi
- name: ubuntu-boot
role: system-boot
filesystem: ext4
Expand Down