control-pane icon indicating copy to clipboard operation
control-pane copied to clipboard

NoVNC python3 not found because no /usr/local/bin in $PATH for shell script started by `service`

Open infostud opened this issue 1 year ago • 3 comments

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.

infostud avatar Dec 26 '24 05:12 infostud

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

mergar avatar Dec 26 '24 10:12 mergar

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.

infostud avatar Dec 26 '24 11:12 infostud

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

olevole avatar Dec 26 '24 11:12 olevole