Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with the installer after migrating to a new Mac via MacOS's Migration Assistant #799

Open
ilyagr opened this issue Jan 3, 2024 · 5 comments
Labels
MacOS Darwin/MacOS

Comments

@ilyagr
Copy link
Contributor

ilyagr commented Jan 3, 2024

I'm having trouble reinstalling nix after moving all of my data to a fresh Mac.

On that mac, I upgraded Monterey -> Sonoma and used Migration Assistant to transfer all data from the old Mac via a USB cable.

Now, nix does not seem to be installed. I tried installing it. First, it told me to remove the /nix line from /etc/fstab and to sudo rm some plist file. (I don't have a record). The next time running the installer, here's what I got:

info: downloading installer https://install.determinate.systems/nix/tag/v0.15.1/nix-installer-aarch64-darwin
`nix-installer` needs to run as `root`, attempting to escalate now via`sudo`...
Password:
Nix install plan (v0.15.1)
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.18.1/nix-2.18.1-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 300-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
* 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`
ERROR Error saving receipt: RecordingReceipt("/nix/receipt.json", Os {code: 30, kind: ReadOnlyFilesystem, message: "Read-only file system" })
ERROR
   0: Install failure
   1: Error executing action
   2: Action `create_nix_volume` errored
   3: Action `kickstart_launchctl_service` errored
   4: Failed to execute command with status 113 `"launchctl" "kickstart" "-k" "system/org.nixos.darwin-store"`, stdout:
      stderr: Could not find service "org.nixos.darwin-store" in domain for system

   4:

Location:
   /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/convert/mod.rs:716

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Consider reporting this error using this URL: https://github.com/DeterminateSystems/nix-installer/issues/new?title=%3Cautogenerated-issue%3E&body=%23%23+Error%0A%60%60%60%0AError%3A+%0A+++0%3A+Install+failure%0A+++1%3A+Error+executing+action%0A+++2%3A+Action+%60create_nix_volume%60+errored%0A+++3%3A+Action+%60kickstart_launchctl_service%60+errored%0A+++4%3A+Failed+to+execute+command+with+status+113+%60%22launchctl%22+%22kickstart%22+%22-k%22+%22system%2Forg.nixos.darwin-store%22%60%2C+stdout%3A+%0A++++++stderr%3A+Could+not+find+service+%22org.nixos.darwin-store%22+in+domain+for+system%0A%0A%0A%60%60%60%0A%0A%23%23+Metadata%0A%7Ckey%7Cvalue%7C%0A%7C--%7C--%7C%0A%7C**version**%7C0.15.1%7C%0A%7C**os**%7Cmacos%7C%0A%7C**arch**%7Caarch64%7C%0A
Installation failure, offering to revert...
Nix uninstall plan (v0.15.1)

Planner: macos (with default settings)

Planned actions:
* Delete file `/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist`
* Remove the APFS volume `Nix Store` on `disk3`


Proceed? ([Y]es/[n]o/[e]xplain): e
Nix uninstall plan (v0.15.1)

Planner: macos

Configured settings:
* case_sensitive: false
* diagnostic_endpoint: "https://install.determinate.systems/nix/diagnostic"
* extra_conf: []
* force: false
* modify_profile: true
* nix_build_group_id: 30000
* nix_build_group_name: "nixbld"
* nix_build_user_count: 32
* nix_build_user_id_base: 300
* nix_build_user_prefix: "_nixbld"
* nix_package_url: {"Url":"https://releases.nixos.org/nix/nix-2.18.1/nix-2.18.1-aarch64-darwin.tar.xz"}
* proxy: null
* root_disk: "disk3"
* ssl_cert_file: null
* volume_encrypt: null
* volume_label: "Nix Store"

Planned actions:
* Delete file `/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist`
  Delete file `/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist`
* Remove the APFS volume `Nix Store` on `disk3`
  Create or insert file `/etc/synthetic.conf`
  Create objects defined in `/etc/synthetic.conf`
  Unmount the `Nix Store` APFS volume
  Create an APFS volume on `disk3` named `Nix Store`
  Add a UUID based entry for the APFS volume `Nix Store` to `/etc/fstab`
  Unload, then recreate a `launchctl` plist to mount the APFS volume `/Library/LaunchDaemons/org.nixos.darwin-store.plist`
  Bootstrap the `org.nixos.darwin-store` service via `launchctl bootstrap system /Library/LaunchDaemons/org.nixos.darwin-store.plist`
  Enable ownership on `/nix`


Proceed? ([Y]es/[n]o): y
 INFO Revert: Remove directory `/nix/temp-install-dir`
 INFO Revert: Configure Nix daemon related settings with launchctl
 INFO Revert: Unload, then recreate a `launchctl` plist to put Nix into your PATH
 INFO Revert: Configuring zsh to support using Nix in non-interactive shells
 INFO Revert: Configure Nix
 INFO Revert: Configure Time Machine exclusions
 INFO Revert: Create build users (UID 300-332) and group (GID 30000)
 INFO Revert: Provision Nix
 INFO Revert: Create an APFS volume `Nix Store` for Nix on `disk3` andadd it to `/etc/fstab` mounting on `/nix`
Error:
   0: Multiple errors

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

Error:
   0: Action `bootstrap_launchctl_service` errored
   1: Failed to execute command with status 5 `"launchctl" "bootout" "system" "/Library/LaunchDaemons/org.nixos.darwin-store.plist"`, stdout:
      stderr: Boot-out failed: 5: Input/output error

   1:

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Consider reporting this error using this URL: https://github.com/DeterminateSystems/nix-installer/issues/new?title=%3Cautogenerated-issue%3E&body=%23%23+Error%0A%60%60%60%0AError%3A+%0A+++0%3A+Multiple+errors%0A%60%60%60%0A%0A%23%23+Metadata%0A%7Ckey%7Cvalue%7C%0A%7C--%7C--%7C%0A%7C**version**%7C0.15.1%7C%0A%7C**os**%7Cmacos%7C%0A%7C**arch**%7Caarch64%7C%0A
[08:24 PM] macaw ~ [1]
🐠

I'll keep trying.

Metadata

key value
version 0.15.1
os macos
arch aarch64
@ilyagr
Copy link
Contributor Author

ilyagr commented Jan 3, 2024

Good news: running the installer again seems to have worked. This is after whatever cleanup the previous run performed, as seen in the transcript.

@Hoverbear
Copy link
Contributor

I'm so glad it worked out! It's unfortunate you met this. I believe it is related to the fact that we use APFS provided UUIDs in places like the fstab which change when a migration happens...

@ilyagr
Copy link
Contributor Author

ilyagr commented Jan 3, 2024

Yes. I really appreciated the (not shown) instructions the installer provided that I should edit /etc/fstab, but it's a bit unfortunate that the installer didn't quite know how to function afterwards.

Thanks for making the installer, by the way, I imagine things would be far more painful without it.

@abathur
Copy link
Contributor

abathur commented Jan 9, 2024

Not sure if it'll apply to this installer, but there's also a known issue with ~official installs not functioning correctly after migration due to some small difference between freshly-created nixbld group/users and what you end up with after running migration assistant.

@Hoverbear Hoverbear added the MacOS Darwin/MacOS label Jan 15, 2024
@eh8
Copy link

eh8 commented Mar 5, 2024

I encountered this same error on a freshly activated 2020 M1 MacBook Air without using Migration Assistant running macOS Sonoma version 14.2.1.

info: downloading installer https://install.determinate.systems/nix/tag/v0.17.0/nix-installer-aarch64-darwin
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Password:
 INFO Step: Create an encrypted APFS volume `Nix Store` for Nix on `disk3` and add it to `/etc/fstab` mounting on `/nix`
ERROR Error saving receipt: RecordingReceipt("/nix", Os { code: 30, kind: ReadOnlyFilesystem, message: "Read-only file system" })
Error: 
   0: Install failure
   1: Error executing action
   2: Action `create_nix_volume` errored
   3: Action `encrypt_apfs_volume` errored
   4: Failed to execute command with status 1 `"/usr/sbin/diskutil" "mount" "Nix Store"`, stdout: 
      stderr: Volume on disk3s7 failed to mount

   4: 

Location:
   /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/convert/mod.rs:757

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

What worked for me was deleting the volume via diskutil apfs deleteVolume "Nix Store" as per installer recommendation and then re-running the installer. Not quite sure why it couldn't have just succeeded the first time around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MacOS Darwin/MacOS
Projects
None yet
Development

No branches or pull requests

4 participants