nix-installer icon indicating copy to clipboard operation
nix-installer copied to clipboard

Error running installer on macOS Sonoma 14.2.1

Open kriswill opened this issue 1 year ago • 8 comments

Downloaded specific version and ran using:

> curl -sL -o nix-installer https://install.determinate.systems/nix/tag/v0.16.0/nix-installer-aarch64-darwin
> chmod +x nix-installer
> ./nix-installer -V
nix-installer 0.16.0
> sudo RUST_BACKTRACE=1 ./nix-installer install

Error

Error: 
   0: Planner error
   1: Error executing action
   2: Action `configure_nix` errored
   3: Action `place_nix_configuration` errored
   4: Action `create_directory` errored
   5: Failed to execute command `"mount" "-d"`
   6: No such file or directory (os error 2)

Location:
   src/cli/subcommand/install.rs:197

Metadata

key value
version 0.16.0
os macOS v14.2.1
arch aarch64

Backtrace

Backtrace:
   0: __mh_execute_header
   1: __mh_execute_header
   2: __mh_execute_header
   3: __mh_execute_header
   4: __mh_execute_header
   5: __mh_execute_header
   6: __mh_execute_header
   7: __mh_execute_header
   8: __mh_execute_header
   9: __mh_execute_header
  10: __mh_execute_header
  11: __mh_execute_header
  12: __mh_execute_header
  13: __mh_execute_header
  14: __mh_execute_header

Let me know if you want a different procedure to test this and get logs.

kriswill avatar Jan 08 '24 20:01 kriswill

Could you give me a better idea how to reproduce this?

From a clean install:

% ./nix-installer install
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Nix install plan (v0.16.0)
Planner: macos (with default settings)

Planned actions:
* Create an APFS volume `Nix Store` for Nix on `disk3` and add it to `/etc/fstab` mounting on `/nix`
* Fetch `https://releases.nixos.org/nix/nix-2.19.2/nix-2.19.2-aarch64-darwin.tar.xz` to `/nix/temp-install-dir`
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 301-332) and group (GID 30000)
* Configure Time Machine exclusions
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configuring zsh to support using Nix in non-interactive shells
* Create a `launchctl` plist to put Nix into your PATH
* Configure Nix daemon related settings with launchctl
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Step: Create an APFS volume `Nix Store` for Nix on `disk3` and add it to `/etc/fstab` mounting on `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 301-332) and group (GID 30000)
 INFO Step: Configure Time Machine exclusions
 INFO Step: Configure Nix
 INFO Step: Configuring zsh to support using Nix in non-interactive shells
 INFO Step: Create a `launchctl` plist to put Nix into your PATH
 INFO Step: Configure Nix daemon related settings with launchctl
 INFO Step: Remove directory `/nix/temp-install-dir`
Nix was installed successfully!
To get started using Nix, open a new shell or run `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh`

% sw_vers
ProductName:            macOS
ProductVersion:         14.2.1
BuildVersion:           23C71

Hoverbear avatar Jan 08 '24 21:01 Hoverbear

@Hoverbear I previously had v0.15.1 installed, along with nix-darwin. The procedure was:

  1. install nix-installer at v0.15.1
  2. install nix-darwin (around early December)
  3. uninstall nix-darwin (today). I had seen the /etc/bashrc and /etc/zshrc symlink errors, presumably after a macOS update.
  4. uninstall determinant nix installer v0.15.1
  5. install nix-installer v0.16.0
  6. error posted above.

My theory is that there is some remnant of the previous installation that is causing issues for the installer. From what I understand there was some conflict between nix-darwin and it's handling the /etc/{ba,z}shrc files. I found this unresolved issue, that might have something to do with what I'm seeing. https://github.com/LnL7/nix-darwin/issues/730.

I located these backup files here:

ls /etc/{ba,z}shrc*                                                                                                       
bashrc				bashrc_Apple_Terminal		zshrc.before-nix-darwin
bashrc.before-nix-darwin	zshrc				zshrc_Apple_Terminal

however the backup files are showing the # Nix sections in them, so I will try to restore these, and see if the nix-installer will work.

EDIT: yeah, after restoring the shell files, no dice it's still failing to install, with the same error above.

Let me know if there is a more robust logging diag I can perform to get better information for you!

terminal session output

UPDATE 2: It is also failing to install at v0.15.1.

UPDATE 3:

SUCCESS, I was able to get it installed! there were a number of files in my home directory, that were apparently causing the issues. specifically:

  • ~/.local/nix
  • ~/.nix-profile
  • ~/.nix-expr
  • ~/.cache/nix

kriswill avatar Jan 08 '24 23:01 kriswill

Also /etc/nix (for me at least – the nix.conf.before-nix-darwin file was keeping it alive I guess)

Additionally I removed the fstab entry for /nix manually, as well as the org.nixos.nix-daemon service (launchctl bootout system/org.nixos.nix-daemon && rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist ). No idea if it would've been required, I just happened to stumble over the remains.

stroborobo avatar Jan 12 '24 14:01 stroborobo

I'm really glad you got it! It seems we may have some bug, doing as you described should work.

Hoverbear avatar Jan 12 '24 18:01 Hoverbear

Do you think you could confirm with me if you had filevault enabled?

Hoverbear avatar Jan 22 '24 18:01 Hoverbear

On my machines it is. APFS is encrypted by default, "enabling" FileVault just adds a user part to the encryption key.
https://support.apple.com/guide/security/volume-encryption-with-filevault-sec4c6dc1b6e/web

No idea if it matters at all, but just in case..

stroborobo avatar Jan 22 '24 19:01 stroborobo

Do you think you could confirm with me if you had filevault enabled?

image

It's so happens that this Mac was provided by my work, and they have clamped down on enforcing some of their security measures, such as locking in FileVault.

kriswill avatar Jan 24 '24 00:01 kriswill

I've spent some time trying to reproduce this now for several days and haven't had luck. If anyone gets more information it'd be helpful if it was shared!

Hoverbear avatar Jan 25 '24 18:01 Hoverbear