This guide explains how to setup a VNC server on your phone.
-display :0 to it or doing a
export DISPLAY=:0 before running it, assuming the display is at
Install, and start a server listening to any network interface on the phone:
$ sudo apk add wayvnc (1/3) Installing aml (0.2.1-r0) (2/3) Installing neatvnc (0.4.0-r0) (3/3) Installing wayvnc (0.4.1-r0) Executing busybox-1.35.0-r13.trigger OK: 971 MiB in 563 packages $ wayvnc 0.0.0.0
Or listen to
172.16.42.1 on port
$ wayvnc 172.16.42.1 9999
After a server setup, use a client, for example, to connect to the server
172.16.42.1:9999, and press :
Have fun with it.
XDG_RUNTIME_DIR not set in the environment
This happens when
XDG_RUNTIME_DIR is not set, usually in SSH sessions.
$ wayvnc 0.0.0.0 error: XDG_RUNTIME_DIR not set in the environment. ERROR: Failed to initialise wayland
Just set it with:
$ export XDG_RUNTIME_DIR=/run/user/10000
And start the server again.
Connection refused/timed out
But when connecting via Wi-Fi, you need to open the port.
If using port
5900, it's as simple as installing and restarting nftables:
# apk add postmarketos-config-nftables-vncserver (1/1) Installing postmarketos-config-nftables-vncserver (0.10-r0) Executing postmarketos-base-20-r0.trigger Configuring a getty on port ttyMSM0 with baud rate 115200 OK: 1006 MiB in 570 packages # service nftables restart * Stopping firewall ... [ ok ] * Loading nftables state and starting firewall ...
However, when connecting to a custom port like
9999, it requires to add a rule to accept the connection:
# nft add rule inet filter input iifname wlan0 tcp dport 9999 accept comment "Accept custom port over wifi"
No route to host
Check if the host even exists on the LAN.