Skip to content

Install freezes immediately at the beginning on macOS #8002

Description

@mirosval

Platform

  • Linux:
  • macOS
  • WSL

Additional information

I'm pretty new to nix, I've installed it on one machine successfully yesterday, but today the install freezes. I just used the install command from the home page and it got stuck at "Welcome to the Multi-User Nix Installation". I cancelled it after about a minute. I tried a couple of times after that, but same result.

Output

Output

❯ sh <(curl -L https://nixos.org/nix/install) --daemon
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  4052  100  4052    0     0   6556      0 --:--:-- --:--:-- --:--:--  6556
downloading Nix 2.13.3 binary tarball for aarch64-darwin from 'https://releases.nixos.org/nix/nix-2.13.3/nix-2.13.3-aarch64-darwin.tar.xz' to '/var/folders/s1/gp_m07r53kzb77nvdzgj8bzc0000gn/T/nix-binary-tarball-unpack.XXXXXXXXXX.M0pTJ7AX'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.3M  100 10.3M    0     0  8056k      0  0:00:01  0:00:01 --:--:-- 8077k
Switching to the Multi-user Installer
Welcome to the Multi-User Nix Installation
^C
---- oh no! --------------------------------------------------------------------
Oh no, something went wrong. If you can take all the output and open
an issue, we'd love to fix the problem so nobody else has this issue.

:(

We'd love to help if you need it.

You can open an issue at
https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md

Or get in touch with the community: https://nixos.org/community
 [$!] took 1m2s


Priorities

Add 👍 to issues you find important.

Activity

  1. mirosval commented on Mar 8, 2023

    @mirosval
    Author

    So, what I did was to run the install scripts with the set -x and this is what I get:

    ❯ /var/folders/s1/gp_m07r53kzb77nvdzgj8bzc0000gn/T/nix-binary-tarball-unpack.XXXXXXXXXX.4tR2RpHf/unpack/nix-2.13.3-aarch64-darwin/install
    + umask 0022
    + dest=/nix
    ++ dirname /var/folders/s1/gp_m07r53kzb77nvdzgj8bzc0000gn/T/nix-binary-tarball-unpack.XXXXXXXXXX.4tR2RpHf/unpack/nix-2.13.3-aarch64-darwin/install
    + self=/var/folders/s1/gp_m07r53kzb77nvdzgj8bzc0000gn/T/nix-binary-tarball-unpack.XXXXXXXXXX.4tR2RpHf/unpack/nix-2.13.3-aarch64-darwin
    + nix=/nix/store/8w0v2mffa10chrf1h66cbvbpw86qmh85-nix-2.13.3
    + cacert=/nix/store/pl497357lkfpvdr8v4pfan16k7jna2l2-nss-cacert-3.83
    + '[' -e /var/folders/s1/gp_m07r53kzb77nvdzgj8bzc0000gn/T/nix-binary-tarball-unpack.XXXXXXXXXX.4tR2RpHf/unpack/nix-2.13.3-aarch64-darwin/.reginfo ']'
    + '[' -z mirosval ']'
    + '[' -z /Users/mirosval ']'
    ++ uname -s
    + '[' Darwin = Darwin ']'
    + IFS=.
    + read -r macos_major macos_minor macos_patch
    ++ sw_vers -productVersion
    + '[' 13 -lt 10 ']'
    + '[' 13 -eq 10 ']'
    + '[' 2 -eq 12 ']'
    ++ uname -s
    + '[' Darwin = Linux ']'
    + case "$(uname -s)" in
    ++ uname -s
    + INSTALL_MODE=daemon
    + ACTIONS=
    + '[' 0 -gt 0 ']'
    + '[' daemon = daemon ']'
    + printf '\e[1;31mSwitching to the Multi-user Installer\e[0m\n'
    Switching to the Multi-user Installer
    + exec /var/folders/s1/gp_m07r53kzb77nvdzgj8bzc0000gn/T/nix-binary-tarball-unpack.XXXXXXXXXX.4tR2RpHf/unpack/nix-2.13.3-aarch64-darwin/install-multi-user
    ++ set -o pipefail
    ++ readonly NIX_DAEMON_DEST=/Library/LaunchDaemons/org.nixos.nix-daemon.plist
    ++ NIX_DAEMON_DEST=/Library/LaunchDaemons/org.nixos.nix-daemon.plist
    ++ readonly NIX_VOLUME_CREATE=1
    ++ NIX_VOLUME_CREATE=1
    ++ NIX_FIRST_BUILD_UID=301
    ++ NIX_BUILD_USER_NAME_TEMPLATE=_nixbld%d
    ++ read_only_root
    ++ case "$(/usr/bin/touch / 2>&1)" in
    +++ /usr/bin/touch /
    ++ return 0
    ++ '[' 1 = 1 ']'
    ++ . /var/folders/s1/gp_m07r53kzb77nvdzgj8bzc0000gn/T/nix-binary-tarball-unpack.XXXXXXXXXX.4tR2RpHf/unpack/nix-2.13.3-aarch64-darwin/create-darwin-volume.sh no-main
    +++ set -exu
    +++ set -o pipefail
    +++ '[' no-main = no-main ']'
    +++ shift
    +++ readonly _CREATE_VOLUME_NO_MAIN=1
    +++ _CREATE_VOLUME_NO_MAIN=1
    +++ readonly NIX_VOLUME_FS=APFS
    +++ NIX_VOLUME_FS=APFS
    +++ readonly 'NIX_VOLUME_LABEL=Nix Store'
    +++ NIX_VOLUME_LABEL='Nix Store'
    ++++ root_disk_identifier
    ++++ local special_device
    +++++ /usr/bin/stat -f %Sd /
    ++++ special_device=disk3s5
    ++++ echo disk3
    +++ readonly NIX_VOLUME_USE_DISK=disk3
    +++ NIX_VOLUME_USE_DISK=disk3
    +++ NIX_VOLUME_USE_SPECIAL=
    +++ NIX_VOLUME_USE_UUID=
    +++ readonly NIX_VOLUME_MOUNTD_DEST=/Library/LaunchDaemons/org.nixos.darwin-store.plist
    +++ NIX_VOLUME_MOUNTD_DEST=/Library/LaunchDaemons/org.nixos.darwin-store.plist
    +++ /usr/bin/fdesetup isactive
    +++ NIX_VOLUME_DO_ENCRYPT=1
    +++ '[' 1 = 1 ']'
    +++ '[' -n '' ']'
    + welcome_to_nix
    + ok 'Welcome to the Multi-User Nix Installation'
    + _textout '\033[32m' 'Welcome to the Multi-User Nix Installation'
    + echo -en '\033[32m'
    + shift
    + '[' 'Welcome to the Multi-User Nix Installation' = '' ']'
    + echo 'Welcome to the Multi-User Nix Installation'
    Welcome to the Multi-User Nix Installation
    + echo -en '\033[0m'
    + cat
    

    At this point the installer gets stuck

  2. mirosval commented on Mar 8, 2023

    @mirosval
    Author

    I have tried installing using https://crates.io/crates/nix-installer and that worked.

  3. abathur commented on Mar 8, 2023

    @abathur
    Member

    Here's that invocation in the script:

    cat <<EOF
    This installation tool will set up your computer with the Nix package
    manager. This will happen in a few stages:
    1. Make sure your computer doesn't already have Nix. If it does, I
    will show you instructions on how to clean up your old install.
    2. Show you what I am going to install and where. Then I will ask
    if you are ready to continue.
    3. Create the system users and groups that the Nix daemon uses to run
    builds.
    4. Perform the basic installation of the Nix files daemon.
    5. Configure your shell to import special Nix Profile files, so you
    can use Nix.
    6. Start the Nix daemon.
    EOF

    If it's blocking on something as simple as cat and a HEREDOC, I guess it's worth seeing if there's something unexpected about cat or bash on your system.

    Might be able to diagnose with output of a few commands:

    • type -a cat bash
    • cat --version
    • bash --version

    I don't think I've ever seen bash just hang on a HEREDOC, but I was able to find an SO thread where a number of macOS users are reporting exactly this: https://stackoverflow.com/questions/65267006/bash-heredoc-hangs-when-more-than-512-characters

    If you do happen to have a modern bash on your PATH, it might be interesting to see if the installer runs clean if you modify your PATH to exclude it before running?

  4. Ericson2314 commented on Mar 9, 2023

    @Ericson2314
    Member

    Thanks for exploring this @abathur. That's cursed stuff I would not have guessed!

  5. mirosval commented on Mar 9, 2023

    @mirosval
    Author
    ❯ type -a cat bash
    cat is /bin/cat
    bash is /opt/homebrew/bin/bash
    bash is /bin/bash
    bash is /opt/homebrew/bin/bash
    ❯ cat --version
    cat: illegal option -- -
    usage: cat [-belnstuv] [file ...]

    🤷🏻‍♂️

    ❯ bash --version
    GNU bash, version 5.2.15(1)-release (aarch64-apple-darwin22.1.0)
    Copyright (C) 2022 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    
    This is free software; you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    So what I've done to repro this is I copied that cat command from the script and when I run it with #!/bin/bash at the top, it works, but #!/usr/bin/env bash does not.

    #!/bin/bash                     # <- works
    #!/usr/bin/env bash             # <- broken
    
    set -ex 
    
    cat <<EOF
    This installation tool will set up your computer with the Nix package
    manager. This will happen in a few stages:
    1. Make sure your computer doesn't already have Nix. If it does, I
       will show you instructions on how to clean up your old install.
    2. Show you what I am going to install and where. Then I will ask
       if you are ready to continue.
    3. Create the system users and groups that the Nix daemon uses to run
       builds.
    4. Perform the basic installation of the Nix files daemon.
    5. Configure your shell to import special Nix Profile files, so you
       can use Nix.
    6. Start the Nix daemon.
    EOF

    The default bash was installed using brew install bash and the /bin/bash is the system one:

    ❯ /bin/bash --version
    GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)
    Copyright (C) 2007 Free Software Foundation, Inc.
  6. abathur commented on Mar 9, 2023

    @abathur
    Member

    @mirosval Interesting :)

    Thanks for the good repro. I tried this out on my Intel mac.

    • It worked fine for me in brew-installed bash 5.2.15 with version:

      $ /usr/local/bin/bash --version
      GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin19.6.0)
      ...
    • It worked fine for me in a nix-installed bash 5.2.15 with version:

      $ /run/current-system/sw/bin/bash --version
      GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin22.2.0)
      ...

    Since you got Nix installed with the rust installer, can you give this repro one more try with a Nix-installed bash 5.2?

    (I'm wondering if this is a bash ARM bug we should report up the chain?)

  7. mirosval commented on Mar 10, 2023

    @mirosval
    Author

    I'm so sorry for this, but it looks like it works fine with the nix-installed bash. I was actually not able to reproduce the issue even with brew bash again today :(

  8. added
    macosNix on macOS, aka OS X, aka darwin
    on Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    installermacosNix on macOS, aka OS X, aka darwin

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions