Recently, I noticed that my new generations are not being added to the Grub menu. I have been using my NixOS system (with Windows in dual boot) for about 2 years now without facing this issue.
Issue:
Running the command:
$ sudo nixos-rebuild switch --flake .
I am getting the following message in the output:
warning: Git tree '/home/abdulla/.dotfiles' is dirty
updating GRUB 2 menu...
/nix/store/m101dg80ngyjdb02g6jwy80sr7kzj26g-bash-5.2p26/bin/bash: line 1: /etc/grub.d/30_os-prober: No such file or directory
(note: I believe Git isn’t causing this issue but just leaving that message here just in case other’s think it could be the cause of the mess up.)
Relevant post/reading:
I have seen relevant post here and they mentioned that /boot
is not mounted as one expects. Though I am unsure how to change that to the proper one?
I have also looked at Reinstalling the Bootloader command in bootloader wiki in NixOS that supposedly fixes all bootloader issues, but running the command isn’t working for me. The command (note: I have pasted the error of this command at the end):
$ sudo nixos-rebuild --install-bootloader boot
I also read in the bootloader wiki that :
The usual fix for this problem is to add the missing entry for
fileSystems."/boot"
inhardware-configuration.nix
(or where your mount points are defined).
But it seems that the entry is pointing to the proper partition? I think? The following will explain why I think so~
System Inspection:
Looking into my system partitions:
$ sudo fdisk -l
I see that I do have two ESP EFI System
:
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 534527 532480 260M EFI System
/dev/nvme0n1p7 1177346048 1178574847 1228800 600M EFI System
I believe I created the second ESP when installing NixOS freshly 2 years ago.
So, (if am not mistaken) I just need to tell NixOS to look at /dev/nvme0n1p7
when it is updating the Grub menu? If so, how can I do that?
(I am sorry I am relatively new to these type of boot errors in nix and am not very comfortable with making any changes without understanding or knowing it is safe–afraid I might do more harm then good~)
Also, upon inspecting the UUID of the EFI System Partition:
$ ls -l /dev/disk/by-uuid/
...
lrwxrwxrwx 1 root root 15 Jul 26 10:52 D053-54DE -> ../../nvme0n1p7
...
it matches with the one in hardware-configuration.nix
:
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D053-54DE";
fsType = "vfat";
};
So I am not sure what’s causing the new generations to not be added to the grub menu?
Error when Reinstalling the bootloader:
I get the following error after running sudo nixos-rebuild --install-bootloader boot
:
error:
… while evaluating the attribute 'config'
at /nix/store/72vz3idq9zwhmsbc0xssnyq52iziwlgy-source/lib/modules.nix:334:9:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
… while calling the 'seq' builtin
at /nix/store/72vz3idq9zwhmsbc0xssnyq52iziwlgy-source/lib/modules.nix:334:18:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
building Nix...
error:
… while evaluating the attribute 'config'
at /nix/store/72vz3idq9zwhmsbc0xssnyq52iziwlgy-source/lib/modules.nix:334:9:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
… while calling the 'seq' builtin
at /nix/store/72vz3idq9zwhmsbc0xssnyq52iziwlgy-source/lib/modules.nix:334:18:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
building the system configuration...
error:
… while evaluating the attribute 'config.system.build.toplevel'
at /nix/store/72vz3idq9zwhmsbc0xssnyq52iziwlgy-source/lib/modules.nix:334:9:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
… while calling the 'seq' builtin
at /nix/store/72vz3idq9zwhmsbc0xssnyq52iziwlgy-source/lib/modules.nix:334:18:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)