NULCODE

NixOS re-re-re-build

Slowly filling up /boot

Someone on this blog wrote about NixOS:

Having a look at the garbage collector: after a few weeks (85 builds), 141MB free over 1GB on /boot good to keep in mind…

So guess what, /boot went full.

Actually it’s worse than that: I didn’t care, because I thought that I would just need to invoke the garbage collector to fix the issue when it will show up.

Garbage collecting

So, let’s run sudo nix-collect-garbage --delete-older-than 7d as planned… and it doesn’t clean up /boot

Searching online for the correct nix tool to do this and the stuff popping up look like:

What bothered me a bit (and that’s why actually this post exits) is that there does not seem to be a “clean” nix way to do this.

So, maybe I didn’t find the clean solution I looked for but what at least worked for me (and should work on any system): delete manually a few entries in /boot/EFI/nixos/

I only deleted the last two oldest kernels and initrd sets, don’t need to nuke everything, as I wanted to check that the garbage collector worked as intended, when it can.

sudo nix-collect-garbage --delete-older-than 7d

Yes… this cleans /nix/store, but I couldn’t find a message about removing stuff in /boot on success (if /boot is full, it does not report anything either…).

Now, building is possible again nixos-rebuild switch --flake /etc/nixos and df reports a sane /boot again.

I’d like to investigate the internals of NixOS to understand why nix-collect-garbage cannot delete stuff in this very situation or who exactly deletes stuff.

Notes

NixOS gives a great feeling of resilience. If you want to sneakily nuke NixOS, maybe start with dd if=/dev/urandom of=/boot/let_us_fill_this_boot_partition and break the current system.

Apparently you also can run in a very similar issue if /tmp fills up (iirc a full /var on Debian also leads to interesting issues).

There is this fairly old NixOS open issue about this

Use something like boot.loader.systemd-boot.configurationLimit = 5; in your config.

← Let's try something new! Rust?
RockPro64 LEDs →