-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
nixos/iso-image: extract GRUB EFI boot logic and offer systemd-boot as an alternative #246441
base: master
Are you sure you want to change the base?
Conversation
We do this to prepare eviction of GRUB from the ISO image.
No guarantee on the fancy stuff: ordering, titles, etc. Adopt this PR if you like it.
As I commented on #245915, this makes UEFI bootable for me. I can't boot the latest nixos-unstable minimal ISO (https://releases.nixos.org/nixos/unstable/nixos-23.11pre509514.9e1960bc196b/nixos-minimal-23.11pre509514.9e1960bc196b-x86_64-linux.iso) on VMware Workstation with UEFI, which has been an ongoing issue for roughly a month or so. The ISO @RaitoBezarius built from this PR (https://files.lahfa.xyz/nixos/nixos-minimal-23.11pre130979.gfedcba-x86_64-linux.iso) works, so nice job. I'd love to see this merged as soon as possible because of the impact of this bug. I'm not a nixpkgs maintainer, but if there's anything that I can do to help make it happen please ping me. |
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.
Very cool!
let | ||
efiArch = pkgs.stdenv.hostPlatform.efiArch; | ||
|
||
mkLoaderEntry = { title, version, linux ? null, initrd ? null, options ? null }@attrs: |
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.
This would be a lovely addition to pkgs/build-support/trivial-builders/
# Round up to the nearest multiple of 1MB, for more deterministic du output | ||
usage_size=$(( $(du -s --block-size=1M --apparent-size . | tr -cd '[:digit:]') * 1024 * 1024 )) | ||
# Make the image 110% as big as the files need to make up for FAT overhead | ||
image_size=$(( ($usage_size * 110) / 100 )) | ||
# Make the image fit blocks of 1M | ||
block_size=$((1024*1024)) | ||
image_size=$(( ($image_size / $block_size + 1) * $block_size )) | ||
echo "Usage size: $usage_size" | ||
echo "Image size: $image_size" | ||
truncate --size=$image_size "$out" | ||
mkfs.vfat --invariant -i 12345678 -n EFIBOOT "$out" |
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.
As you mention, it would be nice to factor this into a reusable function. https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/sd-card/sd-image.nix does something very similar. It could also be used here.
Good news for the test.
It will take some time because I will not be able to work further on that PR as I have more urgency, this was more a Proof of Concept on how to get systemd-boot in our ISO image and can serve as a debug ISO for a lot of folks out there. Anyone is free to take over this PR and bring it to achieve by ticking all the remaining TODO and working with the reviewers (which I can provide too.) Otherwise, I will go back to it in ~2-3 weeks. |
@RaitoBezarius Totally understandable! I'm not quite ambitious enough to finish up this PR at the moment, but I'm happy to assist with testing, brainstorming, or anything else along those lines when you get back to it. |
Hi, I'm encountering this issue #245915 and I've tried to fix it with this PR and now I'm able to boot, however it gives me getting following [1] error on startup (in both qemu and actual machine booted from usb). The config I'm trying to build is basically a copy of drduh/YubiKey-Guide#nixos adapted for flakes and could be found in this gist and it is using this branch with this PR merged into it. I'm out of my depth here and would appreciate any pointers, thanks in advance. |
I'm experiencing the same issue as anpin, as the init gets stuck on failing to process stage 1. |
Based on what I read, I can imagine that the nixos-generators module for ISO is overriding this one module, unfortunately, you are composing things which were not built to be composable. I believe that #249218 PR is better suited for this usecase. I will build an ISO there and post it for people to test if needed. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/pi4-broken-on-23-11-uefi-zfs-root/36375/4 |
Description of changes
We do this to prepare eviction of GRUB from the ISO image and show we can have systemd-boot.
Please adopt this PR and take over it if you want it faster.
TODO:
efi.img
somewhereUtility to test:
Obligatory: https://www.youtube.com/watch?v=NyP49XSA50g for those who knows.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)