Help fix my setup, nixos-rebuild error

I’ve been using NixOS for around a year now. I prefer to use hibernate, so it’s been a while since I properly restarted my system, but I do have older builds that I can revert to. I have most of my packages in my .nix configuration, otherwise I use nix-shell -p [package]. I haven’t changed my setup since I last ran nixos-rebuild, that I can remember, so I’m not sure what’s gone wrong.

I’ve tried running nix-collect-garbage -d and sudo nix-store --verify --check-contents --repair.

How can I go about debugging this? How can I figure out where/why that kernel file is being referenced and why it’s gone? How screwed am I?

--show-trace can print error log

The error comes from here: https://github.com/NixOS/nixpkgs/blob/f3f4e74d694d928e27962312ade98b220d2af085/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py#L306

It’s not a fatal error and as long as you have other, working entries in your boot menu, it should be fine to reboot. You can check /boot/loader/entries/ to see which entries are currently there.

As to why the error occurs, it seems that you have generations in your system profile that are missing some files. You could check the links in /nix/var/nix/profiles and just remove the problematic ones. They will then be cleaned up by the next GC.

I have no idea how you ended up with those generations though. But they seem to be quite old, as they refer to NixOS version 21.11.

1 Like