disko icon indicating copy to clipboard operation
disko copied to clipboard

Minimum requirements for Disko

Open bittner opened this issue 1 year ago • 11 comments

I see there is a System Requirements article in the wiki that is yet to be populated.

> 4 GB RAM required?

Today, I tried to set up a laptop with 4 GB RAM with Disko. I booted a NixOS minimal ISO using a USB stick and started Disko for partitioning only. Disko started downloading dependencies but eventually ran out of memory before it could even start partitioning.

I assume what ran out of space was the RAM disk that the ISO installer is running on. Does that mean that 4 GB RAM are not sufficient to run Disko?

Is there any workaround to make Disko run successfully on systems with modest hardware characteristics?

bittner avatar Jan 20 '25 14:01 bittner

You might have better luck by having an image that has disko already installed by default so that you are not downloading another copy of nixpkgs. Disko itself shouldn't have significant system resource requirements. Less than a normal nixos evaluation for sure.

Mic92 avatar Jan 20 '25 18:01 Mic92

How are you running disko? Maybe try nix-shell -p disko instead of nix run github:nix-community/disko?

Mic92 avatar Jan 20 '25 18:01 Mic92

I figured that it's my flake that downloads all that stuff!

If I simply fetch my disko-config.nix and run disko with it the partitioning can start successfully. I run disko the usual way, as described in the Quickstart documentation:

sudo nix --extra-experimental-features "nix-command flakes" run github:nix-community/disko/latest -- \
  --mode destroy,format,mount disko-config.nix

But then again, after partitioning, wouldn't nixos-install fail when I attempt to run my flake with it?—How much is a successfully prepared disk worth when the installer can't proceed? Is there a way around this problem?

bittner avatar Jan 20 '25 18:01 bittner

nixos-install shouldn't go out-of-memory because it can install the target file system and doesn't need to store everything memory.

Mic92 avatar Jan 20 '25 18:01 Mic92

@bittner I was also running into this trying to follow the disko install guide in a VM with 4GB. Even increasing the amount of RAM to 6GB, I was running out of memory.

I was able to work around the OOM by mounting another virtual disk and creating a 2GB swap file on it. However, I still wasn't able to get a complete install to verify.

Hopefully that's all you need, but now I'm running into No space left on device, even with a 32GB installation target drive. I think both of my issues are stemming from /nix being mounted on tmpfs (findmnt -T /nix) , which seems to be a RAM disk in my case.

I haven't had the time to test yet, but my next step was going to try remounting either /nix or /nix/store to some larger bulk device during the install.

delmilio avatar Jan 29 '25 06:01 delmilio

I got it working with 8GB well in qemu. 4GB was OoM for me.

dzmitry-lahoda avatar Feb 07 '25 22:02 dzmitry-lahoda

I trimmed down my host configs to a bare minimum and with disko-install i am still running into No space left on device even with 8gb of ram. Is there some way to fire up the disko formatting script before nixos starts downloading hundreds of packages so it will actually download to my desired root drive? Im trying to avoid using nixos-anywhere, to prepare for cases when i dont have another nixos host available.

Doosty avatar Feb 18 '25 16:02 Doosty

Issue 1 disko-install downloads everything to /nix/store, but nixos-install - to /mnt/nix/store directly

Issue 2 nix run 'github:nix-community/disko/latest#disko-install' takes 1.3G nix-shell -p disko just took 1M

So workaround is:

nix-shell -p disko
sudo disko --mode disko --flake .#name
sudo nixos-install --no-channel-copy --no-root-password --flake .#name

yakimant avatar Feb 26 '25 16:02 yakimant

disko-install downloads everything to /nix/store, but nixos-install - to /mnt/nix/store directly

I just got hit by this issue and wow, this is a huge footgun. It it possible to make it so that disko-install behaves like nixos-install here? Is there a reason why it's doing things differently in the first place?

musjj avatar Apr 27 '25 19:04 musjj

I just ran into this issue as well, took a fair bit of searching to get to this thread. If this is intended, a bit of documentation would be really helpful.

thegatesdev avatar May 22 '25 18:05 thegatesdev

EDIT: solved, see below.

So workaround is:

nix-shell -p disko
sudo disko --mode disko --flake .#name
sudo nixos-install --no-channel-copy --no-root-password --flake .#name

I just tried this, but I get a chroot failure:

installing the boot loader...
chroot: failed to run command */nix/var/nix/profiles/system/activate*: No such file or directory
chroot: failed to run command */nix/var/nix/profiles/system/sw/bin/bash*: No such file or directory

related

The files are there though, but I'm not sure what nixos-install is doing in-between 🤔

FWIW, I'm getting the entire disko-install issue with a machine with 8Gb of RAM, which I will certainly upgrade, but it's still a big foot-gun, as others mentioned :D

EDIT: turns out that my --flake .#some-flake was somewhere in /nix/store/<my-source-flake> (because I wanted it to be transferred to the installation disk) - that won't work, since /nix/store is being removed under the process' nose while nixos-install is running... My workaround was to copy /nix/store/<my-source-flake> to ~/my-source, then cd ~/my-source && nixos-install --no-channel-copy --no-root-password --flake .#name

Ocramius avatar Nov 20 '25 22:11 Ocramius