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

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?

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