There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

Can anyone give some advice on setting up a VNC server on boot with Ubuntu Mate?

I’ve been struggling with getting a completely self-sustaining VNC server working on Ubuntu mate, and I’d like some advice from anyone who has been down this road before. My target platform is Ubuntu Mate, and it is a combination of VM’s and old laptops that may still have local sessions. I’ve landed on TigerVNC due to dynamic resolution support (to eventually pair with apache Guacamole), and specifically do NOT want to use x0vncserver as I want this to be separate from the local session should one exist on the laptops.

Ideally, this would be a systemd service for a couple of users. To the best I can tell, I would need a different systemd unit file per user account, which is fine (it’d be easy enough to create a mapping for user to session across systems; when you start a session my user could always be display 10 at 5910 and my wife’s could be 11 at 5911, etc). I have seen a LOT of struggle with this, particularly in recent ubuntu, because of some changes. Specifically, this cannot be a user systemd service as those do not run until the user logs in, and I want these started at boot. I’ve followed these guides below:

bytexd.com/how-to-install-configure-vnc-server-on…superuser.com/a/1724271

At this time, my systemd unit looks like this:

/etc/systemd/system/vncserver.service


<span style="color:#323232;">[Unit]
</span><span style="color:#323232;">Description=TigerVNC Server
</span><span style="color:#323232;">After=syslog.target network.target
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Service]
</span><span style="color:#323232;">Type=simple
</span><span style="color:#323232;">User=surfrock66
</span><span style="color:#323232;">Group=surfrock66
</span><span style="color:#323232;">
</span><span style="color:#323232;">WorkingDirectory=/home/surfrock66
</span><span style="color:#323232;">PIDFile=/home/surfrock66/.vnc/%H%i.pid
</span><span style="color:#323232;">
</span><span style="color:#323232;">ExecStartPre=-/usr/bin/vncserver -kill :%i
</span><span style="color:#323232;">ExecStart=/usr/bin/vncserver -localhost no :%i
</span><span style="color:#323232;">ExecStop=/usr/bin/vncserver -kill :%i
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Install]
</span><span style="color:#323232;">WantedBy=multi-user.target
</span>

At this time, my xstartup file looks like this:


<span style="color:#323232;">#!/bin/sh
</span><span style="color:#323232;">unset DBUS_SESSION_BUS_ADDRESS
</span><span style="color:#323232;">[ -x /etc/vnc/xstartup ] &amp;&amp; exec /etc/vnc/xstartup
</span><span style="color:#323232;">[ -r $HOME/.Xresources ] &amp;&amp; xrdb $HOME/.Xresources
</span><span style="color:#323232;">xsetroot -solid grey 
</span><span style="color:#323232;">vncconfig -iconic &amp;
</span><span style="color:#323232;">x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &amp;
</span><span style="color:#323232;">x-window-manager &amp;
</span><span style="color:#323232;">/usr/bin/mate-session 
</span>

This works when my user launches the vncserver from the terminal, but when launching from a systemd service, it fails to start. I believe this is somehow due to user environment variables not being set; I’ve seen some guides recommending running the execStart commands as "su -l surfrock66 " to force the user’s environment, but I have nothing to support that. Here’s the front of the log file for the systemd service when I try to start it:


<span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com vncserver[12983]: New Xtigervnc server 'hostname.subdomain.domain.com:1 (surfrock66)' on port 5901 for display :1.
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com vncserver[12983]: Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /tmp/tigervnc.WITIzx/passwd hostname.subdomain.domain.com:1 to connect to the VNC server.
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activating service name='org.a11y.Bus' requested by ':1.0' (uid=1000 pid=12995 comm="x-window-manager")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Successfully activated service 'org.a11y.Bus'
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activating service name='org.freedesktop.systemd1' requested by ':1.4' (uid=1000 pid=12996 comm="/usr/bin/mate-session")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com org.a11y.Bus[13008]: dbus-daemon[13008]: Activating service name='org.a11y.atspi.Registry' requested by ':1.0' (uid=1000 pid=12995 comm="x-window-manager")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com org.a11y.Bus[13008]: dbus-daemon[13008]: Successfully activated service 'org.a11y.atspi.Registry'
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com org.a11y.Bus[13024]: SpiRegistry daemon is running with well-known name - org.a11y.atspi.Registry
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activating service name='org.freedesktop.systemd1' requested by ':1.5' (uid=1000 pid=12996 comm="/usr/bin/mate-session")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activating service name='org.freedesktop.systemd1' requested by ':1.5' (uid=1000 pid=12996 comm="/usr/bin/mate-session")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activating service name='org.freedesktop.systemd1' requested by ':1.5' (uid=1000 pid=12996 comm="/usr/bin/mate-session")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activating service name='ca.desrt.dconf' requested by ':1.5' (uid=1000 pid=12996 comm="/usr/bin/mate-session")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Successfully activated service 'ca.desrt.dconf'
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activating service name='org.freedesktop.systemd1' requested by ':1.5' (uid=1000 pid=12996 comm="/usr/bin/mate-session")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activating service name='org.freedesktop.systemd1' requested by ':1.5' (uid=1000 pid=12996 comm="/usr/bin/mate-session")
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com dbus-daemon[13000]: [session uid=1000 pid=12998] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com mate-session[12996]: WARNING: Could not parse desktop file /home/surfrock66/.config/autostart/wicd-tray.desktop: Key file does not have key “Name” in group “Desktop Entry”
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com mate-session[12996]: GLib-GObject-CRITICAL: Custom constructor for class GsmAutostartApp returned NULL (which is invalid). Please use GInitable instead.
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com mate-session[12996]: WARNING: could not read /home/surfrock66/.config/autostart/wicd-tray.desktop
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com mate-session[12996]: WARNING: Unable to find provider 'marco-compton' of required component 'windowmanager'
</span><span style="color:#323232;">Oct 17 15:58:11 hostname.subdomain.domain.com mate-session[12996]: WARNING: Unable to find provider '' of required component 'dock'
</span>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines