Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No space left on device on nixos-rebuild #192

Open
jonahbron opened this issue Jan 30, 2024 · 5 comments
Open

No space left on device on nixos-rebuild #192

jonahbron opened this issue Jan 30, 2024 · 5 comments

Comments

@jonahbron
Copy link
Contributor

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.

@jonahbron
Copy link
Contributor Author

jonahbron commented Jan 30, 2024

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

@jonahbron
Copy link
Contributor Author

jonahbron commented Apr 28, 2024

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.

@master-hax
Copy link

master-hax commented Aug 14, 2024

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.

@Creator54
Copy link

Creator54 commented Sep 16, 2024

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";
      };
  });

Creator54 added a commit to Creator54/nix-systems that referenced this issue Sep 17, 2024
Creator54 added a commit to Creator54/nix-systems that referenced this issue Sep 17, 2024
@jonahbron
Copy link
Contributor Author

@master-hax That's a great tip thank you, I wasn't confident that deleting those files was safe, but that one command is certainly much easier 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants