Nix: Nix segfaults when I run `nix-shell -p hello`

Created on 19 Jan 2019  路  2Comments  路  Source: NixOS/nix

nix-shell -p nix-info --run "nix-info -m" segfaults too, so I can't provide the information normally output by it. It's a Mac,

Darwin cofree.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64

Nix was just installed using sh ./install-nix-2.2.1 --daemon.

When I run nix-shell -p hello --debug, I eventually see:

starting pool of 7 threads
checking substituter 'https://cache.nixos.org' for path '/nix/store/9b5p08gmyh0p3vxy4zgnwb23k2d3k8fn-bash-4.4-p23'
checking substituter 'https://cache.nixos.org' for path '/nix/store/jlplyfq2ls9qzg6qaw9gwlg4i49m8day-bash-interactive-4.4-p23-info'
checking substituter 'https://cache.nixos.org' for path '/nix/store/zyjd5h4x61m9ck6qcvk0hnyili5sj4zl-hello-2.10'
checking substituter 'https://cache.nixos.org' for path '/nix/store/in41dz8byyyz4c0w132l7mqi43liv4yr-stdenv-darwin'
checking substituter 'https://cache.nixos.org' for path '/nix/store/j29m7875ywxjvvz8yk6sds1q8q5lnd7l-bash-interactive-4.4-p23'
querying info about '/nix/store/9b5p08gmyh0p3vxy4zgnwb23k2d3k8fn-bash-4.4-p23' on 'https://cache.nixos.org'...
querying info about '/nix/store/j29m7875ywxjvvz8yk6sds1q8q5lnd7l-bash-interactive-4.4-p23' on 'https://cache.nixos.org'...
querying info about '/nix/store/zyjd5h4x61m9ck6qcvk0hnyili5sj4zl-hello-2.10' on 'https://cache.nixos.org'...
querying info about '/nix/store/in41dz8byyyz4c0w132l7mqi43liv4yr-stdenv-darwin' on 'https://cache.nixos.org'...
querying info about '/nix/store/jlplyfq2ls9qzg6qaw9gwlg4i49m8day-bash-interactive-4.4-p23-info' on 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/zyjd5h4x61m9ck6qcvk0hnyili5sj4zl.narinfo'...
downloading 'https://cache.nixos.org/j29m7875ywxjvvz8yk6sds1q8q5lnd7l.narinfo'...
downloading 'https://cache.nixos.org/9b5p08gmyh0p3vxy4zgnwb23k2d3k8fn.narinfo'...
downloading 'https://cache.nixos.org/in41dz8byyyz4c0w132l7mqi43liv4yr.narinfo'...
downloading 'https://cache.nixos.org/jlplyfq2ls9qzg6qaw9gwlg4i49m8day.narinfo'...
starting download of https://cache.nixos.org/zyjd5h4x61m9ck6qcvk0hnyili5sj4zl.narinfo
starting download of https://cache.nixos.org/j29m7875ywxjvvz8yk6sds1q8q5lnd7l.narinfo
starting download of https://cache.nixos.org/jlplyfq2ls9qzg6qaw9gwlg4i49m8day.narinfo
starting download of https://cache.nixos.org/in41dz8byyyz4c0w132l7mqi43liv4yr.narinfo
starting download of https://cache.nixos.org/9b5p08gmyh0p3vxy4zgnwb23k2d3k8fn.narinfo
closing daemon connection because of an exception
error: unexpected end-of-file

Contrary to #2629, nix-env segfaults, too:

cofree:~ tscholak$ nix-env -i hello
installing 'hello-2.10'
error: unexpected end-of-file

Snippet from system logs:

Jan 18 18:43:30 cofree nix-daemon[1869]: objc[1869]: +[__NSPlaceholderArray initialize] may have been in progress in another thread when fork() was called.
Jan 18 18:43:30 cofree nix-daemon[1869]: objc[1869]: +[__NSPlaceholderArray initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

All 2 comments

Duplicate of #2523.

here's a solution that is wrong (since unsafe) but fixes nix:

cofree:~ tscholak$ cat /Library/LaunchDaemons/org.nixos.nix-daemon.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>org.nixos.nix-daemon</string>
    <key>KeepAlive</key>
    <true/>
    <key>RunAtLoad</key>
    <true/>
    <key>EnvironmentVariables</key>
    <dict>
      <key>OBJC_DISABLE_INITIALIZE_FORK_SAFETY</key>
      <string>YES</string>
    </dict>
    <key>Program</key>
    <string>/nix/store/1jz25hcma179wbpi56blgajw47n5kgqd-nix-2.2.1/bin/nix-daemon</string>
    <key>StandardErrorPath</key>
    <string>/var/log/nix-daemon.log</string>
    <key>StandardOutPath</key>
    <string>/dev/null</string>
  </dict>
</plist>
Was this page helpful?
0 / 5 - 0 ratings