When changing the kernel's architecture: grub error: you need to load kernel first

I have recently followed this very old tutorial for turning a 32bit nixos install into a 64bit one. I have tried to replace the kernel, as the guide says:

boot.kernelPackages = (import <nixpkgs> { system = "x86_64-linux"; }).linuxPackages;

But now I get grub error: you need to load kernel first on boot (All the previous iterations still work)

Is there a way to fix this?

I am on nixos-unstable(24.11) and this has been happening to me.
I originally had,
boot.kernelPackages = pkgs.linuxPackages; but changing it to
boot.kernelPackages = pkgs.linuxPackages_6_9; fixed the issue for me.

1 Like