If you want to boot your system with SecureBoot there are three main possibilities under Linux:
1. You use the SHIM, which already has a Microsoft signature. To my knowledge Ubuntu uses this way. The SHIM itself then loads the GRUB. Here I can't help you, because this was never an option for me (because then still "foreign" keys are used).
2. You work with MOK (machine owner keys). Here I can't help you, because this was never an option for me (because then still "foreign" keys are used).
3. You do EVERYTHING manually yourself. For this you need your own keys. You have to give these to your UEFI. Since there are motherboards that cause problems when using "efi-updatevar" (or "sbkeysync"), I recommend to take over the keys yourselv in the BIOS (beware you must reboot your machine twice).
As @szatox already wrote correctly, signing a bootloader is not very useful. That is why the UKI (unified kernel image) was "invented".
I don't know Ubuntu and can't help you there. I strongly suspect that re-signing the SHIM will not work (since it already has a Microsoft signature). Maybe this helps you:
https://wiki.ubuntu.com/UEFI/SecureBoot
https://wiki.ubuntu.com/UEFI/SecureBoot/Testing
My installation looks like this:
- Before the switch to SecureBoot -
1. I use "gentoo-sources" and configured my kernel myself.
2. I configured everything I need statically <*> in the kernel and then turned off the module support. With this I have a monolithic kernel. (But this is not a requirement for SecureBoot).
3a. I configured this kernel as a STUB kernel (so it will boot directly).
3b. This also requires configuring the kernel command line parameters INTO the kernel.
4a. One of my boxes does not have an initramfs.
4b. The other box has the initramfs EMBEDDED into the kernel.
I used:
https://wiki.gentoo.org/wiki/User:Pieti ... _file-list
If you have already a CPIO and want embed it, then you can use:
https://wiki.gentoo.org/wiki/User:Pieti ... IO_archive
5. UEFI boots directly this (UKI) kernel. For this I created a UEFI entry with "efibootmgr"
Code: Select all
$ efibootmgr
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0002,0001
Boot0000* Secure HD(1,GPT,0adcbfee-21aa-42ea-9a9a-2e53bd05e6a2,0x800,0x7f800)/File(\efi\secure\bzImage.efi)
Boot0001* gentoo HD(1,GPT,0adcbfee-21aa-42ea-9a9a-2e53bd05e6a2,0x800,0x7f800)/File(\EFI\gentoo\grubx64.efi)
Boot0002* Unlocked HD(1,GPT,0adcbfee-21aa-42ea-9a9a-2e53bd05e6a2,0x800,0x7f800)/File(\efi\unlocked\bzImage.efi)
- Switching to SecureBoot -
1. I have created my own keys.
2. I signed the existing kernel with it (overwriting the non-signed kernel).
3. I saved the existing keys of the UEFI for safety. (Not absolutely necessary).
4. I have directly in the BIOS, deleted the existing keys and taken my own (you must reboot twice).
I have described the whole thing here:
viewtopic-p-8492354.html#8492354
If you want go this way, I think you must make an own UEFI entry (with "efibootmgr -c ...") for your GRUB (
https://wiki.gentoo.org/wiki/Efibootmgr ). Check if you can boot this grub WITHOUT SecureBoot. Then sign your grub. And maybe best: Add the Keys directly in BIOS (= not using "sbkeysync"). ... Again ... Signing a boot loader is not very useful ...