nixos-infect
nixos-infect copied to clipboard
No space left on device on nixos-rebuild
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.
boot.loader.grub.configurationLimit = 1;
thank you @jonahbron!
fwiw i was able to just run rm /boot/kernels/* && nixos-rebuild --upgrade boot after applying this option on an oracle cloud vm with os 22.04 Minimal aarch64 and shape VM.Standard.A1.Flex without any mounting. the VM reboots just fine.
tried, all the suggestions shared here. didn't worked for me. Checked the linux-6.1 kernel is smallest and comes with the script. Keeping the kernel pinned fixes the issue for me. Hope it helps someone :)
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_6_1.override {
argsOverride = rec {
src = pkgs.fetchurl {
url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";
sha256 = "sha256-XrRwb4mPUIgVUv9RRtiSEy0//FKYAzv/4nCH06RMRXM=";
};
version = "6.1.103";
modDirVersion = "6.1.103";
};
});