Solvednixpkgs NixOS: nixos-rebuild fails with memory allocation for gzip -d

Describe the bug
nixos-rebuild fails with install-info: Cannot allocate memory for gzip -d
This should not be an actual OOM error since my system has 32GB of ram and was using around 4GB at the time of trying to switch

To Reproduce
Steps to reproduce the behavior:

  1. Update to the latest nixos-unstable from the nixpkgs github (if you're on flakes)
  2. Change configuration and attempt to rebuild

Expected behavior
A clear and concise description of what you expected to happen.
For the system to rebuild and properly switch

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.11.16-zen1, NixOS, 21.05+patch-01ba471 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre20210503_6d2553a`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
35 Answers

✔️Accepted Answer

install-info: Cannot allocate memory for gzip -d

To workaround this problem:

  1. Set your system to master.
  2. Activate it using it:
    nixos-rebuild switch --option extra-sandbox-paths "/bin/sh=$(readlink -f $(which bash))"

It works.

Other Answers:

Can we pin this issue for a few days or something? Its rather important for all ppl that follow master closely.

It didn't work for me in devos, but I think that's an issue with my lack of knowledge

so first go ahead and update the nixos input @codygman, but since this issue is messing up your existing nix.conf, you'll also need to call nixos-rebuild with an extra option: --option extra-sandbox-paths "/bin/sh=/nix/store/<bash-derivation>/bin/sh", this should update your system to a revision that includes the fix

This is already fixed on master: #124237

If you are unable to nixos-rebuild switch, then you need to manually remove the sandbox-paths = option from /etc/nix/nix.conf first.

More Issues: