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

plist file is never created but the installer assumes it is #1230

Closed
cdmistman opened this issue Oct 9, 2024 · 6 comments · Fixed by #1257
Closed

plist file is never created but the installer assumes it is #1230

cdmistman opened this issue Oct 9, 2024 · 6 comments · Fixed by #1257

Comments

@cdmistman
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


I've verified that the file /Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist doesn't exist at the time when the installer is prompting permission to proceed with uninstalling following this error.

Metadata

key value
version 0.27.0
os macos
arch aarch64
@cdmistman
Copy link
Author

it seems this is similar to the user's error in #1187 i'm going to be investigating this ITT though I have to leave soon and I'm already behind on finishing a task because of nix not surviving a macos update :(

@cdmistman
Copy link
Author

cdmistman commented Oct 9, 2024

so despite the file not existing, launchctl does acknowledge the existence of the service

$ "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
}
$ ls -al /Library/LaunchDaemons 
total 32
drwxrwxr-x   6 root  wheel   192 Oct  9 16:19 .
drwxr-xr-x  68 root  wheel  2176 Oct  4 00:16 ..
-rw-r--r--   1 root  wheel   619 Apr  1  2023 com.docker.socket.plist
-rwx------   1 root  wheel   601 Nov 18  2023 com.nordvpn.macos.helper.plist
-rw-r--r--   1 root  wheel   681 Jan 22  2024 com.sparklabs.ViscosityHelper.plist
-rw-r--r--   1 root  wheel   569 Oct  9 16:19 org.nixos.darwin-store.plist

@cdmistman
Copy link
Author

here's some more logs that are helpful:

$ cat /nix/.nix-installer-hook.out.log
cat: /nix/.nix-installer-hook.out.log: No such file or directory
$ ls -al /nix                         
total 120680
drwxr-xr-x  10 root    wheel        320 Oct  9 16:20 .
drwxr-xr-x  20 root    wheel        640 Sep 30 22:10 ..
drwx------   4 root    wheel        128 Oct  9 16:19 .Spotlight-V100
d-wx--x--t   3 root    wheel         96 Oct  9 16:19 .Trashes
drwx------   6 root    wheel        192 Oct  9 16:19 .fseventsd
-rwxr-xr-x   1 colton  staff   61746704 Oct  9 15:16 nix-installer
-rw-r--r--   1 root    wheel      39012 Oct  9 16:20 receipt.json
drwxrwxr-t@ 58 root    nixbld      1856 Oct  9 16:20 store
drwxr-xr-x   3 root    wheel         96 Oct  9 16:19 temp-install-dir
drwxr-xr-x@  4 root    wheel        128 Oct  9 16:19 var

@cdmistman
Copy link
Author

after rebooting i verified that the plist file still doesn't exist, but when i re-run nix-installer install it succeeds and the plist file exists

@jonringer
Copy link

This seems to be reproducible by doing:

  • Install on mac
  • running /nix/nix-installer uninstall
  • then trying to install again

I haven't confirmed, but I'm assuming launchctl has some stale state. And rebooting allows for it to "flush" the stale state, then it can proceed with installation.

@cole-h
Copy link
Member

cole-h commented Oct 28, 2024

This seems to be reproducible by doing:

* Install on mac

* running `/nix/nix-installer uninstall`

* then trying to install again

I haven't confirmed, but I'm assuming launchctl has some stale state. And rebooting allows for it to "flush" the stale state, then it can proceed with installation.

Thanks for that hint -- the actual steps I took to reproduce were:

  1. Install
  2. Reboot
  3. Uninstall
  4. Install

(To reproduce, you need to reboot after installing because otherwise the nix hook won't be "active" in launchd's eyes -- it only runs on startup.) That was able to show me the failed bootout at the first try. I think your hunch that there is stale launchctl state is correct, but I think we can fix this by using the service identifier (system/systems.determinate.....) instead of the path to the unit (/Library/LaunchDaemons/systems.det.....).

For anybody who comes across this issue in the future, you should be able to fix this by running the following command and then re-attempting the install:

sudo launchctl bootout system/systems.determinate.nix-installer.nix-hook

(the unit that the installer complained about is system/systems.determinate.nix-installer.nix-hook in this case, but it may work for any other services it complains about)

(#1257 should fix these bootout issues once and for all)

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

Successfully merging a pull request may close this issue.

3 participants