srepac / kvmd-armbian

KVMD For Armbian Install Script
171 stars 26 forks source link

kvmd-vnc: missing ustreamer python package #3

Open Suika opened 1 month ago

Suika commented 1 month ago

systemctl enable --now kvmd-vnc leads to:

systemd[1]: Started PiKVM - VNC to KVMD/Streamer proxy.
kvmd-vnc[19531]: Traceback (most recent call last):
kvmd-vnc[19531]:   File "/usr/bin/kvmd-vnc", line 5, in <module>
kvmd-vnc[19531]:     from kvmd.apps.vnc import main
kvmd-vnc[19531]:   File "/usr/lib/python3/dist-packages/kvmd/apps/vnc/__init__.py", line 24, in <module>
kvmd-vnc[19531]:     from ...clients.streamer import StreamFormats
kvmd-vnc[19531]:   File "/usr/lib/python3/dist-packages/kvmd/clients/streamer.py", line 32, in <module>
kvmd-vnc[19531]:     import ustreamer
kvmd-vnc[19531]: ModuleNotFoundError: No module named 'ustreamer'

The build-ustreamer() needs to be extended to also build the python package:

apt install python3-build
cd ustreamer/python
make
Suika commented 1 month ago

Trying to connect via VNC with encryption results in:

kvmd-vnc[47420]: Traceback (most recent call last):
kvmd-vnc[47420]:   File "/usr/lib/python3/dist-packages/kvmd/apps/vnc/rfb/__init__.py", line 118, in __wrapper
kvmd-vnc[47420]:     await coro
kvmd-vnc[47420]:   File "/usr/lib/python3/dist-packages/kvmd/apps/vnc/rfb/__init__.py", line 132, in __main_task_loop
kvmd-vnc[47420]:     await self.__handshake_security()
kvmd-vnc[47420]:   File "/usr/lib/python3/dist-packages/kvmd/apps/vnc/rfb/__init__.py", line 272, in __handshake_security
kvmd-vnc[47420]:     await handler()
kvmd-vnc[47420]:   File "/usr/lib/python3/dist-packages/kvmd/apps/vnc/rfb/__init__.py", line 325, in __handshake_security_vencrypt
kvmd-vnc[47420]:     ssl_context.load_cert_chain(self.__x509_cert_path, (self.__x509_key_path or None))
kvmd-vnc[47420]: PermissionError: [Errno 13] Permission denied

Easy fix, since it's all about vnc server certificate access problems: chown kvmd-vnc:kvmd-vnc -R /etc/kvmd/vnc

srepac commented 1 day ago

Does this actually work @Suika ? If so, then I can add those commands to the install as long as you request a PR.

srepac commented 1 day ago
#!/bin/bash
### Written by @srepac  09-06-2024
# https://github.com/srepac/kvmd-armbian/issues/3
# Address missing ustreamer python package for kvmd-vnc
###
build-vnc-support() {
  apt install python3-build -y

  cd /tmp; rm -rf ustreamer/
  git clone --depth=1 https://github.com/pikvm/ustreamer

  cd ustreamer/python
  make

  ### copy the created ustreamer dir and *.so file into correct location to support VNC ###
  cd root/usr/local/lib/python3.10/dist-packages/
  tar cf - * | ( cd /usr/lib/python3/dist-packages/; tar xf - )

  ### set proper ownership of /etc/kvmd/vnc directory and files/dirs within it
  chown kvmd-vnc:kvmd-vnc -R /etc/kvmd/vnc
} # end build-vnc-support

### MAIN STARTS HERE ###
systemctl stop kvmd

build-vnc-support

systemctl daemon-reload
systemctl enable kvmd-vnc
systemctl restart kvmd-vnc kvmd
Suika commented 1 day ago

To me it does with https://tigervnc.org/. Currently the remote system is off. image

The mentioned build and chown commands is how I got it running. Didn't touch any other parts.