No space left on device on nixos-rebuild
jonahbron opened this issue · comments
I'm encountering an error when running nixos-rebuild on a freshly infected system.
updating GRUB 2 menu...
cannot copy /nix/store/i1i6pn1wz0i25pvwcfhdra4bz6hcqjp7-linux-6.1.74/Image to /boot/kernels/i1i6pn1wz0i25pvwcfhdra4bz6hcqjp7-linux-6.1.74-Image.tmp: No space left on device
It seems that the error originates from the fact that the original system's partition mounted at /boot/efi
is later being mounted at /boot
. That's not inherently a problem except that it is only 100MB or so, not large enough to hold the entire kernel.
My workaround is to bind kernels/
to a different drive temporarily when I'm running a rebuild that I know will swap the kernel.
(running as root)
cd
mkdir kernels-tmp
mount --bind kernels-tmp/ /boot/kernels
# nixos-rebuild switch ...
umount /boot/kernels
rm -rf /boot/kernels/*
mv kernels-tmp/* /boot/kernels/
rm -rf kernels-tmp
I've been able to alleviate this problem even further by ensuring only one kernel version is maintained at a time.
https://search.nixos.org/options?channel=unstable&show=boot.loader.grub.configurationLimit
boot.loader.grub.configurationLimit = 1;
Still not ideal, but I don't have to do the file shuffling workaround anymore.