NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.73k stars 1.52k forks source link

Evaluating nixos linux .iso on darwin causes segfault #8412

Closed hraban closed 1 year ago

hraban commented 1 year ago

Describe the bug

When evaluating the nixos .iso derivation for linux, on darwin, you get a segfault.

Steps To Reproduce

$ nix-build -E '(import "${(builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/e10802309bf9ae351eb27002c85cfdeb1be3b262.tar.gz";     sha256 = "wQgnxz0PdqbyKKpsWl/RU8T8QhJQcHfeC6lh1xRUTfk="; })}/nixos/release-combined.nix" {}).nixos.iso_minimal.x86_64-linux'
Segmentation fault: 11

Expected behavior

A regular error, like e.g. what you get on aarch64-linux:

error: a 'x86_64-linux' with features {} is required to build '/nix/store/cxf71mrmakzj5dk4hq3z3rly053hdl3l-audit-disable.drv', but I am a 'aarch64-linux' with features {benchmark, big-parallel, gccarch-armv8-a, kvm, nixos-test}

(that's good)

nix-env --version output nix-env (Nix) 2.13.3

Additional context

 - system: `"aarch64-darwin"`
 - host os: `Darwin 22.4.0, macOS 13.3.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.13.3`
 - channels(user): `""`
 - channels(root): `""`
 - nixpkgs: `/nix/store/5ra5hcd4k79sd9b7qrfk3qy1qjf1p34f-source`

I concocted that one-liner to build by assimilating instructions from https://r13y.com/

Priorities

Add :+1: to issues you find important.

abathur commented 1 year ago

I didn't think too deeply about this, but I do see the same segfault on x86_64-darwin. It's over 125k lines, but I've attached a verbose segfault.log. I ran it a few times to make sure it failed at the same spot (at least per log output) each time.

$ nix-build -vvvvvv -E '(import "${(builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/e10802309bf9ae351eb27002c85cfdeb1be3b262.tar.gz";     sha256 = "wQgnxz0PdqbyKKpsWl/RU8T8QhJQcHfeC6lh1xRUTfk="; })}/nixos/release-combined.nix" {}).nixos.iso_minimal.x86_64-linux' &> segfault.log
Segmentation fault: 11
hraban commented 1 year ago

Same build log from aarch64 darwin: darwin-aarch64-segfault.log

roberth commented 1 year ago

Probably fixed / worked around in https://github.com/NixOS/nix/pull/7725. Could you try with Nix 2.15.1?

hraban commented 1 year ago

nice 👍 no more segfault with latest Nix. I didn't think to check, my bad.