What to do with a full /boot partition?

My /boot is only 30m. I can’t even build a single generation. Any suggestion how to increase that?

2 Likes

This is a BUG. It’s extremely not good that a system can get broken by continuing to do nixos-rebuild switch (because nixos is meant to be a fearless tinkering system - that’s meant to be its strength).

If there’s only space for one more generation then it should fail with an error saying “Please run nixos-garbage-collect first and then rerun this command with --force.”

6 Likes

Just to note as this has happened to several people. If you start getting locale problems with perl (and in my case gnome-terminal didn’t want to start). That could be due to the /boot partition running out of space. If you set it in the gui to something then that seems to fix it again (not something that nixos-rebuild would fix unfortunately).

1 Like

My two cents since I’ve had issues with that on my Raspberry Pi: the root cause of the bug is putting more things than strictly necessary on firmware/EFI partitions. This has been solved for RPi for a while, and it’s where it happens most often. However, an UEFI system with 512MB /boot partitions as specified in the manual could potentially encounter this issue too, albeit more rarely. Should we consider moving that to /boot/efi there as well?

1 Like

I had windows slapped on the box as wasn’t sure if nixos would take (and chillblast doesn’t have a nixos preinstalled option yet) but the /boot partition is 100mb and 25mb seems to be windows boot which is mostly fonts!

Thank you - that saved the day when it was full and I was reinstalling nix from a liveusb but it was complaining about a full boot disk. Pointing it at the mounted drive worked wonders:

nix-env -p /mnt/nix/var/nix/profiles/system --delete-generations +2

1 Like
  1. Manually make some space in boot. Find your kernels and rm them.

Thanks for the instructions. How do I know which files are safe to delete?

Seemed like this question was never explicitly answered which left me confused about what to do exactly for step 3. Here’s what you should do exactly:

First, determine your current kernel version:

$ uname -r
6.1.38

Any file in /boot/EFI/nixos that doesn’t include those numbers is (presumably) safe to delete. Err on the side of caution and only delete the oldest few versions. My oldest version was 5.15.74, so I personally ran sudo rm -rf /boot/EFI/nixos/*-5.15.74* to get space back.

Repeat with more old versions until sudo nixos-rebuild switch stops throwing “No space left on device” errors.

2 Likes

And since it has apparently not been mentioned in this thread, you should probably tune the configurationLimit of your bootloader so that it removes the oldest ones automatically.

I don’t think most desktop use cases will need more than a handful of generations at any point in time, so the default of infinite or ~100 (which can still eventually grow to ~3GBs worth of kernel+initrds) is a bit excessive, even if there are good arguments for keeping it high by default.

2 Likes

And since it has apparently not been mentioned in this thread, you should probably tune the configurationLimit of your bootloader so that it removes the oldest ones automatically.

How and where is boot.loader.systemd-boot.configurationLimit declared please? I had a look at the linked search, but in my newb-ness it isn’t clear to me how to do that.

Normally you would add it to /etc/nixos/configuration.nix, looking somewhat like this: https://github.com/TLATER/dotfiles/blob/444a85b014ad86dc5a9fa9e5e38c585dcb7958f7/nixos-config/default.nix#L81

That said, this is a pretty basic question. The actual docs on how to use NixOS are in the NixOS manual; have a read through at least that chapter and open a separate thread when you run into issues. This one is quite old and basic usage of NixOS is a bit out of scope.

1 Like