[HowTo] Install a vnc server on the Raspberry pi

Btw, i got a multiboot with osmc and raspbian. You can do that with NOOBS now.

I keep getting an error after setting this up. My VNC viewer says “RFB protocol error: bad xrle data.” I’ve tried using a different viewer but I got the same message. I also tried rebooting and switching the skin in OSMC but neither of those worked. What’s strange is that the main OSMC page works fine but, when I click on something (like “system” for example) it goes to that page but the VNC viewer gives the error and then I can’t use VNC anymore. What should I do?

Try with these setting. Cant use best quality, since the pi cant handle it.

Why would dispmax server stop running on boot?

This is the config file:

relative = false;
port = 5900;
screen = 0;
unsafe = false;
fullscreen = false;
multi-threaded = false;
password = “‘password’”;
frame-rate = 23;
downscale = false;
localhost = false;
vnc-params = ‘""’;

Unit]
Description=VNC Server

[Service]
Restart=on-failure
RestartSec=30
Nice=15
User=root
Group=root
Type=simple
ExecStartPre=/sbin/modprobe evdev
ExecStart=/usr/bin/dispmanx_vncserver
KillMode=process

[Install]
WantedBy=multi-user.target" > "/etc/systemd/system/dispmanx_vncserver.service

The only way I get in to run is to do “sudo dispmanx_vncserver” from within the “/usr/bin/” folder.

When you do : sudo vi /etc/systemd/system/dispmanx_vncserver.service
From what you posted it looks like you are a missing a --> [ <---- infront of the Unit.
Should be:

[Unit]
Description=VNC Server

not

Unit]
Description=VNC Server

After you fix that (save), redo the:

sudo systemctl start dispmanx_vncserver.service
sudo systemctl enable dispmanx_vncserver.service
sudo systemctl daemon-reload

Unfortunately, I am still experiencing the same problem with it only starting manually even if I fix the typo.

I get this
dispmanx_vncserver.service - VNC Server
Loaded: loaded (/etc/systemd/system/dispmanx_vncserver.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2017-10-23 21:19:47 ACDT; 10s ago
Process: 7892 ExecStartPre=/sbin/modprobe evdev (code=exited, status=1/FAILURE)

when trying to run

sudo systemctl start dispmanx_vncserver.service

hmm, maybe something got messed up due to that missing [ on the first try.
Try this to be sure:

sudo systemctl stop dispmanx_vncserver.service
sudo systemctl disable dispmanx_vncserver.service
sudo rm /etc/systemd/system/dispmanx_vncserver.service
sudo systemctl daemon-reload
sudo systemctl reset-failed

Then do:

sudo modprobe evdev

Then redo the service setup steps under the ‘Now we’ll create the service file…’ part of the installation.

sudo systemctl enable dispmanx_vncserver.service

Failed to execute operation: Invalid argument

crap…i forgot the symlinks…ok, i’ll send you a message, we’ll take it from there.

Where are the symlinks?

i sent you a message check your messages in osmc oO

Anyone else getting connection refused on latest stretch update?

hmm, no everything is fine. Check your config file maybe? Is it still intact ? Maybe the service was removed somehow ?

well i changed a setting awhile back to keep the vnc window alive even when kodi is closed so can view the x11 desktop. Does this look ok

[Unit]
Description=VNC Server
After=network-online.target
Requires=network-online.target

#[Unit]
#Description=VNC Server
#After=network-online.target mediacenter.service
#Requires=mediacenter.service

[Service]
Restart=on-failure
RestartSec=30
Nice=15
User=root
Group=root
Type=simple
ExecStartPre=/sbin/modprobe evdev
ExecStart=/usr/bin/dispmanx_vncserver
KillMode=process

[Install]
WantedBy=multi-user.target

yeah looks fine.
I know if it might sound stupid asking this but

  • You sure the local ip of the pi hasn’t changed and you are trying to connect to the wrong ip?
  • Is the server running for sure ?
  • when you manually start the server can you connect ?

Yes I am. Did you get your VNC working correctly?

Not yet. Are you also getting the connection refused error?

Yes. I am trying to reinstall the VNC server with no luck yet.

Let me know if the reinstall works for you cheers

I was able to get it working.

I re-made the program by following the beginning part of the post.

cd /home/osmc
sudo wget https://github.com/patrikolausson/dispmanx_vnc/archive/master.zip
unzip master.zip -d  /home/osmc/
rm master.zip
cd dispmanx_vnc-master
make
sudo cp dispmanx_vncserver /usr/bin
sudo chmod +x /usr/bin/dispmanx_vncserver

I then stopped the service, disabled it and then restarted and enabled the service

sudo systemctl stop dispmanx_vncserver.service
sudo systemctl disable dispmanx_vncserver.service
sudo systemctl daemon-reload

sudo systemctl start dispmanx_vncserver.service
sudo systemctl enable dispmanx_vncserver.service
sudo systemctl daemon-reload

I hope these instructions are accurate enough for you to get yours working.

1 Like