Open magnusviri opened 11 months ago
Have you tried installing it then running it as a normal user(not root)? Also yes, /usr/local/bin might need to be added to the path
The first issue is a bug and I cannot RN imagine what the problem might be. Even though I wouldn't recommend running something as insane as stable diffusion web UI as root, pkgx
should at least succeed.
The second issue is indeed that on macOS /usr/local/bin
is not in the PATH
apart from in shell sessions. Our shims expect pkgx
to be in the PATH
which I think is an acceptable requirement. This is standard for such tools.
$ sudo -i
$ pkgx stable-diffusion-webui --api --listen
works. This runs sd-webui as root, also installing to /var/root/.pkgx
guess I better try the launch plist…
I was running this as root to try to get it to work. After getting it to work, I would've switched it to a daemon user. I was using ansible to setup multiple computers as AI render nodes (not sure that's the right name for that) and I got it to work by running nohup /usr/local/bin/pkgx stable-diffusion-webui --api --listen
in the ansible script to start the process. Ansible uses ssh, so the ssh process on the nodes were able to run the command. The environment for launchdaemons was different enough that it didn't work.
I didn't think of testing this back then, but the way I've debugged launchd environments before was by setting up a reverse shell and then telnetting in and testing. I save the following script and call it with the launchdaemon.
#!/bin/zsh
set -u
if [ ! -e /tmp/lol ]; then
mkfifo /tmp/lol;
fi
nc -l 8080 < /tmp/lol | /bin/bash -i > /tmp/lol 2>&1
rm /tmp/lol
explanation of script: https://chat.openai.com/share/6805b199-a9e5-421d-bbd7-5f4b8b3c59bb
This script is essentially setting up a reverse shell. When someone connects to the server's port 8080, they are given access to an interactive Bash shell. The use of a named pipe allows for both input and output to be handled through the same Netcat connection.
Yeah, but if you're the first person to connect, then nobody else can. It's how I debug launchd because there's no other good way! It's a strange environment.
I tried to daemonize stable diffusion and I get an error. Here's the launchd plist file.
This is how I load it:
launchctl load /path/to/launchd-file.plist
This is the error (/var/root/.local/share/stable-diffusion-webui/log.err).
I haven't done anything to the pkgx install or to the stable diffusion package (except I did install it all as root).
If I instead run
pkgx install stable-diffusion-webui
and then try to run /usr/local/bin/stable-diffusion-webui then this is the error I get:I'm guessing the problem is that in the launchd environment /usr/local/bin/ isn't in the path.