Closed rhoriguchi closed 7 months ago
Try running nix why-depends /run/current-system /nix/store/...
to find out why it's not being garbage-colletected.
Did you also delete old generations using nix-collect-garbage -d
?
Usually that is the reason for a bunch of initrds, this is not a deploy-rs issue.
I have the same issue. I've ran nix-garbage-collect, but now I need to run something like 'nixos-rebuild boot` to clean up the actual boot files. How can I do that, given that there's no source flake on the machine? (or is one there?)
Looks like you can rebuild boot by running /nix/var/nix/profiles/system/bin/switch-to-configuration
You can delete the old profiles, once you do that garbage collection will work and delete boot files. @nullie
@nullie NixOS deployment with deploy-rs basically works by using switch-to-configuration
, just always switch
, not boot
(but it should run all the same stuff, just also the full activation too), so it should behave pretty much the same when deploying
Yes, but when your /boot is already full, activation of new generation first tries to copy new kernel and initrd into /boot, and that fails. But when you run /nix/var/nix/profiles/system/bin/switch-to-configuration
, the kernel and initrd are already there, so no extra space is needed, and cleanup of old kernels proceeds successfuly.
So I've posted this as a solution for those who get their /boot
full:
nix-collect-gargbage -d
to delete old generations./nix/var/nix/profiles/system/bin/switch-to-configuration
to remove old kernels, initrd and boot entries from /boot
After using
deploy-rs
for a while and not collecting garbage I can't update anymore because /boot is full. Also collecting garbage and rebooting and then runningdeploy-rs
again it still does not get cleaned up. They just get readded and it fails.