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

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.

1 Like

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

5 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

1 Like

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?

set textmode=true is what I needed too – otherwise my installer crashed after choosing an option from the menu. Booting in legacy (BIOS) worked too, but I wanted to be using UEFI.

Rather than editing the ISO, I found it super easy to create a custom ISO (Creating a NixOS live CD - NixOS Wiki)

The flake configuration was:

{
  description = "Minimal NixOS installation media";
  inputs = {
    nixos.url = "nixpkgs/23.11";
  };
  outputs = { self, nixos }: {
    nixosConfigurations = {
      iso = nixos.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          "${nixos}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
          ({ pkgs, ... }: {
            environment.systemPackages = [ pkgs.neovim ];
            isoImage.forceTextMode = true;
          })
        ];
      };
    };
  };
}

Built it using:

nix build .#nixosConfigurations.iso.config.system.build.isoImage

Then just use dd or cp to write it to USB.

1 Like

Not all bios’ expose the legacy + UEFI mode option. For example most minisforum devices will not boot any NixOS ISO. I’ve tested, the custom build mentioned above, unstable, 23.11, and 24.05 (official ISOs, Gnome, text and minimal tested and failed).

However, Ubuntu (latest LTS), PopOS! and SUSE (Tumbleweed & Aeon) were able to boot and install fully.

My test machine is the X7 TI which has the latest intel core 9 185H.

I don’t have a way to test why it fails before reaching stage 1.

I have a Minisforum with the same issue, the workaround I used was a stick with Netboot to boot into an NixOS-ISO. Does require a network connection though.

The main concern is that the official iso (even in text mode) is uninstallable. The fact that the netboot option works says perhaps there’s a regression or a bug in the base iso.

Like others have mentioned in the thread (including my own tests on same device), this isn’t a case of hardware incompatibility or old kernel etc.

We are doing something wrong and I don’t know how to debug stage 1/grub etc… If anyone has anything I could try, I’m happy to spend time trying to resolve this before we release 24.11.

Do we want to tell people to try Nixos and then they get stuck at the front door? …not a good show.

@mastoca, I think you’re right, this would be an unfortunate first experience for folks interested in NixOS.

But also, can we back-up and enumerate the issues here?

Particularly, it seems that ISO should be fixed to use uppercase path names: nixos/installer/cd-dvd: use `EFI/BOOT` and `EFI/BOOT/BOOT$ARCH.EFI` for paths by RaitoBezarius · Pull Request #287798 · NixOS/nixpkgs · GitHub

Questions:

  1. Are there still issues booting the ISO due to firmware bugs? I feel like there’s a muddled question in here of BIOSes supporting legacy+UEFI, but that shouldn’t matter. Ideally the ISO is perfectly bootable with a legacy system, UEFI-only system, or one with UEFI+CSM.

  2. Should “we” (someone) send a PR with the gfterm/textmode=true workaround that @21paradox proposed? @21paradox, maybe you’d be willing to open a PR for discussion?

I’m curious if there are remaining issues after that though. And/or if someone with a “bad” device is willing to do investigation or loan the device to someone who can drive this through.

1 Like

That PR was merged, and I suspect the issue it addresses is a common source of the ISO not working right (meaning the firmware is not handling the FAT file system correctly, technically). We should maybe backport the PR to 24.05.

I wonder if it would be better to just nuke the ISO’s grub config and make it work the way grub works on an actual system. The amount of bespoke nonsense in the ISO’s grub setup is crazy.

i can reproduce this issue in my pc. also i will make a pull request later, i try not to force enableing textmode

I’m also not super clear on some of this grub stuff; is loadfont really a good test for whether gfxterm is going to work?

i have no other ways yet, this check method is borrowed from clonezilla/sbin/ocs-live-boot-menu at e74279b16b78013c087045ad5527e4159969e75e · stevenshiau/clonezilla · GitHub