vnc

TigerVnc server crash when client connect


[CLOSED]

Moved on https://raspberrypi.stackexchange.com/questions/138588/tigervnc-server-crash-when-client-connect

I've installed "tigervnc-standalone-server" on my raspberry pi 3 with Ubuntu Mate 20.04 (not raspbian), configure and set-up vncserver as system service.

My configuration:

hamham@astroloutre:~$ uname -a
Linux astroloutre 5.4.0-1066-raspi #76-Ubuntu SMP PREEMPT Mon Jun 27 11:04:02 UTC 2022 armv7l armv7l armv7l GNU/Linux

hamham@astroloutre:~$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:   focal

I've edited file ~/.vnc/xstartup like this :

#!/bin/sh

# Start up the standard system desktop
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

/usr/bin/mate-session

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
x-window-manager &

And configure /etc/systemd/system/vncserver@.service like this:

[Unit]
Description=Start TigerVNC server at startup
After=syslog.target network.target

[Service]
Type=forking
User=hamham
Group=hamham
WorkingDirectory=/home/hamham

PIDFile=/home/hamham/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 16 -pixelformat rgb565 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target

then enable like this :

sudo systemctl daemon-reload
sudo systemctl enable vncserver@1.service

After each restart, vncserver is running :

hamham@astroloutre:~$ sudo systemctl status vncserver@1
● vncserver@1.service - Start TigerVNC server at startup
     Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-08-04 16:24:53 CEST; 6h ago
# etc...
# at the end, i have theses warning:
août 04 23:35:10 astroloutre dbus-daemon[1446]: [session uid=1000 pid=1440] Successfully activated service 'org.gnome.evolution.dataserver.Sources5'
août 04 23:35:10 astroloutre brisk-menu[2025]: gdk_window_get_origin: assertion 'GDK_IS_WINDOW (window)' failed
août 04 23:35:10 astroloutre brisk-menu[2025]: gdk_window_get_origin: assertion 'GDK_IS_WINDOW (window)' failed
août 04 23:35:10 astroloutre brisk-menu[2025]: Negative content width -10 (allocation 1, extents 5x6) while allocating gadget (node button, owner GtkToggleButton)

hamham@astroloutre:~$ vncserver -list
TigerVNC server sessions:
X DISPLAY # RFB PORT #  PROCESS ID
:1      5901        1202

Server-side all seems to be OK.

Desktop size, on my smartphone (not laptop), i'm trying to connect with RealVNC client,i put 192.168.1.5:5901 as address, add password, try to connect and got message : The connection closed unexpectedly And server side in log file ~/.vnc/astroloutre:1.log :

Thu Aug  4 23:39:38 2022
 Connections: accepted: 192.168.1.22::46190
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type VncAuth(2)
terminate called after throwing an instance of 'rdr::Exception'
terminate called recursively
(EE) 
(EE) Backtrace:
(EE) 
(EE) 
Fatal server error:
(EE) Caught signal 6 (Aborted). Server aborting
(EE) 
Gdk-Message: 23:39:50.471: blueman-tray: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Gdk-Message: 23:39:50.471: evolution-alarm-notify: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Gdk-Message: 23:39:50.471: mate-maximus: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Gdk-Message: 23:39:50.476: blueman-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Gdk-Message: 23:39:50.472: mate-screensaver: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Gdk-Message: 23:39:50.472: nm-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

X connection to :1 broken (explicit kill or server shutdown).
Gdk-Message: 23:39:50.483: caja: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Gdk-Message: 23:39:50.484: marco: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Gdk-Message: 23:39:50.486: mate-settings-daemon: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Gdk-Message: 23:39:50.488: mate-session: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

(process:2184): GLib-GObject-CRITICAL **: 23:39:51.410: g_object_ref: assertion 'old_val > 0' failed

I don't understand what's the problem. Is it the line ExecStart ? using -geometry 1280x800 instead of -pixelformat rgb565 ? Or a password problem ? if i put good, wrong or no password, same problem.

Maybe useless, but i've granted access on 5901 port with iptables

Sources :

https://bytexd.com/how-to-install-configure-vnc-server-on-ubuntu/ https://pimylifeup.com/raspberry-pi-vnc-server/

Thank you for help.


Solution

  • I've answered this in the comments on bytexd.com, but leaving an answer here as well, for posterity.

    Everything looks good, except for one small detail.

    The only issue is that TigerVNC expects connections only from localhost, so you have to establish an SSH tunnel between the device you connect from.

    Either that, or set the vncserver to allow connections from other hosts other than localhost. To do this you just edit your /etc/systemd/system/vncserver@.service and change:

    ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost :%i
    

    to

    ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost no :%i
    

    The no in -localhost no is the difference. It should work after this.

    The secure option would be to establish an SSH tunnel from your phone, but I haven't tried that yet to be able to provide you with a solution.

    Demo screenshot: enter image description here