[GH-ISSUE #72] NoVNC python3 not found because no /usr/local/bin in $PATH for shell script started by service #41

Open
opened 2026-03-02 03:21:27 +03:00 by kerem · 3 comments
Owner

Originally created by @infostud on GitHub (Dec 26, 2024).
Original GitHub issue: https://github.com/clonos/control-pane/issues/72

In novnc/utils/websockify/run

#!/usr/bin/env sh
set -e
cd "$(dirname "$0")"
exec python3 -m websockify "$@"

After service clonos-vnc2wss start

tail -f /var/log/messages
Dec 26 16:03:36 tyche clonos_vnc2wss[39879]: Warning: could not find self.pem
Dec 26 16:03:36 tyche clonos_vnc2wss[39879]: Using local websockify at /usr/local/www/clonos/public/novnc/utils/websockify/run
Dec 26 16:03:36 tyche clonos_vnc2wss[39879]: Starting webserver and WebSockets proxy on port 6081
Dec 26 16:03:36 tyche clonos_vnc2wss[39879]: exec: python3: not found
Dec 26 16:03:37 tyche clonos_vnc2wss[39879]: Failed to start WebSockets proxy

because /usr/local/bin isn't in the $PATH where python3 is located. A quick and dirty solution is to include the full path /usr/local/bin/python3 in the run shell script. Most Linux distributions include python3 in system directories. *BSD advocates might say that is polluting the system core directories with third-party software.

Originally created by @infostud on GitHub (Dec 26, 2024). Original GitHub issue: https://github.com/clonos/control-pane/issues/72 In `novnc/utils/websockify/run` ``` #!/usr/bin/env sh set -e cd "$(dirname "$0")" exec python3 -m websockify "$@" ``` After `service clonos-vnc2wss start` ``` tail -f /var/log/messages Dec 26 16:03:36 tyche clonos_vnc2wss[39879]: Warning: could not find self.pem Dec 26 16:03:36 tyche clonos_vnc2wss[39879]: Using local websockify at /usr/local/www/clonos/public/novnc/utils/websockify/run Dec 26 16:03:36 tyche clonos_vnc2wss[39879]: Starting webserver and WebSockets proxy on port 6081 Dec 26 16:03:36 tyche clonos_vnc2wss[39879]: exec: python3: not found Dec 26 16:03:37 tyche clonos_vnc2wss[39879]: Failed to start WebSockets proxy ``` because /usr/local/bin isn't in the `$PATH` where `python3` is located. A quick and dirty solution is to include the full path `/usr/local/bin/python3` in the `run` shell script. Most Linux distributions include python3 in system directories. *BSD advocates might say that is polluting the system core directories with third-party software.
Author
Owner

@mergar commented on GitHub (Dec 26, 2024):

Its ClonOS or setup on FreeBSD ? Most likely you missed an important step from the instructions:

ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3
<!-- gh-comment-id:2562422724 --> @mergar commented on GitHub (Dec 26, 2024): Its ClonOS or setup on FreeBSD ? Most likely you missed an important step from the instructions: ``` ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3 ```
Author
Owner

@infostud commented on GitHub (Dec 26, 2024):

Set up on new installation of 14.2-RELEASE.

ls -l /usr/local/bin/python3
lrwxr-xr-x  1 root wheel 25 Dec 25 17:12 /usr/local/bin/python3 -> /usr/local/bin/python3.11

The error is exec: python3: not found
After changing to
exec /usr/local/bin/python3 -m websockify "$@"
the error exec: python3: not found no longer appears. Also if the run file is executed directly without the addition of /usr/local/bin it gives python error messages about insufficient arguments. In the context of a service the $PATH does not include /usr/local/bin so can't find python3. I tested this by adding

clonos_vnc2wss_precmd()
{
        echo $PATH
        cbsd_workdir="/usr/jails"
...
# service clonos-vnc2wss start
/sbin:/bin:/usr/sbin:/usr/bin
Starting clonos_vnc2wss.
<!-- gh-comment-id:2562483683 --> @infostud commented on GitHub (Dec 26, 2024): Set up on new installation of 14.2-RELEASE. ``` ls -l /usr/local/bin/python3 lrwxr-xr-x 1 root wheel 25 Dec 25 17:12 /usr/local/bin/python3 -> /usr/local/bin/python3.11 ``` The error is `exec: python3: not found` After changing to `exec /usr/local/bin/python3 -m websockify "$@"` the error `exec: python3: not found` no longer appears. Also if the `run` file is executed directly without the addition of `/usr/local/bin` it gives python error messages about insufficient arguments. In the context of a `service` the `$PATH` does not include `/usr/local/bin` so can't find `python3`. I tested this by adding ``` clonos_vnc2wss_precmd() { echo $PATH cbsd_workdir="/usr/jails" ... # service clonos-vnc2wss start /sbin:/bin:/usr/sbin:/usr/bin Starting clonos_vnc2wss. ```
Author
Owner

@olevole commented on GitHub (Dec 26, 2024):

@infostud Hi, thanks for the reporting. I will double check the instructions soon, at the moment there is a lot of work on integrating the new translate framework into ClonOS and I checked ISO/memstich image only. We were forced to move away from the fixed release model to rolling due to the small amount of resources.

<!-- gh-comment-id:2562513064 --> @olevole commented on GitHub (Dec 26, 2024): @infostud Hi, thanks for the reporting. I will double check the instructions soon, at the moment there is a lot of work on integrating the new translate framework into ClonOS and I checked ISO/memstich image only. We were forced to move away from the fixed release model to rolling due to the small amount of resources.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/control-pane#41
No description provided.