serokell / deploy-rs

A simple multi-profile Nix-flake deploy tool.
Other
1.33k stars 101 forks source link

/boot does not get cleanup up #262

Closed rhoriguchi closed 7 months ago

rhoriguchi commented 7 months ago

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 running deploy-rs again it still does not get cleaned up. They just get readded and it fails.

OSError: [Errno 28] No space left on device: '/nix/store/g54jjlqj05gwdn4z9n0c06r9dzdc01q6-initrd-linux-6.6.19/initrd' -> '/boot/EFI/nixos/g54jjlqj05gwdn4z9n0c06r9dzdc01q6-initrd-linux-6.6.19-initrd.efi'
ls -l
total 522720
-rwxr-xr-x 1 root root 36793822 Mar  5 15:20 19ag9832m7hlsvvr96j4wi490l74ynlk-initrd-linux-6.6.18-initrd.efi
-rwxr-xr-x 1 root root 35053825 Mar  5 15:20 47dl905qc60xv4yj767844npms5qdpj5-initrd-linux-6.6.16-initrd.efi
-rwxr-xr-x 1 root root 35062583 Mar  5 15:20 4qiqd4ld0pkkfhcglb4shvb6va2ykshb-initrd-linux-6.6.14-initrd.efi
-rwxr-xr-x 1 root root 10170336 Mar  5 15:20 5n9f23cvildc3bamcng5lzidmw03chm9-linux-6.6.14-bzImage.efi
-rwxr-xr-x 1 root root 10175168 Mar  5 15:20 731gdw44nwwxk1d7h3nakw4rhan1j7vp-linux-6.6.16-bzImage.efi
-rwxr-xr-x 1 root root 35775911 Mar  5 15:20 8q8rsvpq8v3qnx1n31gw9sd15pj9wpw9-initrd-linux-6.6.18-initrd.efi
-rwxr-xr-x 1 root root  8948896 Mar  5 15:20 8zy8p1nhnshcf6xfm1dv3bap93dk2bdc-linux-6.1.75-bzImage.efi
-rwxr-xr-x 1 root root 34301295 Mar  5 15:20 c48g354snna88gg1c3sknfi16dnvwgad-initrd-linux-6.1.74-initrd.efi
-rwxr-xr-x 1 root root 33294972 Mar  5 15:20 fs5jm6jb4k2yfr03xrp36y9b8l01lin8-initrd-linux-6.6.14-initrd.efi
-rwxr-xr-x 1 root root 27074560 Mar  5 15:20 g54jjlqj05gwdn4z9n0c06r9dzdc01q6-initrd-linux-6.6.19-initrd.efi
-rwxr-xr-x 1 root root 35047084 Mar  5 15:20 i2dmfp5y8npwf7xrlxfv02fyx08vzr0n-initrd-linux-6.6.15-initrd.efi
-rwxr-xr-x 1 root root 32508769 Mar  5 15:20 jhhj23jkmsi8ra3bqzzp2mxrysccml59-initrd-linux-6.1.75-initrd.efi
-rwxr-xr-x 1 root root  8940672 Mar  5 15:20 jl6vibmcr1fsfqpsm2cppirx7pznhhpp-linux-6.1.74-bzImage.efi
-rwxr-xr-x 1 root root 10187264 Mar  5 15:20 k465dwbzq741ycvzd44rq1q304sdlpa7-linux-6.6.19-bzImage.efi
-rwxr-xr-x 1 root root 35775764 Mar  5 15:20 lwpbqsw0yhpr25fyfi3rb7gq5l6556zk-initrd-linux-6.6.18-initrd.efi
-rwxr-xr-x 1 root root 10174752 Mar  5 15:20 qqv1awrfpfinb41nc81zclg59vy7h1ly-linux-6.6.17-bzImage.efi
-rwxr-xr-x 1 root root 35771116 Mar  5 15:20 r14hyvgv35mkl2c36jav4vh965z9f8j2-initrd-linux-6.6.17-initrd.efi
-rwxr-xr-x 1 root root 34818124 Mar  5 15:20 rb9h2a5h06n21k8446fr0dhmqfi2f6nx-initrd-linux-6.6.16-initrd.efi
-rwxr-xr-x 1 root root 10179072 Mar  5 15:20 v4zf498vi5r3lp925lwww705xx8s4icl-linux-6.6.18-bzImage.efi
-rwxr-xr-x 1 root root 34820641 Mar  5 15:20 x4wq7ryifqxxyi0ywbhp6i3c6isbkm2h-initrd-linux-6.6.17-initrd.efi
-rwxr-xr-x 1 root root 10165216 Mar  5 15:20 y7hfdgbzqz6271428c1dgx4im90qydiq-linux-6.6.15-bzImage.efi
-rwxr-xr-x 1 root root 10175168 Mar  5 15:20 yd17ynq2hhzzmm4nskypyh6a2d3n1dbx-linux-6.6.16-bzImage.efi
PhilTaken commented 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.

nullie commented 4 months ago

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?)

nullie commented 4 months ago

Looks like you can rebuild boot by running /nix/var/nix/profiles/system/bin/switch-to-configuration

rhoriguchi commented 4 months ago

You can delete the old profiles, once you do that garbage collection will work and delete boot files. @nullie

notgne2 commented 4 months ago

@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

nullie commented 4 months ago

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:

  1. Run nix-collect-gargbage -d to delete old generations.
  2. Run /nix/var/nix/profiles/system/bin/switch-to-configuration to remove old kernels, initrd and boot entries from /boot