[HowTo] Install a vnc server on the Raspberry pi

Thank you, I’ll try this, when the remote access is working again.
Surprisingly, after installing realvnc viewer, I had easy access at first. After a Raspi restart I always get only “time out”.
I already deactivated the service, stopped VNC, Updated VNC, started VNC and activated the VNC Service, however, from 2 different Windows machines I only get time out messages.
What might be wrong in my settings?

What happens when you do:

systemctl start dispmanx_vncserver.service

and then try to connect ?
Are you using a port? Check your /etc/dispmanx_vncserver.conf.

systemctl start dispmanx_vncserver.service

does not change anything. My " /etc/dispmanx_vncserver.conf" looks like the example given in Post 1.
I already tested port 5900 (instead of “0”) adding “:5900” to the IP in the VNC viewer, but the time out problem persists.

Could it be that the IP changed?

Thank you for the hint, but this is unlikely, nevertheless I have checked it.
Furthermore I use the same IP in putty for contacting my Raspi.

Well so check if the port is used

netstat -tulp

also no error shown when you run systemctl restart dispmanx_vncserver.service?
What is sudo journalctl saying?

1 Like

netstat -tulp shows for port 5900

tcp6 0 0 [::]:5900 [::]:* LISTEN

systemctl restart dispmanx_vncserver.service does not show any error message and
sudo journalctl gives the following information:

Aug 25 11:53:54 osmc sudo[4558]: osmc : TTY=pts/0 ; PWD=/home/osmc ; USER=root ; COMMAND=/bin/journalctl
Aug 25 11:53:54 osmc sudo[4558]: pam_unix(sudo:session): session opened for user root by osmc(uid=0)
lines 893-915/915 (END)
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: relative = false
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: screen = 0
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: unsafe = false
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: vnc-params =
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.656 [dmxvnc] Open display[0]…
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.656 [dmxvnc] ModeInfo: 1920, 1080, 0, 0
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.695 [dmxvnc] Server bpp: 16
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: Server bigEndian: 0
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: Server redShift: 0
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: Server blueShift: 10
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: Server greeShift: 5
Aug 25 11:52:41 osmc kernel: input: VNCServer Mouse as /devices/virtual/input/input8
Aug 25 11:52:41 osmc kernel: input: VNCServer Keyboard as /devices/virtual/input/input9
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.696 [libvnc] Listening for VNC connections on TCP port 5900
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.696 [libvnc] Listening for VNC connections on TCP6 port 5900
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.696 [dmxvnc] open /dev/uinput returned 6
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.696 [dmxvnc] First write returned 1116
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.697 [dmxvnc] ioctl UI_DEV_CREATE returned 0
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.697 [dmxvnc] open /dev/uinput returned 7
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.697 [dmxvnc] First write returned 1116
Aug 25 11:52:41 osmc dispmanx_vncserver[4548]: 2020-08-25 11:52:41.698 [dmxvnc] ioctl UI_DEV_CREATE returned 0
Aug 25 11:53:54 osmc sudo[4558]: osmc : TTY=pts/0 ; PWD=/home/osmc ; USER=root ; COMMAND=/bin/journalctl
Aug 25 11:53:54 osmc sudo[4558]: pam_unix(sudo:session): session opened for user root by osmc(uid=0)

However, having executed the steps you mentioned, a next attempt with the VNC viever was successful :astonished:.
But the remote screen permanently changes between a short look at Kodi and the message that the connection to the VNC server will be re-established
and

RFB protocol error: bad xrle data

… whatever the last message might mean…

Apart from this strange message, which was shown for about 30-60 seconds, the remote connection is currently working. I hope this will be stable for the next time.
Thanks a lot for your help.

You probably have your display settings to max. Set your picture quality to Low…that’s the fastest option…i know it doesnt look good…but the higher the quality the more pressure you put on the pi.
Here are my settings in VNC Viewer:

2

Thank you, this helps.
And the “low” quality is no real impairment, because the remote access is only used for control purposes and not for viewing pictures or films…

Why not use Yatse or the Webinterface for that?

To the best of my knowledge Yatse is mainly a remote control (I use Kore for this purpose) and the Webinterface (Kodi, as I assume) doesn’t give the same impression like the directly conneted monitor.
Thus, when I want to what is happening on Raspi’s screen, I need a local monitor or a remote view. If there is a Webinterface apart from the Kodi interface, I’m interrested to learn more about it and will try it.

Well seems different use cases, I would have assumed the TV is running when you use these options

Hi Markus.

Thank you for this tutorial. I followed every step and the installation seemed to be going as it should. Even managed to Start the GUI etc.

Now when I try to connect using TightVNC it tells me “No connection could be made because the target machine actively refused it” and when I try it using RealVNC I get “Timed out waiting for a response from the computer”. I tried with the suggested port number 5900 and with 0.

I’m a total noob when it comes to programming, but is there something I could do to check what might be going wrong here? Ay advice would be much appreciated.

Kind regards,

Charles

It seems to me that the server isnt running at all. Can you try to manually start it from the script option…and try again?

Hi Sandbird.

Thank you for your response. I just tried it using the command:

sudo ./osmc_vnc_install_cli.bash --start-vnc

I assume that’s what you meant? It just does the same as via the GUI. Nothing shows and VNC still gives me the same error. Is there a way to check if the server is even running?

Kind regards,

Charles

I am mostly a windows user so i kinda like to have a taskmanager kind of thing, which is why i installed ‘htop’ into my pi, that gives you a gui to look at your running processes. As you can see here my vnc server is running.

To install htop you do:
apt-get install htop or sudo apt-get install htop if you are not logged in with your root account.
After that just type: htop and check at your processes to see if vnc is running (you exit with F10).

What happens when you do?: systemctl start dispmanx_vncserver.service
(if you need a nice client to go through the files in your pi try: https://winscp.net)

While I also like htop I think a quicker check for this case is ps -aux | grep dispmanx that should show
osmc 7821 0.3 1.8 62584 13764 pts/0 Sl+ 19:40 0:00 /home/osmc/dispmanx_vncserver

1 Like

Thanks Sandbird and Fzinken.

So I tried this method first and this is what I get:

osmc 941 0.0 0.0 2204 608 pts/0 S+ 10:20 0:00 grep dispmanx

Not sure what that means, but it does not mention the server like yours :confused:

when I do

systemctl start dispmanx_vncserver.service

Nothing seems to happen.

Well let’s start one by one, run
which dispmanx_vncserver and share the output
ls -lah /usr/bin | paste-log and share the URL