-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Make bootloader updates on UEFI-based systems work #299
base: master
Are you sure you want to change the base?
Conversation
I don't like that I have the bootloader ID hardcoded to |
please don't. we should figure out how to get the debian packages to do the right thing, without grml-debootstrap starting grub commands. |
Which grub command are you referring to? The I think SystemBuildTools are supposed to run that command.
Therefore, I am pretty sure only the system build tool is responsible for setting up the bootloader, which requires running bootloader installation commands. |
The postinst used by grub-efi-amd64 autodetects the bootloader ID from the I'm not quite sure how |
Based on my research, you can only install GRUB on legacy BIOS systems without running grub-install manually if you have grub-pc installed. That isn't possible with this PR since you can't have grub-pc and grub-efi-ARCH co-installed, so my PR will have to leave the grub-install commands that install the legacy BIOS bootloader. However, I think I can get the EFI bootloader to be handled automatically by the Debian package, without having to explicitly call grub-install. So I'll do that. (I should also be looking into how to allow grub-pc and grub-efi-ARCH to be co-installed, but that's a potentially large task that has to be handled in Debian upstream.) |
Alright, this works on my system. I didn't touch the |
Please use, review the following simplification, if sane
|
Avoid repetitive |
@zeha Looking through the code, I can't figure out why |
@adrelanos Some of the installation commands are order-dependent in the code, so I'm a bit leery of changing them. There's only three lines that are really repetitive, and deduplicating them would result in more code than is already there. I think for now leaving them as-is and working with them in a future PR would be a good idea. I looked long and hard at the Also got the simplification @adrelanos recommended integrated. |
So this is the history prior to this pull request: First only grub-pc was supported. Then EFI support was added. Then VMEFI support was added. And finally, ARM64 (EFI only) support was added. This had resulted in a bit of overly complex code with the Now with the latest commit, after this refactoring, it looks much cleaner. |
Ready for review. Could you kindly review please? |
I'll try to take a look later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks promising, i think the efi-id stuff can fully go away though
I added the efi-id stuff because it's necessary for Kicksecure's use case (we can work around it if it doesn't exist, but it's preferable if it does exist). Are there problems with it existing? Would there be a different way of implementing it that would make it acceptable? |
So you're saying your usecase includes setting a different GRUB_DISTRIBUTOR, without setting a different os-release vendor name? |
Indeed it does. |
Uff, that sounds very use case specific and like something that should be handled from within custom hooks/scripts instead? We're trying to strip down on command line options rather than adding further ones. We need to keep grml-debootstrap and its code-base support- and maintainable, which also means that we should focus on having command line options that don't conflict with each other or one needs to figure out with lots of trial-and-error. Common use cases should all work out by default. (We'll try to document and verbalize our plans and vision in #311 BTW.) I didn't manage to go through all the code change yet, but I think one approach to support BIOS/legacy next to EFI systems at the same time is to install We should rework/simplify/unify all the efi + arm related code path, this seems to get more and more complex :) |
Yeah, that's an option. I can remove that bit if it's desirable, and then our custom scripts can work with it. I didn't know about the grub-cloud stuff, I'll take a look at it. |
That might sound like it but it's really not that special. It's just the "simple" use case for a Debian derivative. Changing (For this reason, Qubes also decided not to touch Changing GRUB_DISTRIBUTOR however makes sense to avoid pretending to be Debian, while actually being a derivative, to avoid breaking multi-booting. |
Quote
Quote list of files:
AMD64
Could package
The serial console related issues I've run into ~ 5 years ago when I was also considering "why not enable a serial console by default inside VM images". If going for a package
grub-cloud seems to support only a limited amount of architectures. (Intel/AMD64 and ARM64 at time of writing.) Depending on your plans for multiple architecture support (Debian is the universal operating system), it might be too limited. |
Analysis:
In conclusion,
|
Are you sure? Should be as simple as
Am I missing something? 🤔 |
If you look at Real GRUB
Real GRUB
This means, only if It does a lot of complex stuff. Some examples...
Lots of debconf...
Line 444 to line 711. But all of that happens only if
For package
|
It's worth noting some of the old grub-pc installation code had to do with things like migrating from grub-legacy to grub2, fighting with RAID devices, multi-OS support, Wubi handling (Wubi was an old way of running Ubuntu as a full operating system from a file on a Windows machine), etc., etc. Lots of legacy and edge case handling. A VM doesn't have pretty much any of those edge cases, so a much simpler solution may be perfectly fine there. One thing interesting to note is that the grub-cloud package claims |
@zeha, @mika Is there more that needs done on this? I believe the consensus is that using |
Yes, the The Please also squash your commits/changes once you're done, provide a good and verbose commit message which clarifies the changes and the overall picture, thanks. :) |
Oh and @ArrayBolt3 please be aware that there's also grub magic in |
To be clear, it would be desirable to merge the entirety of the grub configuration/installation block from chroot-script into grml-debootstrap itself, ensuring the |
I think I probably misunderstood the above - the two different grub_install functions in grml-debootstrap and chroot-script are pretty different, and while I'm not scared to merge them, I think that's a substantial enough change it should wait for a future PR. For now I'll make the code in chroot-script also able to install the correct bootloaders, so I don't end up overloading this PR. |
51825d5
to
c407ca7
Compare
Alright, there's the squashed commit. There's one possible problem left here, which is that for some reason when doing an arm64 EFI install onto a physical drive on an amd64 BIOS system, shim isn't installed into the ESP. I don't know why yet. |
c407ca7
to
34b42c1
Compare
Fixed the UEFI bootloader on arm64 physical disk installs, and fixed a couple of other issues too (I had a known-buggy line of code in one spot that needed replaced, and I had a placeholder left around). |
fyi, I believe this is ready for review again, whenever someone wants to take a look at its current state. |
Friendly ping? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
34b42c1
to
5f5f588
Compare
Force-push to rebase changes on tip of |
5f5f588
to
04b3553
Compare
ARM still seems to have problems in CI |
please rebase, the general CI problem should be fixed on master |
04b3553
to
8bc6a8b
Compare
Rebased, also fixed the unneeded !efi_support codepath issue. |
Previously, it was possible to install both BIOS and UEFI bootloaders at the same time when creating VM images with grml-debootstrap. In this setup however, the UEFI bootloader would not be automatically updated, due to the absence of a grub-efi-ARCH package on the installed system. It also was not possible to install both bootloaders using grml-debootstrap on a physical disk, and arm64 VM images could not be built with full UEFI support as enabled by the --vmefi argument (these builds would fail). To rectify these issues: * Use grub-cloud-amd64 to install both BIOS and UEFI bootloaders and manage updates. * Add support for installing BIOS and UEFI bootloaders simultaneously on physical disk installations. * Get rid of the ARM_EFI_TARGET variable and make ARM64 VM builds use VMEFI=1 by default. Fixes grml#297, grml#257
8bc6a8b
to
2891f17
Compare
Image build test results for #299All image builds were done twice, once on a VM using BIOS firmware, and once All of the following options were tested in all possible combinations:
For "image generation", manual image generation is defined as generating a VM arm64 BIOS images were not generated because BIOS firmware is not supported Each image was checked by booting it using QEMU. The script used to automate Note: SummaryAlmost everything seems to be working as expected. Interesting observations were:
Details
|
Would be good to have these tests in the CI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to have @zeha's +2 for this, but basically LGTM. Thx!
Alright, I've now done the last bit of testing I wanted to do, which was make sure grml-debootstrap is able to edit the host's UEFI variables when doing a physical hardware install. I installed Lubuntu into a VM, provided the VM with a secondary blank disk, then installed grml-debootstrap into Lubuntu and used it to deploy Debian to the secondary disk. The Debian installation shows up in the boot menu as expected after installation. |
Fixes #297. Quick summary of changes:
grub-install
calls,--bootloader-id=debian
and--force-extra-removable
are used. This ensures the bootloader is installed both to the distro-specific path (/boot/efi/EFI/debian
) and to the removable media path.--removable
is removed from these calls as it is no longer needed and in fact prevents the normal bootloader location from being installed to. Its job is done by--force-extra-removable
now.--vmefi
is enabled,grub-pc-bin
is installed rather thangrub-pc
, allowing the BIOS bootloader to be installed but not allowing it to be automatically updated. This is to allow installinggrub-efi-ARCH
, which allows automatically updating the EFI bootloader. (Sadly the two cannot be installed at the same time, which is why this change is necessary. If they could be installed at the same time, that would be best, but Debian isn't capable of that at the moment.)grub-efi-ARCH
is installed along withgrub-efi-ARCH-signed
.grub2/force_efi_extra_removable
, is documented at https://wiki.debian.org/UEFI#Force_grub-efi_installation_to_the_removable_media_path.