nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

nixos/limine: Failed to install bootloader

Open gg-plato opened this issue 9 months ago • 22 comments

Nixpkgs version

  • Unstable (26.05)

Describe the bug

Limine bootloader instalation failed.

Steps to reproduce

Trying to install limine of an ASUS Dash F15 laptop, I use the same limine configuration on a thinkpad and it works perfectly. Right now its using systemd-boot, I added limine configurations and tried to rebuild with sudo nixos-rebuild boot --flake .#PC but the bootloader installation failed. Trying with --install-bootloader option has the same result.

Expected behaviour

Set up Limine bootloader

Screenshots

No response

Relevant log output

Traceback (most recent call last):
  File "/nix/store/z44z6pvwglx78m781vc302q4dn8fkd80-limine-install.py", line 676, in <module>
    main()
    ~~^^
  File "/nix/store/z44z6pvwglx78m781vc302q4dn8fkd80-limine-install.py", line 665, in main
    install_bootloader()
    ~~~~^^
  File "/nix/store/z44z6pvwglx78m781vc302q4dn8fkd80-limine-install.py", line 619, in install_bootloader
    efibootmgr_output = subprocess.check_output([
        efibootmgr,
    ...<4 lines>...
        '-L', 'Limine',
    ], stderr=subprocess.STDOUT, universal_newlines=True)
  File "/nix/store/jngi3b58h7iw727mrk42pnfbg6gv5r7m-python3-3.13.11-env/lib/python3.13/subprocess.py", line 472, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "/nix/store/jngi3b58h7iw727mrk42pnfbg6gv5r7m-python3-3.13.11-env/lib/python3.13/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/nix/store/c41lpawhs65ny7lr7xy9v2sv6zf4lfxb-efibootmgr-18/bin/efibootmgr', '-c', '-d', '/dev/nvme0n1', '-p', '1', '-l', '\efi\limine\BOOTX64.EFI', '-L', 'Limine']' returned non-zero exit status 5.
Failed to install bootloader
Command 'systemd-run -E LOCALE_ARCHIVE -E NIXOS_INSTALL_BOOTLOADER -E NIXOS_NO_CHECK --collect --no-ask-password --pipe --quiet --service-type=exec --unit=nixos-rebuild-switch-to-configuration /nix/store/qs64f8pwil55i174w70nd528shf754z2-nixos-system-dash-26.05.20260217.0182a36/bin/switch-to-configuration boot' returned non-zero exit status 1.

Additional context

Here is the exact configurations used:

 limine = {
        enable = true;
        maxGenerations = 3;
        style = {
          wallpapers = [
            "${pkgs.cosmic-wallpapers}/share/backgrounds/cosmic/phytoplankton_bloom_nasa_oli2_20240121.jpg"
          ];
          graphicalTerminal.margin = 0;
          graphicalTerminal.background = "80000000";
        };
      };

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.18.12, NixOS, 26.05 (Yarara), 26.05.20260217.0182a36
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.31.3
  • nixpkgs: /nix/store/dx2qikyb4dyb6hbdfywbmsyla0z5a1h3-source

Notify maintainers

@JohnRTitor @lzcunt @Prince213 @programmerlexi @ryand56


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a :+1: reaction to issues you find important.

gg-plato avatar Feb 22 '26 12:02 gg-plato

Is this a UEFI system (seems like it)? If yes, please check that /sys/firmware/efi/efivars is present.

programmerlexi avatar Feb 22 '26 13:02 programmerlexi

Hello, efivars is present, its an UEFI system.

gg-plato avatar Feb 22 '26 14:02 gg-plato

Is there any additional log output?

programmerlexi avatar Feb 22 '26 14:02 programmerlexi

That's the full log from what I can see.

gg-plato avatar Feb 22 '26 14:02 gg-plato

Looks like it's caused by: https://github.com/rhboot/efibootmgr/blob/c3f9f0534e32158f62c43564036878b93b9e0fd6/src/efibootmgr.c#L1888-L1893

Prince213 avatar Feb 23 '26 04:02 Prince213

@gg-plato Can you run the command directly and paste its output?

/nix/store/c41lpawhs65ny7lr7xy9v2sv6zf4lfxb-efibootmgr-18/bin/efibootmgr -c -d /dev/nvme0n1 -p 1 -l \efi\limine\BOOTX64.EFI -L Limine

Prince213 avatar Feb 23 '26 04:02 Prince213

i'm having the same issue. here's the output i see when running a similar command.

sudo efibootmgr -c -b 0003 -d /dev/nvme0n1 -p 1 -l \\efi\\limine\\BOOTX64.EFI -L Limine -o 0003,0002,00
00,2001,3002,3003,2002,2004
efibootmgr: ** Warning ** : Boot0003 has same label Limine
efibootmgr: Cannot create Boot0003: already exists.

compguy284 avatar Feb 27 '26 06:02 compguy284

Hi @compguy284 can you paste the python stack trace?

Looks like the script failed to detect existing Limine entry.

Prince213 avatar Feb 27 '26 06:02 Prince213

warning: Git tree '/home/mcguyver/src/nix-config' is dirty
Checking switch inhibitors... done
cleaning /boot/limine/xen
Traceback (most recent call last):
  File "/nix/store/l1237zl6ncrd2vgq2jarr1y1aylfb5a6-limine-install.py", line 676, in <module>
    main()
    ~~~~^^
  File "/nix/store/l1237zl6ncrd2vgq2jarr1y1aylfb5a6-limine-install.py", line 665, in main
    install_bootloader()
    ~~~~~~~~~~~~~~~~~~^^
  File "/nix/store/l1237zl6ncrd2vgq2jarr1y1aylfb5a6-limine-install.py", line 608, in install_bootloader
    efibootmgr_output = subprocess.check_output([
        efibootmgr,
    ...<6 lines>...
        '-o', boot_order,
    ], stderr=subprocess.STDOUT, universal_newlines=True)
  File "/nix/store/jngi3b58h7iw727mrk42pnfbg6gv5r7m-python3-3.13.11-env/lib/python3.13/subprocess.py", line 472, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "/nix/store/jngi3b58h7iw727mrk42pnfbg6gv5r7m-python3-3.13.11-env/lib/python3.13/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/nix/store/c41lpawhs65ny7lr7xy9v2sv6zf4lfxb-efibootmgr-18/bin/efibootmgr', '-c', '-b', '0003', '-d', '/dev/nvme0n1', '-p', '1', '-l', '\\efi\\limine\\BOOTX64.EFI', '-L', 'Limine', '-o', '0003,0002,0000,2001,3002,3003,2002,2004']' returned non-zero exit status 8.
Failed to install bootloader

compguy284 avatar Feb 27 '26 07:02 compguy284

Hi @compguy284 looks like in your case the script failed to detect an existing entry. Please open a new issue instead.

Prince213 avatar Feb 27 '26 09:02 Prince213

I will have to test if i can reproduce this.

@Prince213 have you managed to reproduce the issue?

programmerlexi avatar Feb 27 '26 11:02 programmerlexi

Haven't got time to do that yet, but maybe @gg-plato or @compguy284 could do some bisecting and find when it broke?

Prince213 avatar Feb 27 '26 11:02 Prince213

@compguy284 can you please run the following commands and paste the output here (if any).

sudo efibootmgr -b 0003 -B
sudo efibootmgr -c -b 0003 -d /dev/nvme0n1 -p 1 -l \\efi\\limine\\BOOTX64.EFI -L Limine -o 0003,0002,0000,2001,3002,3003,2002,2004

This imitates the behavior of the script in full and will likely display a different error.

programmerlexi avatar Feb 27 '26 12:02 programmerlexi

I am unable to reproduce the issue on my machine ("it works on my machine" - every programmer ever).

@Prince213 i noticed we can replace the efi entry in 1 command instead of 2 by adding -B to the creation command and removing the deletion command.

programmerlexi avatar Feb 27 '26 13:02 programmerlexi

sudo efibootmgr -b 0003 -B
BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 0002,0000,2001,3002,3003,2002,2004
Boot0000* Linux Boot Manager	HD(1,GPT,dc2cc811-8042-4e4a-bc20-296a21ccde39,0x800,0x100000)/\EFI\systemd\systemd-bootx64.efi
Boot0001* USB Hard Drive (UEFI) - Generic-SD Card (Generic-SD Card)	UsbWwid(bda,306,0,20120901030)/HD(2,MBR,0x22b3dfbb,0x76e5000,0x10000)RC
Boot0002  Windows Boot Manager	HD(1,GPT,dc2cc811-8042-4e4a-bc20-296a21ccde39,0x800,0x100000)/\EFI\Microsoft\Boot\bootmgfw.efi57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000000000100000010000000040000007fff0400
Boot2001* EFI USB Device	RC
Boot3002* Internal Hard Disk or Solid State Disk	RC
Boot3003* Internal Hard Disk or Solid State Disk	RC
sudo efibootmgr -c -b 0003 -d /dev/nvme0n1 -p 1 -l \\efi\\limine\\BOOTX64.EFI -L Limine -o 0003,0002,0000,2001,3002,3003,2002,2004
Invalid BootOrder order entry value0003,0002,0000,2001,3002,3003,2002
                                                                   ^
efibootmgr: entry 2002 does not exist
efibootmgr
BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 0003,0002,0000,2001,3002,3003,2002,2004
Boot0000* Linux Boot Manager	HD(1,GPT,dc2cc811-8042-4e4a-bc20-296a21ccde39,0x800,0x100000)/\EFI\systemd\systemd-bootx64.efi
Boot0001* USB Hard Drive (UEFI) - Generic-SD Card (Generic-SD Card)	UsbWwid(bda,306,0,20120901030)/HD(2,MBR,0x22b3dfbb,0x76e5000,0x10000)RC
Boot0002  Windows Boot Manager	HD(1,GPT,dc2cc811-8042-4e4a-bc20-296a21ccde39,0x800,0x100000)/\EFI\Microsoft\Boot\bootmgfw.efi57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000000000100000010000000040000007fff0400
Boot0003* Limine	HD(1,GPT,dc2cc811-8042-4e4a-bc20-296a21ccde39,0x800,0x100000)/\efi\limine\BOOTX64.EFI
Boot2001* EFI USB Device	RC
Boot3002* Internal Hard Disk or Solid State Disk	RC
Boot3003* Internal Hard Disk or Solid State Disk	RC

compguy284 avatar Feb 27 '26 14:02 compguy284

@compguy284 you seem to have a non existent entry in your boot order causing efibootmgr to fail successfully. So Limine still gets added but the script fails try re-running both commands but remove 2002 from the boot order.

@gg-plato i have a feeling you have a similar issue.

programmerlexi avatar Feb 27 '26 15:02 programmerlexi

there were other entries in the boot order that were not in the Boot list. removing those entries from the command does work. adding -B to the command does work.

sudo efibootmgr -c -b 0003 -B -d /dev/nvme0n1 -p 1 -l \\efi\\limine\\BOOTX64.EFI -L Limine -o 0003,0002,0000,2001,3002
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0003,0002,0000,2001,3002
Boot0000* Linux Boot Manager	HD(1,GPT,dc2cc811-8042-4e4a-bc20-296a21ccde39,0x800,0x100000)/\EFI\systemd\systemd-bootx64.efi
Boot0002  Windows Boot Manager	HD(1,GPT,dc2cc811-8042-4e4a-bc20-296a21ccde39,0x800,0x100000)/\EFI\Microsoft\Boot\bootmgfw.efi57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000000000100000010000000040000007fff0400
Boot2001* EFI USB Device	RC
Boot3002* Internal Hard Disk or Solid State Disk	RC
Boot0003* Limine	HD(1,GPT,dc2cc811-8042-4e4a-bc20-296a21ccde39,0x800,0x100000)/\efi\limine\BOOTX64.EFI

compguy284 avatar Feb 27 '26 15:02 compguy284

I just found out the my bios adds items to the BootOrder without adding a Boot entry.

compguy284 avatar Feb 28 '26 06:02 compguy284

@gg-plato Can you run the command directly and paste its output?

/nix/store/c41lpawhs65ny7lr7xy9v2sv6zf4lfxb-efibootmgr-18/bin/efibootmgr -c -d /dev/nvme0n1 -p 1 -l \efi\limine\BOOTX64.EFI -L Limine

Well, it's my friends PC, so I had to wait till he had time to look at this, sorry for the delay:

sudo /nix/store/c41lpawhs65ny7lr7xy9v2sv6zf4lfxb-efibootmgr-18/bin/efibootmgr -c -d /dev/nvme0n1 -p 1 -l \efi\limine\BOOTX64.EFI -L Limine
Could not prepare Boot variable: No space left on device
sudo /nix/store/c41lpawhs65ny7lr7xy9v2sv6zf4lfxb-efibootmgr-18/bin/efibootmgr
[sudo: authenticate] Password:
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0003,0000,0001,0002,0004
Boot0000* Windows Boot Manager  VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000063000100000010000000040000007fff0400
Boot0001* UEFI:CD/DVD Drive     BBS(129,,0x0)
Boot0002* UEFI:Removable Device BBS(130,,0x0)
Boot0003* UEFI OS       HD(1,GPT,9d45a1bc-636a-429c-953e-f9d28b76d498,0x1000,0x200000)/\EFI\BOOT\BOOTX64.EFI0000424f
Boot0004* UEFI:Network Device   BBS(131,,0x0)

I tried sudo /nix/store/c41lpawhs65ny7lr7xy9v2sv6zf4lfxb-efibootmgr-18/bin/efibootmgr -b 0000 -B to delete an old entry and got the same error, no space left on the device.

gg-plato avatar Mar 01 '26 21:03 gg-plato

Would be quite good to know which device is out of space. Due to working with efi variables, i am guessing the efi nvram is out of space, i which case we cannot help you.

I recommend running df, if anything shows 100% in the Use% column, that is likely the cause. If the causing device has efivarfs as the filesystem, your out of space in the efivars. If the device is one of the partitions of the installation (/, /nix, /home, etc.), i recommend freeing some space and trying again.

Either way this in not a bug in the limine module, i can't help you more than this as i never ran out of space in my efivars before. Installing limine as removable could be an option, but that might be annoying to use when dual-booting.

programmerlexi avatar Mar 03 '26 15:03 programmerlexi