Old profile conf files not deleted by `nix-collect-garbage`

On my MacBook Air running NixOS 20.03, nix-collect-garbage -d works except it doesn’t delete the previous .conf in /boot/loader/entries so I have to delete it manually. I’m wondering how I can get it to work fully and if there is something critically wrong with my system.

1 Like

there’s most likely a program still running from that generation , so nixos still sees it as “in-use”. If you do a nixos-rebuild switch it will usually tell you what services it skipped restarting due to potential conflicts.

1 Like

Sorry, I forgot respond to this thread. Appreciate your response @jonringer (and your work on nixos).

Even after I restart and run nix-collect-garbage -d, the generation isn’t deleted. Whenever I run nixos-rebuild, /boot/loader/entries is repopulated with the previous twenty-something generations even though I have deleted them.

For boot entries you need to:

  1. Run GC as root to make them stale
  2. Rebuild and switch your system, such that the activation script removes the stale entries.

Nix GC will always only affect /nix/*, never /boot!

1 Like