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

"launchctl" "bootout" "system" "/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist" Boot-out failed: 5: Input/output error #1187

Open
szicari-streambit opened this issue Sep 20, 2024 · 12 comments
Labels
MacOS Darwin/MacOS

Comments

@szicari-streambit
Copy link

Error

Error: 
   0: Install failure
   1: Error executing action
   2: Action `create_nix_hook_service` errored
   3: Failed to execute command with status 5 `"launchctl" "bootout" "system" "/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist"`, stdout: 
      stderr: Boot-out failed: 5: Input/output error


Metadata

key value
version 0.26.1
os macos
arch aarch64
@szicari-streambit
Copy link
Author

I'd like to note that I can get the installation to succeed if I allow the script to undo what it tried to do, restart my Mac, and then run the script as one of the first things I do after logging in.

@cole-h
Copy link
Member

cole-h commented Sep 20, 2024

That's interesting... If you see this again, I'd be interested in the output of launchctl print system/systems.determinate.nix-installer.nix-hook.

(I wish launchctl was more verbose with what actually went wrong)

@cole-h cole-h added the MacOS Darwin/MacOS label Sep 20, 2024
@cole-h cole-h changed the title Installation failure on macOS Sequoia "launchctl" "bootout" "system" "/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist" Boot-out failed: 5: Input/output error Sep 20, 2024
@szicari-streambit
Copy link
Author

szicari-streambit commented Sep 20, 2024

Ok. I will post the result here if I have to reinstall again.

@kblcuk
Copy link

kblcuk commented Sep 21, 2024

@cole-h this is how it looks for me (with same error happening, albeit still on Sonoma):

launchctl print system/systems.determinate.nix-installer.nix-hook
system/systems.determinate.nix-installer.nix-hook = {
        active count = 0
        path = /Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist
        type = LaunchDaemon
        state = not running

        program = /bin/sh
        arguments = {
                /bin/sh
                -c
                /bin/wait4path /nix/nix-installer && /nix/nix-installer repair
        }

        stdout path = /nix/.nix-installer-hook.out.log
        stderr path = /nix/.nix-installer-hook.err.log
        default environment = {
                PATH => /usr/bin:/bin:/usr/sbin:/sbin
        }

        environment = {
                XPC_SERVICE_NAME => systems.determinate.nix-installer.nix-hook
        }

        domain = system
        minimum runtime = 10
        exit timeout = 5
        runs = 2
        last exit code = 0

        semaphores = {
                successful exit => 0
        }

        spawn type = daemon (3)
        jetsam priority = 40
        jetsam memory limit (active) = (unlimited)
        jetsam memory limit (inactive) = (unlimited)
        jetsamproperties category = daemon
        jetsam thread limit = 32
        cpumon = default
        probabilistic guard malloc policy = {
                activation rate = 1/1000
                sample rate = 1/0
        }

        properties = inferred program | managed LWCR | has LWCR
}

@cole-h
Copy link
Member

cole-h commented Sep 21, 2024

Thanks! Does the plist path in that output exist as a file...?

@kblcuk
Copy link

kblcuk commented Sep 22, 2024

I actually got it fixed by reboot 😅 And now that I tried uninstalling / reinstalling nix a couple of times, I don't seem to get that problem anymore.

@szicari-streambit
Copy link
Author

szicari-streambit commented Sep 23, 2024

That's interesting... If you see this again, I'd be interested in the output of launchctl print system/systems.determinate.nix-installer.nix-hook.

(I wish launchctl was more verbose with what actually went wrong)

Command and output:

$ launchctl print system/systems.determinate.nix-installer.nix-hook
system/systems.determinate.nix-installer.nix-hook = {
	active count = 1
	path = /Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist
	type = LaunchDaemon
	state = running

	program = /bin/sh
	arguments = {
		/bin/sh
		-c
		/bin/wait4path /nix/nix-installer && /nix/nix-installer repair
	}

	stdout path = /nix/.nix-installer-hook.out.log
	stderr path = /nix/.nix-installer-hook.err.log
	default environment = {
		PATH => /usr/bin:/bin:/usr/sbin:/sbin
	}

	environment = {
		XPC_SERVICE_NAME => systems.determinate.nix-installer.nix-hook
	}

	domain = system
	minimum runtime = 10
	exit timeout = 5
	runs = 124
	pid = 6074
	immediate reason = semaphore
	forks = 1
	execs = 2
	initialized = 1
	trampolined = 1
	started suspended = 0
	proxy started suspended = 0
	last exit code = 78: EX_CONFIG

	semaphores = {
		successful exit => 0
	}

	spawn type = daemon (3)
	jetsam priority = 40
	jetsam memory limit (active) = (unlimited)
	jetsam memory limit (inactive) = (unlimited)
	jetsamproperties category = daemon
	jetsam thread limit = 32
	cpumon = default
	probabilistic guard malloc policy = {
		activation rate = 1/1000
		sample rate = 1/0
	}

	properties = inferred program | managed LWCR | has LWCR
}

Also, not sure how relevant, but I've had to install / uninstall / reboot / install Nix on every reboot so far. It hasn't "stayed" installed for whatever reason. The error that leads to the above reinstall cycle is because the Nix suite of commands aren't found and then the install fails because /nix is readonly. It's a vicious cycle. 😊

@cole-h
Copy link
Member

cole-h commented Sep 23, 2024

@szicari-streambit Does /Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist exist when you run into this failure? Is there anything (interesting) in /nix/.nix-installer-hook.out.log or /nix/.nix-installer-hook.err.log? What does ps aux | grep nix-installer show, if anything?

Also, not sure how relevant, but I've had to install / uninstall / reboot / install Nix on every reboot so far. It hasn't "stayed" installed for whatever reason. The error that leads to the above reinstall cycle is because the Nix suite of commands aren't found and then the install fails because /nix is readonly.

That's certainly strange, but probably bears investigation in another ticket. (A few things to try before that: does starting up a new terminal window make the nix commands show up? What if you ssh into the machine, if you're able to set that up? And finally: what if you run /nix/nix-installer repair hooks and try my previous 2 suggestions again?)

@szicari-streambit
Copy link
Author

Thanks for all this. I have my task list for the next time this occurs.

@jhult
Copy link

jhult commented Sep 23, 2024

I had the same issue on macOS 15.0 (24A335). Installing immediately after a reboot fixed the issue for me as well.

@szicari-streambit
Copy link
Author

Good morning, @cole-h. After shutting down my computer, I have again found Nix unavailable. The result of your steps above:

After the first failed install, neither of the log files were present:

Screenshot 2024-09-25 at 08 48 13

The plist file was also not present.

Screenshot 2024-09-25 at 08 49 40

Here is the full output from the failure:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
info: downloading installer https://install.determinate.systems/nix/tag/v0.26.2/nix-installer-aarch64-darwin
 INFO nix-installer v0.26.2
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
 INFO nix-installer v0.26.2
Nix install plan (v0.26.2)
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`
* Extract the bundled Nix (originally from /nix/store/6kl4439887d6ggjgrc41h3jqrcvbwlki-nix-binary-tarball-2.24.7/nix-2.24.7-aarch64-darwin.tar.xz)
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 351-382) and group (GID 350)
* 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
* Unload, then recreate a `launchctl` plist to put Nix into your PATH
* Configure upstream Nix daemon service
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain):
 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 351-382) and group (GID 350)
 INFO Step: Configure Time Machine exclusions
 INFO Step: Configure Nix
 INFO Step: Configuring zsh to support using Nix in non-interactive shells
 INFO Step: Unload, then recreate a `launchctl` plist to put Nix into your PATH
ERROR
   0: Install failure
   1: Error executing action
   2: Action `create_nix_hook_service` errored
   3: Failed to execute command with status 5 `"launchctl" "bootout" "system" "/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist"`, stdout:
      stderr: Boot-out failed: 5: Input/output error

   3:

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

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_hook_service%60+errored%0A+++3%3A+Failed+to+execute+command+with+status+5+%60%22launchctl%22+%22bootout%22+%22system%22+%22%2FLibrary%2FLaunchDaemons%2Fsystems.determinate.nix-installer.nix-hook.plist%22%60%2C+stdout%3A+%0A++++++stderr%3A+Boot-out+failed%3A+5%3A+Input%2Foutput+error%0A%0A%0A%60%60%60%0A%0A%23%23+Metadata%0A%7Ckey%7Cvalue%7C%0A%7C--%7C--%7C%0A%7C**version**%7C0.26.2%7C%0A%7C**os**%7Cmacos%7C%0A%7C**arch**%7Caarch64%7C%0A
Installation failure, offering to revert...
Nix uninstall plan (v0.26.2)

Planner: macos (with default settings)

Planned actions:
* Delete file `/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist`
* Remove the Nix configuration from zsh's non-login shells
* Unconfigure the shell profiles
* Remove the Nix configuration in `/etc/nix/nix.conf`
* Unset the default Nix profile
* Remove time machine exclusions
* Remove Nix users and group
* Remove the directory tree in `/nix`
* Remove the APFS volume `Nix Store` on `disk3`


Proceed? ([Y]es/[n]o/[e]xplain):
 INFO Revert: Remove directory `/nix/temp-install-dir`
 INFO Revert: Configure upstream Nix daemon service
 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 351-382) and group (GID 350)
 INFO Revert: Provision Nix
 INFO Revert: Create an APFS volume `Nix Store` for Nix on `disk3` and add it to `/etc/fstab` mounting on `/nix`
Error:
   0: Multiple errors

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

Error:
   0: Action `create_nix_hook_service` errored
   1: Remove file `/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist`
   2: No such file or directory (os error 2)

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.26.2%7C%0A%7C**os**%7Cmacos%7C%0A%7C**arch**%7Caarch64%7C%0A

A new terminal did not cause the nix commands to be present.

I'm not sure if this is relevant, but I see the Nix volume was attached as expected when the system booted up.

Screenshot 2024-09-25 at 08 37 11

@cole-h
Copy link
Member

cole-h commented Sep 26, 2024

@szicari-streambit That is intriguing... Thank for the info! I think we may just need to check if that file exists before trying to do any launchctl funsies on it. Is it possible that trying to install again works for you in the interim? If not, I'll write a patch for you to try ASAP.

Additionally, is this an MDM-managed device? I'm having a hard time figuring out why Nix would just disappear on reboot, since we have that hook (when it successfully installs....). Next time that happens, I'd be interested in seeing your /etc/zshrc and /etc/bashrc, if you wouldn't mind uploading them to a gist or something. That's where we should be sourcing the script that tells the shells "here's where to look for Nix binaries and other stuff!"...

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