Setting up a VNC connection on a Raspberry Pi

Hello everyone,

I’ve been trying to setup a VNC connection on a Raspberry Pi 3 to access it remotely from my laptop. I’ve been following openSUSE’s documentation in here, but I’ve still been unsuccessful. I have a Leap 15.1 installed on my laptop and a Leap 15.1 (XFCE) aarch64 on my Rasp. Pi. As far as I understand, if I want a one-time session, I have to enable this session in YaST > Network Services > Remote Administration (VNC) on the host side (i.e. my Rasp. Pi). This way I enabled the Allow Remote Administration Without Session Management and ticked the Open Port in Firewall option. Then I rebooted the Pi and checked out its IP address.

On my laptop side, I tried to connect the Rasp. Pi with Tiger VNC. This way I entered on the command line:


vncviewer 192.168.0.12::5901

And got the following output:


TigerVNC Viewer 64-bit v1.9.0
Copyright (C) 1999-2018 TigerVNC Team and many others (see README.rst)
See http://www.tigervnc.org for information on TigerVNC.

Mon Jul 15 21:12:45 2019
 DecodeManager: Detected 4 CPU core(s)
 DecodeManager: Creating 4 decoder thread(s)
 CConn:       connected to host 192.168.0.12 port 5901
 CConnection: Server supports RFB protocol version 3.8
 CConnection: Using RFB protocol version 3.8

Mon Jul 15 21:12:46 2019
 CConnection: Choosing security type VeNCrypt(19)
 CVeNCrypt:   Choosing security type X509None (260)

Mon Jul 15 21:27:09 2019
 CConn:       End of stream

I’ve tried to meddle with this and trying different things such as enabling vncserver on the Rasp. Pi but at this stage I realize I don’t know what I am doing. Any insights into this would be much appreciated.

I’ve explored this problem further and it seems I am able to connect but probably something with my configurations or hardware may be related. In summary I set my Leap 15.1 Rasberry Pi with the option “Allow Remote Administration Without Session Management” from YaST > Remote Administration (VNC) and rebooted it. From my laptop I ran vncviewer supplying my R. Pi’s local address with an option to print more output messages:

vncviewer -Log *:stderr:100 192.168.0.12:5901

I got the following output:


TigerVNC Viewer 64-bit v1.9.0
Copyright (C) 1999-2018 TigerVNC Team and many others (see README.rst)
See http://www.tigervnc.org for information on TigerVNC.

Wed Jul 17 14:45:04 2019
DecodeManager: Detected 4 CPU core(s)
DecodeManager: Creating 4 decoder thread(s)
TcpSocket:   Connecting to 192.168.0.12 [192.168.0.12] port 5901
CConn:       connected to host 192.168.0.12 port 5901
CConnection: reading protocol version
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8

Wed Jul 17 14:45:05 2019
CConnection: processing security types message
CConnection: Server offers security type VeNCrypt(19)
CConnection: Server offers security type None(1)
CConnection: Choosing security type None(1)
CConnection: processing security message
CConnection: processing security result message
CConnection: processing security result message
CConnection: Authentication success!
CConnection: reading server initialisation
CConnection: initialisation done
Viewport:    No key mapping for key LVL3
Viewport:    No key mapping for key HNGL
Viewport:    No key mapping for key MDSW
Viewport:    No key mapping for key ALT
Viewport:    No key mapping for key META
Viewport:    No key mapping for key SUPR
Viewport:    No key mapping for key HYPR
Viewport:    No key mapping for key I248
Viewport:    No key mapping for key I249
Viewport:    No key mapping for key I250
Viewport:    No key mapping for key I251
Viewport:    No key mapping for key I252
Viewport:    No key mapping for key I253
Viewport:    No key mapping for key I254
PlatformPixelBuffer: Using shared memory XImage
CConn:       Using pixel format depth 24 (32bpp) little-endian rgb888
CConn:       Using Tight encoding
Viewport:    Got server LED state: 0x00000000
Viewport:    Inserting fake NumLock to get in sync with server
Viewport:    Key pressed: 0x0045 => XK_Num_Lock (0xff7f)
Viewport:    Key released: 0x0045 => XK_Num_Lock (0xff7f)
Viewport:    Inserting fake NumLock to get in sync with server
Viewport:    Key pressed: 0x0045 => XK_Num_Lock (0xff7f)
Viewport:    Key released: 0x0045 => XK_Num_Lock (0xff7f)
Viewport:    Got server LED state: 0x00000002
CConn:       Enabling continuous updates
Viewport:    Got server LED state: 0x00000000
DesktopWindow: Requesting framebuffer resize from 1024x768 to 1024x713
DesktopWindow: 1 screen(s)
1804289383 (0x6b8b4567): 1024x713+0+0 (flags
0x00000000)


Wed Jul 17 14:45:06 2019
Viewport:    Resizing framebuffer from 1024x768 to 1024x713
PlatformPixelBuffer: Using shared memory XImage
PlatformPixelBuffer: Freeing shared memory XImage
CConn:       End of stream
PlatformPixelBuffer: Freeing shared memory XImage

I see lots of messages regarding keyboard mappings. I tried to change keyboard layouts but it didn’t solve the issue. I also tried different resolutions with the geometry flag but without luck…

Sometimes I try using the Java (web browser) client when troubleshooting just to see if that connection behaves better.

Does look like something is terminating the session.

Maybe try connecting using X over ssh?
By default, if you have a running vnc server, you shouldn’t have to do anything special to do an X over ssh.

TSU

I have been reading the documentation closely and it seems there are several ways to setup a VNC connection. The steps I mentioned were regarding a one-shot session and honestly I still haven’t been able to figure out what’s wrong. However I tried to setup a manual permanent VNC session with success. I will update my original post with my configuration for someone struggling with the same issue.

I will still try to debug the one-shot connection further if I have enough time. I would love to know what’s wrong.

Well it seems I am no longer able to update my original post, so I’ll post my configuration to setup a manual permanent VNC session here.

In the server side:

  1. In this scenario the YaST Remote Administration module isn’t used, so I switched the option “Do Not Allow Remote Administration”, which is the default option (as in a fresh install).
  2. Check if the firewall is allowing the required services. Go to YaST > Firewall, select the public Zone and add the services tigervnc and tigervnc-https (if they aren’t already allowed).
  3. In the command line enter to initiate a VNC session
vncserver :1

If this is the first time, it will prompt to setup a password. If there is already a session running, kill it with

vncserver -kill :1

Then start a new session.

In the client side:

  1. Run the following:
vncviewer -SecurityTypes=TLSVnc IP_TO_HOST_SERVER:1

Note: Don’t forget to substitute IP_TO_HOST_SERVER with the actual IP :wink:
And that’s it!

P.S.
It may be useful to check out the following sources:
https://en.opensuse.org/VNC
https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.vnc.html