Install fails due to `boot.loader.grub.devices` not being set
error:
… while calling the 'head' builtin
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1:35741:
… while evaluating the attribute 'value'
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:33591:
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error:
Failed assertions:
- You must set the option ‘boot.loader.grub.devices’ or 'boot.loader.grub.mirroredBoots' to make the system bootable.
Traceback (most recent call last):
File "/nix/store/fbw4jfvd4n37hk0hi3kw67arrr2zhmwc-nixos-up.py", line 305, in <module>
run(["nixos-install", "--no-root-passwd"])
File "/nix/store/fbw4jfvd4n37hk0hi3kw67arrr2zhmwc-nixos-up.py", line 123, in run
subprocess.run(args, check=True)
File "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/lib/python3.12/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nixos-install', '--no-root-passwd']' returned non-zero exit status 1.
had to modify /mnt/etc/nixos/configuration.nix and uncomment the device. i guess this has changed since this was released.
Hmm, yeah I guess the upstream install process has changed. Would it be possible to generalize your solution to a PR? :P
Hmm, yeah I guess the upstream install process has changed. Would it be possible to generalize your solution to a PR? :P
personally im not sure, just started with nixos but looking at line 239 it seems boot.loader.grub.version = 2; no longer is generated by the script so it never adds the device line.
Looks like this commit from a few years back removed it.
i guess most are booting with EFI so it hasnt been noticed? i wasnt as i just created a vm in proxmox quickly so i could nixos-anywhere a low end vps that couldnt build itself.
so maybe it could either match boot.loader.grub.enable = true; or # Use the GRUB 2 boot loader. instead.
I was running this script on KVM to test Nix and found this issue. I fixed it by updating the GRUB configuration to set boot.loader.grub.device for non-EFI systems, matching against boot.loader.grub.enable or the GRUB comment. I also fixed a conflict between pulseaudio and pipewire by disabling pulseaudio and enabling PipeWire with ALSA and pulse support. It's all working (by now) xD https://github.com/samuela/nixos-up/pull/24
Should be closed by #24 -- s/o to @bronzetuxie !