|
| 1 | +--- |
| 2 | +feature: uefi_boot_only |
| 3 | +start-date: 2023-06-16 |
| 4 | +author: Ryan Lahfa |
| 5 | +co-authors: (find a buddy later to help out with the RFC) |
| 6 | +shepherd-team: (names, to be nominated and accepted by RFC steering committee) |
| 7 | +shepherd-leader: (name to be appointed by RFC steering committee) |
| 8 | +related-issues: (will contain links to implementation PRs) |
| 9 | +--- |
| 10 | + |
| 11 | +# Summary |
| 12 | +[summary]: #summary |
| 13 | + |
| 14 | +NixOS should drop support for legacy boot and assumes that |
| 15 | +all systems can be booted off UEFI. |
| 16 | +For legacy boot systems, an UEFI-providing environment bootloader should be used to polyfill |
| 17 | +for UEFI features. |
| 18 | + |
| 19 | +# Motivation |
| 20 | +[motivation]: #motivation |
| 21 | + |
| 22 | +Legacy boot is defined by the BIOS Boot specification, written in 1996: https://www.scs.stanford.edu/nyu/04fa/lab/specsbbs101.pdf. |
| 23 | +Nowadays, computers are defaulting to UEFI more and more for the extended features provided (e.g. SecureBoot, native network boot, etc.). |
| 24 | + |
| 25 | +Nevertheless, many legacy boots machines or machines that does not have support for UEFI are used with NixOS: Single Board Computers for example |
| 26 | +on other architectures. |
| 27 | + |
| 28 | +In nixpkgs, legacy boot forces a dichotomy between `boot.loader.efi` and... two legacy bootloaders: GRUB and a family of UBoot/extlinux-compatible/etc. |
| 29 | + |
| 30 | +In the case of GRUB, there are increasing problems with this bootloader: |
| 31 | + |
| 32 | +- Upstream do not do releases anymore: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/tools/misc/grub/default.nix#L62-L350 |
| 33 | +- Co-maintenance / release work with other ecosystems such as the kernel is simply not done: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/tools/misc/grub/default.nix#L345-L349 causing GRUB's drivers to explode in production for our users: https://github.com/NixOS/nixpkgs/pull/235222 |
| 34 | +- Our own maintenance of GRUB is subpar: https://github.com/NixOS/nixpkgs/pull/227741 https://github.com/NixOS/nixpkgs/pull/226821 https://github.com/NixOS/nixpkgs/pull/195805 https://github.com/NixOS/nixpkgs/pull/95901 https://github.com/NixOS/nixpkgs/pull/236027 |
| 35 | +- GRUB installation procedure uses `install-grub.pl`, one of the remaining Perl script: https://github.com/NixOS/nixpkgs/pull/95901#issuecomment-756702696 offered to rewrite it with sponsoring, but no one took the offer yet, it is also very complicated to integrate with it: https://github.com/nix-community/lanzaboote/pull/96 |
| 36 | +- GRUB installation procedure for UEFI-only is still confusing because our scripts does not handle well UEFI-only (you have to pass `nodev` and this is not very well documented). See https://github.com/NixOS/nixpkgs/issues/222491 |
| 37 | + |
| 38 | +The worse about this, is this is our **default** bootloader for our install images **because** of legacy boot. |
| 39 | + |
| 40 | +In the case of UBoot/extlinux-compatible/etc. : we should definitely keep it as it is used by other ecosystems. |
| 41 | + |
| 42 | +Getting rid of legacy boot opens up the way to get rid of GRUB as a default and enable all our users to benefit from UEFI-in-mind developed abstractions. |
| 43 | + |
| 44 | +BIOS also hold back all improvements in the boot story, considering we are not held back by this, is very interesting for NixOS. |
| 45 | + |
| 46 | +# Detailed design |
| 47 | +[design]: #detailed-design |
| 48 | + |
| 49 | +Legacy boot is booted via UBoot or any bootloader able to provide an UEFI environment. |
| 50 | + |
| 51 | +Then, we boot using any usual bootloader, e.g. systemd-boot. |
| 52 | + |
| 53 | +# Examples and Interactions |
| 54 | +[examples-and-interactions]: #examples-and-interactions |
| 55 | + |
| 56 | +Fedora is considering doing this: https://lists.fedoraproject.org/archives/list/[email protected]/thread/GOETDM5SWINBX5ZDV37SWMHIPRRUVVTT/. |
| 57 | + |
| 58 | +Asahi Linux is booting UEFI via UBoot without EFI variables and it has been great for them. |
| 59 | + |
| 60 | +People who want to boot off strange partitions at boot-time can exploit UEFI drivers capability to load any filesystem driver and |
| 61 | +open the EFI System Partition in ZFS if they really insist. |
| 62 | + |
| 63 | +# Drawbacks |
| 64 | +[drawbacks]: #drawbacks |
| 65 | + |
| 66 | +- 2-stage boot for legacy BIOS systems is more than 1-stage boot |
| 67 | +- Increased internal complexity in the boot story of NixOS |
| 68 | +- Increased load and reliance on UBoot |
| 69 | +- The runtime service `SetVariable` will probably stay highly unstable for a while (variable storage) |
| 70 | + |
| 71 | +# Alternatives |
| 72 | +[alternatives]: #alternatives |
| 73 | + |
| 74 | +- Keeping legacy BIOS and hoping someday it will be a bit more maintained |
| 75 | +- Getting rid of legacy BIOS without other options |
| 76 | + |
| 77 | +Then, if we don't do this, we will continue to have users relying on bootloaders with shady maintenance stories and a skewed perception of what a bootloader can do (e.g. boot on a ZFS partition?). |
| 78 | + |
| 79 | +# Unresolved questions |
| 80 | +[unresolved]: #unresolved-questions |
| 81 | + |
| 82 | +- How to migrate existing installs without any GPT partition table? |
| 83 | +- How to migrate existing installs with a GPT partition table but without a supported EFI System Partition, e.g. LVM |
| 84 | + - NTFS, XFS, exFAT, Amiga FFS/SFS, BFS, UFS, ZFS are handled via https://efi.akeo.ie/ which is an EFI driver that can be loaded |
| 85 | + - Subquestion: how to load EFI drivers for unsupported EFI System Partition? |
| 86 | +- When to do it? |
| 87 | +- What to do about variable storage (Asahi Linux showed this is not that important for a start)? |
| 88 | +- Design architecture in nixpkgs? |
| 89 | + |
| 90 | +# Future work |
| 91 | +[future]: #future-work |
| 92 | + |
| 93 | +- Improved support for UEFI features on non-UEFI native systems |
0 commit comments