Help with a systemd user service that works under v1.11.0+
Is your feature request related to a problem? Please describe.
Under v1.11.0+, I am unable to launch /usr/bin/vncserver via a user service.
Describe the solution you'd like
In the past, you provided a user service, for example see your 1.10 branch: https://github.com/TigerVNC/tigervnc/blob/1.10-branch/contrib/systemd/user/vncserver%40.service
Describe alternatives you've considered
I am able to run vncserver :2 for example on my system from the shell and everything works as expected. I am thinking this is hopeful that we can come up with a systemd user service to do the same. I tried modifying the older file, and it does run via systemctl --user start vncserver@:2 however, systemd times it out and kills it.
Additional context
Here is /usr/lib/systemd/user/vncserver@.service I tried:
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/bin/vncserver %i
PIDFile=/run/vncsession-%i.pid
[Install]
WantedBy=multi-user.target
Initially it runs but systemd kills it. Here is the output:
% systemctl --user status vncserver@:2.service
● vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/user/vncserver@.service; disabled; vendor preset: enabled)
Active: failed (Result: timeout) since Sat 2020-09-12 06:55:58 CDT; 45s ago
Process: 44321 ExecStart=/usr/bin/vncserver :2 (code=exited, status=1/FAILURE)
Sep 12 06:55:55 media lxqt-panel[44350]: The X11 connection broke: I/O error (code 1)
Sep 12 06:55:55 media vncserver[44350]: XIO: fatal IO error 4 (Interrupted system call) on X server ":2"
Sep 12 06:55:55 media vncserver[44350]: after 868 requests (755 known processed) with 0 events remaining.
Sep 12 06:55:56 media vncserver[44321]: xinit: unexpected signal 15
Sep 12 06:55:56 media systemd[469]: vncserver@:2.service: Control process exited, code=exited, status=1/FAILURE
Sep 12 06:55:56 media lxqt-panel[44350]: unable to write into socketpair: Bad file descriptor
Sep 12 06:55:57 media lxqt-session[44331]: lxqt-session: Module lxqt-panel.desktop won't terminate ... killing.
Sep 12 06:55:57 media lxqt-session[44331]: QProcess: Destroyed while process ("lxqt-panel") is still running.
Sep 12 06:55:58 media systemd[469]: vncserver@:2.service: Failed with result 'timeout'.
Sep 12 06:55:58 media systemd[469]: Failed to start Remote desktop service (VNC).
By contrast, I can run it from the shell and it runs fine. Note that I manually killed it via a ctrl+c after 12 minutes or so:
% vncserver :2
Using desktop session lxqt
New 'media:2 (facade)' desktop is media:2
Starting desktop session lxqt
Xvnc TigerVNC 1.11.0 - built Sep 11 2020 15:59:52
Copyright (C) 1999-2020 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12008000, The X.Org Foundation
Sat Sep 12 06:58:26 2020
vncext: VNC extension running!
vncext: Listening for VNC connections on local interface(s), port 5902
vncext: created VNC server for screen 0
xinit: XFree86_VT property unexpectedly has 0 items instead of 1
Running X session wrapper
Loading profile from /etc/profile
Loading xinit script /etc/X11/xinit/xinitrc.d/40-libcanberra-gtk-module.sh
Loading xinit script /etc/X11/xinit/xinitrc.d/50-systemd-user.sh
X session wrapper complete, running session startlxqt
isPrimaryInstance
no cached wallpaper. generate a new one!
New PolkitAgentListener 0x56008d3a8200
Adding new listener PolkitQt1::Agent::Listener(0x7ffe6be98aa0) for 0x56008d3a8200
size of original image QSize(1920, 1080)
QDBusMarshaller: cannot add an invalid QVariant
QDBusConnection: error: could not send message to service "org.freedesktop.login1" path "/org/freedesktop/login1" interface "org.freedesktop.login1.Manager" member "CanHibernate": Marshalling failed: Variant containing QVariant::Invalid passed in arguments
** Dbus error **************************
Error name "org.freedesktop.DBus.Error.Failed"
Error msg "Marshalling failed: Variant containing QVariant::Invalid passed in arguments"
****************************************
QDBusMarshaller: cannot add an invalid QVariant
QDBusConnection: error: could not send message to service "org.freedesktop.login1" path "/org/freedesktop/login1" interface "org.freedesktop.login1.Manager" member "CanSuspend": Marshalling failed: Variant containing QVariant::Invalid passed in arguments
** Dbus error **************************
Error name "org.freedesktop.DBus.Error.Failed"
Error msg "Marshalling failed: Variant containing QVariant::Invalid passed in arguments"
****************************************
QDBusMarshaller: cannot add an invalid QVariant
QDBusConnection: error: could not send message to service "org.freedesktop.login1" path "/org/freedesktop/login1" interface "org.freedesktop.login1.Manager" member "CanReboot": Marshalling failed: Variant containing QVariant::Invalid passed in arguments
** Dbus error **************************
Error name "org.freedesktop.DBus.Error.Failed"
Error msg "Marshalling failed: Variant containing QVariant::Invalid passed in arguments"
****************************************
QDBusMarshaller: cannot add an invalid QVariant
QDBusConnection: error: could not send message to service "org.freedesktop.login1" path "/org/freedesktop/login1" interface "org.freedesktop.login1.Manager" member "CanPowerOff": Marshalling failed: Variant containing QVariant::Invalid passed in arguments
** Dbus error **************************
Error name "org.freedesktop.DBus.Error.Failed"
Error msg "Marshalling failed: Variant containing QVariant::Invalid passed in arguments"
****************************************
WinIdChange e00008 handle QWidgetWindow(0x564658b8c5e0, name="LXQtPanel panel1Window") QScreen(0x56465894a230, name="VNC-0")
Systray started
()
[Notice] Started
Sat Sep 12 06:58:49 2020
Connections: accepted: 127.0.0.1::60906
SConnection: Client needs protocol version 3.8
SConnection: Client requests security type VeNCrypt(19)
SVeNCrypt: Client requests security type TLSVnc (258)
VNCSConnST: Server default pixel format depth 24 (32bpp) little-endian rgb888
Sat Sep 12 06:58:56 2020
VNCSConnST: closing 127.0.0.1::60906: Clean disconnection
EncodeManager: Framebuffer updates: 946
EncodeManager: Tight:
EncodeManager: Solid: 101 rects, 754.522 kpixels
EncodeManager: 1.57812 KiB (1:1868.38 ratio)
EncodeManager: Bitmap RLE: 27 rects, 26.869 kpixels
EncodeManager: 1.40723 KiB (1:74.8092 ratio)
EncodeManager: Indexed RLE: 959 rects, 1.51526 Mpixels
EncodeManager: 244.117 KiB (1:24.2925 ratio)
EncodeManager: Tight (JPEG):
EncodeManager: Full Colour: 165 rects, 1.71349 Mpixels
EncodeManager: 477.644 KiB (1:14.0173 ratio)
EncodeManager: Total: 1.252 krects, 4.01014 Mpixels
EncodeManager: 724.746 KiB (1:21.6342 ratio)
TLS: TLS session wasn't terminated gracefully
TcpSocket: unable to get peer name for socket
Connections: closed: ::0
ComparingUpdateTracker: 9.8537 Mpixels in / 480.778 kpixels out
ComparingUpdateTracker: (1:20.4953 ratio)
^Cxinit: connection to X server lost
waiting for X server to shut down The X11 connection broke (error 1). Did the X11 server die?
Sat Sep 12 07:10:50 2020
ComparingUpdateTracker: 0 pixels in / 0 pixels out
ComparingUpdateTracker: (1:-nan ratio)
The X11 connection broke: I/O error (code 1)
XIO: fatal IO error 2 (No such file or directory) on X server ":2"
after 1004 requests (832 known processed) with 0 events remaining.
xinit: unexpected signal 2
vncserver :2 4.84s user 1.49s system 0% cpu 12:24.56 total
facade@media ~ % lxqt-session: Module lxqt-panel.desktop won't terminate ... killing.
QProcess: Destroyed while process ("lxqt-panel") is still running.