[HowTo] Install a vnc server on the Raspberry pi

I haven’t tried myself so can not say if there is a problem with the script as all steps looked to work. So maybe it was just user problem.

This webpage has been a godsend for me for every installation of OSMC I have had and it has always worked perfectly until now.

I recently bought a Pi4 and have just installed the beta installation of OSMC for Pi4 and have been unable to get VNC to work.

Everything seems to install correctly but I cannot connect.

Connecting via SSH to my old Pi3 and running telnet 127.0.0.1 5900 shows that the service is running and I can connect locally, however, on the Pi4 running the same telnet command returns the following:

Trying 127.0.0.1…
telnet: Unable to connect to remote host: Connection refused

Short of this I don’t know what else to do to test that the service is working correctly. Checking services shows that openvpn is installed and running as a service.

Any help appreciated. If you would like me to do further tests/checks please ask. I’m not a novice at Linux but I’m in no way an expert so please be kind.

Thanks.

The Pi Videostack changed and this method will not work until a new VNCserver solution is used.

2 Likes

Thanks for the quick reply fzinken.

I’ll keep an eye on this thread for any future updates.

Peace.

Hopefully a solution can be found as need access pi4 screen from another room.

The following works for me.

in /boot/config.txt, change the line
dtoverlay=vc4-kms-v3d,cma-512
to
dtoverlay=vc4-fkms-v3d,cma-512

Set the resolution to maximum 1080p.

I have no idea if kms/fkms breaks anything else or e.g. affects performance. For higher resolutions than 1080p I fail to get a snapshot, and need to do a hard reboot to get it working again.

Didn’t work for me with change. Says connection refused.

Here is my config:

[pi4]
dtoverlay=rpivid-v4l2
arm_64bit=1
kernel=kernel.img

[all]
dtoverlay=vc4-fkms-v3d,cma-512
disable_overscan=1
start_x=1
disable_splash=1
disable_fw_kms_setup=1
include config-user.txt

Didn’t work for me with dtoverlay=vc4-fkms-v3d,cma-512. When run from the command line it fails:

osmc@osmc:~$ sudo /usr/bin/dispmanx_vncserver
2021-04-30 20:25:25.153 [dmxvnc] Trying to read configuration file: /etc/dispmanx_vncserver.conf
2021-04-30 20:25:25.154 [dmxvnc] Read config file: /etc/dispmanx_vncserver.conf
2021-04-30 20:25:25.155 [dmxvnc] Running vnc server with the following settings
	frame-rate = 15
	downscale = false
	fullscreen = false
	localhost = false
	multi-threaded = false
	password = ***
	port = 5900
	relative = false
	screen = 0
	unsafe = false
	vnc-params = 
2021-04-30 20:25:25.158 [dmxvnc] Open display[0]...
2021-04-30 20:25:25.159 [dmxvnc] Exception: vc_dispmanx_display_open failed

The Pi4 isn’t connected to a TV.

I now tried it all from the start, just to make sure I had not forgot about anything I did to make it work.

  • Flashed the OSMC_TGT_rbp4_20210414.img.gz image
  • Boot with hdmi connected (osmc did not seem to install without)
  • Wait for install
  • Followed Sandbird’s Step1 in the first post
  • “sudo ./dispmanx_vncserver” : resulted in “2021-05-01 07:51:28.109 [dmxvnc] Exception: vc_dispmanx_display_open failed”
  • Changed from vc4-kms-v3d to vc4-fkms-v3d in /boot/config.txt
  • Reboot
  • “sudo ./dispmanx_vncserver” : no error after “2021-05-01 07:58:15.735 [dmxvnc] Open display[0]…”
  • Connect with VNC client : dispmanx_vncserver throws error on snapshot: “2021-05-01 07:58:21.283 [dmxvnc] Caught exception: vc_dispmanx_snapshot failed”
  • The VNC client is stuck on connecting, no screen showing
  • Not possible to kill dispmanx_vncserver.
  • Recycled power
  • Changed resolution in osmc to 1080p
  • “sudo ./dispmanx_vncserver” : no errors
  • Connect with VNC client works

Also tried without a TV/monitor connected

  • Disconnect hdmi
  • Reboot
  • “sudo ./dispmanx_vncserver” : resulted in 2021-05-01 08:16:44.104 [dmxvnc] Exception: vc_dispmanx_display_open failed
  • added hdmi_force_hotplug=1 to /boot/config.txt
  • Reboot
  • “sudo ./dispmanx_vncserver” : ok
  • VNC client works, osmc limited to max 1024x768 (I have not been able to set any combination of hdmi_group and hdmi_mode to get a higher resolution yet)
1 Like

Can confirm this works

This is most likely the big question. But some quick test didn’t reveal issues.
Performance also looks good. Not sure what happens on 4k.

image

image
I have a few use cases where remote access is really practical. I will most likely use this config from time to time when needed, and do not recommend anyone to use this as a permanent solution. Unfortunately I have not been able to figure out how to get a snapshot of the display with the new drivers. I would be thankful if someone has some ideas how to replace dispmanx for the vnc server.

Sam can you describe why this shouldn’t be changed?

I haven’t looked in detail, but TigerVNC might be the way forward, as it seems to support DRM backends.

I think you should look into “DRM Writeback connector”, I did peek at it but it quickly went over my head.

@everyone anybody got tigervnc server to work on RPI4/osmc?
I will also miss having remote graphical access for the occasional remote configuration change
p.s. I’d rather not change the video driver

That is currently the only way to do it

my PI3 crashed (again) and I did a fresh installation. The first thing I usually install is vnc server so I don’t have to plug in a keyboard and mouse for the basic set up.

After installation - I can’t get the vnc server to start.

osmc@osmc:~$ service dispmanx_vncserver status
* dispmanx_vncserver.service - VNC Server
   Loaded: loaded (/etc/systemd/system/dispmanx_vncserver.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2021-08-30 18:27:23 UTC; 17s ago
  Process: 1586 ExecStartPre=/sbin/modprobe evdev (code=exited, status=0/SUCCESS)
  Process: 1587 ExecStart=/usr/bin/dispmanx_vncserver (code=exited, status=1/FAILURE)
 Main PID: 1587 (code=exited, status=1/FAILURE)

If I run it manually, this is what I get:

osmc@osmc:/usr/bin$ ./dispmanx_vncserver 
2021-08-30 18:37:45.986 [dmxvnc] Trying to read configuration file: /etc/dispmanx_vncserver.conf
2021-08-30 18:37:45.987 [dmxvnc] Read config file: /etc/dispmanx_vncserver.conf
2021-08-30 18:37:45.988 [dmxvnc] Running vnc server with the following settings
        frame-rate = 15
        downscale = false
        fullscreen = false
        localhost = false
        inetd = false
        multi-threaded = false
        once = false
        password = ***
        port = 5900
        relative = false
        screen = 0
        unsafe = false
        vnc-params = 
2021-08-30 18:37:45.992 [dmxvnc] Open display[0]...
2021-08-30 18:37:45.994 [dmxvnc] Exception: vc_dispmanx_display_open failed

I tried rebooting, removing and reinstalling.

Thanks in advance.

In the moment this is the only fix if you need VNC

Is this for RPi3 aswell or for RPi4 only?