Tigervnc server deactivates immediately when run through systemd but works when run manually

Hello, I’m having some trouble trying to get tigervnc to start using systemd.

I’ve copied the systemd unit file like so:

sudo cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

I haven’t modified the unit file from the default:

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target systemd-user-sessions.service

[Service]
Type=forking
ExecStartPre=+/usr/libexec/vncsession-restore %i
ExecStart=/usr/libexec/vncsession-start %i
PIDFile=/run/vncsession-%i.pid
SELinuxContext=system_u:system_r:vnc_session_t:s0

[Install]
WantedBy=multi-user.target

I’ve added my user into /etc/tigervnc/vncserver.users

My ~/.vnc/config looks like this:

session=gnome
geometry=2000x1200
securitytypes=vncauth,tlsvnc
localhost=0
alwaysshared

I’ve got my password set up.

When I run sudo systemctl start vncserver@:1 it returns without printing anything to stdout/stderr and has a 0 return code. I can see the following in journalctl -u vncserver:

Jun 12 07:20:13 fedora systemd[1]: Starting vncserver@:1.service - Remote desktop service (VNC)...
Jun 12 07:20:13 fedora systemd[1]: Started vncserver@:1.service - Remote desktop service (VNC).
Jun 12 07:20:13 fedora systemd[1]: vncserver@:1.service: Deactivated successfully.

No log file is created in ~/.vnc when this happens.

Interestingly, when I manually run sudo /usr/libexec/vncsession-start :1 everything works correctly and I can connect to the VNC session.

I’m not sure how to track down the issue here because there is no log file and journalctl doesn’t provide much info, but it seems to be systemd related maybe?

The Fedora wiki is outdated and unconventional.
It works fine when configured using the upstream documentation:
I'm trying to run a remote desktop without monitor but i cannot find out how it works - #4 by vgaetera

1 Like

It does seem that the documentation is outdated and copying the unit file doesn’t seem to be necessary. However, this did not fix the issue for me and I still cannot launch the VNC server correctly through systemd.

Added remote-desktop, systemd, tigervnc

Check the output:

cat /etc/tigervnc/vncserver.users

Here it is

# TigerVNC User assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#
# :2=andrew
# :3=lisa
:1=jack
1 Like
rpm -q tigervnc-server gnome-session-xsession which
cat ~/.vnc/config; loginctl
systemctl status vncserver@:1.service
sudo ss -lnpt | grep -e vnc -e :5901