Nix iso unable to boot in UEFI mode (but other distros can)

Since it sounds like the problem is in the GRUB boot menu, if you want to give it another try before you sell the board, you could try creating a custom live image that used systemd-boot instead of GRUB. (boot.loader.systemd-boot.enable = true;) But most other distros use GRUB as well, so even if that worked it wouldn’t explain why other distros worked for you but NixOS didn’t. :frowning:

2 Likes

I just tried that (amazing how easy it is to build a custom ISO), same problem. However the boot screen looks absolutely identical. Is that one line enought to switch to systemd-boot?

1 Like

boot.loader.systemd-boot.enable = true; for ISO won’t do anything. You can try doing this instead: NixOS 23.11 manual | Nix & NixOS
Use any working Linux LiveCD ISO and after installing nixos-install-tools follow the usual installation process.
systemd-boot is used by default for UEFI installation, so if the issue is really with GRUB, it should work out-of-the-box

2 Likes

excuse me if it’s a dumb question but, do you have enable safe boot? (It’s also called secure boot in some bios)

Secure boot should refuse to even bring up the graphical menu, since that is part of the un-signed binary.

1 Like

I assume that my board does not even support secure boot. It has no options whatsoever inside the UEFI that would allow me to enable/disable secure boot. I searched the manual very thoroughly because I also assumed the issues could be caused by secure boot, however I could not find anything.

Hi,

I have the exact same problem with a Zimaboard and NixOS 22.11 USB key. The key works well on other computers, just on that one any option I select in the “NixOS boot selection” after the BIOS boot device selection prompt, immediately brings me back to the BIOS boot device selection prompt. I wasn’t able to figure out a way to extract an error message. I’ve tried changing a few options in the BIOS, but no luck. I’ve tried NixOS unstable, same.

A USB key with Debian or Arch Linux works just fine on the same miniPC. Did you manage to work around the problem in that thread?

Thanks,

Replying to myself.

Here is what I did to workaround the issue:

  1. Boot into Debian using their USB installer
  2. Install Nix in Debian sh <(curl -L https://nixos.org/nix/install) --daemon
  3. From there, build a NixOS to kexec (see documentation NixOS 23.11 manual | Nix & NixOS): nix-build -A kexec.x86_64-linux '<nixpkgs/nixos/release.nix>'
  4. apt install kexec-tools
  5. cd result && ./kexec-boot

Have just been through this issue with identical behaviour as described in OP.

What solved the issue for me (believe it or not) is booting the media from the BIOS boot selection menu.

So, if the NixOS install media is the default boot device - freezes at menu as described.
If the NixOS install media is manually selected after invoking the BIOS boot menu - works as intended.

Motherboard in question is a Chinese “X99” board with 6 core Xeon.

1 Like

Can we open an issue in nixpkgs to collect the exact hardware that does not work with our UEFI ISO?

1 Like

I realize this is a very old thread but I report the same behavior with 23.05 on a device I have (a GPD Win 3 handheld gaming computer). I second the call to develop some sort of automated testing for this.

I’m no longer in a position to test it but at one point I had a Windows installation on the internal drive, and the behavior I saw at that time was consistent with @ahen’s report about manual selection vs. default boot device. I actually managed to get into the installer once when I had it in that state, but, alas, did not succeed in completing the install.

I’m going to play around some more and report back.

for anyone else coming across this thread

I’ve been made aware of nixos/iso-image: Tear down GOP and rely on console for Linux boot · NixOS/nixpkgs@07fb2f4 · GitHub which apparently addresses this issue on the Steam Deck and possibly on other hardware. I haven’t yet tested it on my device, since the workaround of booting into Debian and kexec’ing worked for me.

Hey All,

Has anyone found a solution to this issue? I have a GPD Win 2 which is doing exactly this.

I can boot every other ISO I have tried with no issues and have tried both under Ventoy and by DDing the image to a USB drive.

I can boot using the Kexec method and will likely go this route once I add wifi to the config but it would be really nice to be able to use the normal method.

Thanks!

I found the cause of this issue

The NixOS ISO uses lower case filenames for the bootx64.efi file and the EFI/BOOT directories

I had a look at the UEFI standard and it mentions that “FAT 8.3 file names are always stored as uppercase ASCII characters” so I think some computer BIOS’s assume these files will be uppercase while others ensure they work regardless. The standard also mentions that the filesystem is case-sensitive.

I edited the ISO and changed the filenames and directory names then edited the grub.cfg files (there is one in /BOOT/GRUB which loops back) and it now works in GRUB2 mode.

Now the installer freezes at " starting systemd-udevd version…" but that is another story (assuming it isn’t caused by my tweaking the ISO)

I am going to head over to the NixOS git to see if I can file something to highlight this issue

3 Likes

I’m having the same issue. Already tried older ISOs like 23.05 and 22.11, and even 24.05pre, without any difference.
After the last post by canguy247 (#23) I tried making the following changes in the 23.11 ISO:

  • rename /EFI/boot as /EFI/BOOT
  • rename /EFI/BOOT/bootx64.efi as /EFI/BOOT/BOOTX64.efi
  • change any reference to this file/folder inside /EFI/BOOT/grub.cfg and inside /boot/grub/loopback.cfg

This helped booting the ISO, but got stuck after the grub menu with the following error (after starting systemd-udev):
An error occurred in stage 1 of the boot process, which must mount the filesystem on '/mnt-root' and then start stage 2.

Any possible fix to this issue? Even if it needs to manually edit the ISO

Thank you for your reports, it’s critical though that you open issues in GitHub and mention maintainers, otherwise there’s no chance to get your issue fixed as we have no way to have eyes everywhere and track everything. :slight_smile:

I opened nixos/installer/cd-dvd: use `EFI/BOOT` and `EFI/BOOT/BOOT$ARCH.EFI` for paths by RaitoBezarius · Pull Request #287798 · NixOS/nixpkgs · GitHub to see if we can address this simply.

2 Likes

I’m just starting out with nixos, yesterday I didn’t open an issue because I wanted to do some more tests first, and then go and study how the ISO is built. And only then open an issue and/or a PR with the solution (in case I had found one).

Thank you for proposing a solution, I hope it will be accepted soon

same problem, black screen after “hit enter on any selection of nixos install items”.
after some debugging, i have found insmod gfxterm this code in /EFI/boot/grub is not support in my system. Maybe becase i use a very ancient graphic card (gt405 no uefi bios).
compare to the grub file in clonezilla.iso. Add a font detection around insmod gfxterm will bypass this error .like below,

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
   font=($root)/EFI/boot/unicode.pf2
fi
if loadfont $font; then
  insmod gfxterm // original code
else
  set textmode=true
fi

The easy way i solve it:

  1. using rufus to write iso into usb flash drive(iso mode). (dont’ use ventoy, mount /mnt/root err)
  2. editing /EFI/boot/grub,and change this firstline to set textmode=true

This solved it for me, alongside booting in legacy + UEFI mode

Is there a nixpkgs issue or PR for this?