Good day
I'm running RHEL 7.6 with kernel version 3.10.0-514.el7.x86_64.
Vncserver version is tigervnc-server-1.8.0-17.el7.x86_64.
My vncserver@:1.service file looks like this, I have replaced <user>
whith a valid user.
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l <user> -c "/usr/bin/vncserver %i"
PIDFile=/home/<user>/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
When I execute the command systemctl start vncserver@:1
I get the followin error
Job for vncserver@:1.service failed because a configured resource
limit was exceeded. See "systemctl status vncserver@:1.service" and
"journalctl -xe" for details.
systemctl status vncserver@:1 shows this
Oct 01 09:05:21 systemd[1]: Starting Remote desktop
service (VNC)…Oct 01 09:05:24 host_name systemd[1]: Can't open
PID file /home/user/.vnc/host_name:1.pid (yet?) after start: No
such file or directoryOct 01 09:05:24 host_name systemd[1]: Failed
to start Remote desktop service (VNC).Oct 01 09:05:24 host_name systemd[1]: Unit vncserver@:1.service entered > failed state.
Oct 01 09:05:24 host_name systemd[1]: vncserver@:1.service failed.
Every time I execute systemctl start vncserver@:1 the N increase host_name:N.pid file in /home/user/.vnc it should stay at 1.
My xstartup file in the .vnc directory looks like this.
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/etc/X11/xinit/xinitrc
# Assume either Gnome or KDE will be started by default when installed
# We want to kill the session automatically in this case when user logs out. In case you modify
# /etc/X11/xinit/Xclients or ~/.Xclients yourself to achieve a different result, then you should
# be responsible to modify below code to avoid that your session will be automatically killed
if [ -e /usr/bin/gnome-session -o -e /usr/bin/startkde ];
then
vncserver -kill $DISPLAY
fi
I have disabled my firewall and put seLinux in Permissive mode still the same error, however I have created a vncserver@:13.service file for root wich starts with no problem.
Any help will be greatly appreciated
Regards
Best Answer
I had the same issue on a centos-release-7-7.1908.0.el7.centos.x86_64 with 3.10.0-1062.4.3.el7.x86_64 kernel, exact same setup and configuration.
I noticed via journalctl -xe an error generated during startup phase of the service while trying to access the /tmp/.X11-unix/X59 file (my VNC is setup to run on port 5959). After manually deleting it, the service got regularly back on track.