Disko-install: oom killed

Hello,

I have a Thinkpad T490 with 8GB of RAM on which I want to declaratively install my Nix Flake using disko-install. I’m using the latest NixOS Graphical Gnome ISO and from the Gnome Terminal I ran the following commands:

# password for full disk encryption
echo "changeme" > /tmp/secret.key

sudo nix \
--extra-experimental-features "nix-command flakes" \
run 'github:nix-community/disko/latest#disko-install' -- \
--write-efi-boot-entries \
--flake github:MatejaMaric/nix-setup#thinkpad-t490 \
--disk main /dev/nvme0n1

It runs for couple of minutes and then the entire Gnome Terminal gets killed. I checked my system logs with journalctl --boot and it shows that nix-build gets killed by the Linux OOM Killer with peak memory usage of 5.3GB.

It seems to me that disko-install tries to download all the nix packages that my flake uses directly into RAM. Maybe I’m wrong…

Any ideas how can I resolve this issue?

1 Like

Here’s something interesting I’ve figured out. If I use plain disko to format and mount my file systems, and use nixos-install for the rest, everything works normally. Here’s an example:

sudo nix \
--experimental-features "nix-command flakes" \
run github:nix-community/disko/latest -- \
--mode destroy,format,mount \
--flake github:MatejaMaric/nix-setup#thinkpad-t490

sudo nixos-install --flake github:MatejaMaric/nix-setup#thinkpad-t490

This tells me that disko-install is definitely doing something weird…

2 Likes

In my case the main difference here being that using disko and then nixos-install allows disko to mount any SWAP partitions you might have, potentially avoiding memory issues.

For some reason disko-install does not mount SWAP partitions because it builds the system first before it creates the partitions layout. It would be nice if its behavior was closer to that of just disko, or a flag that allows it to do the installation in two steps.

1 Like

What’s funny is that my configuration doesn’t use swap at all… :sweat_smile:

1 Like