Hello, So I am using vncserver on a CentOS system from base repo. I have the systemd service enabled to start vncserver automatically on each boot.
I found out that vncserver is complaining about /tmp/.X11-unix/X1 socket file present almost each time shutdown is unclean due to freeze or power loss. The service I am using that comes from base repo package looks like following. File is meant to be copied over to /etc/systemd/system with <USER> substituted accordingly. [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=/usr/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 It seems this is doing the right thing, it is calling "vncserver -kill" on configured display each time before vncserver, but somehow that doesn't work and in the log I see: Jun 06 13:58:43 host runuser[1188]: pam_unix(runuser-l:session): session opened for user <myusername> by (uid=0) Jun 06 13:58:43 host runuser[1188]: Warning: host:1 is taken because of /tmp/.X11-unix/X1 Jun 06 13:58:43 host runuser[1188]: Remove this file if there is no X server host:1 Jun 06 13:58:43 host runuser[1188]: A VNC server is already running as :1 Jun 06 13:58:43 host runuser[1188]: Warning: host:1 is taken because of /tmp/.X11-unix/X1 Jun 06 13:58:43 host runuser[1188]: Remove this file if there is no X server host:1 Jun 06 13:58:46 host runuser[1188]: New 'host:2 (srakit)' desktop is host:2 Jun 06 13:58:46 host runuser[1188]: Starting applications specified in /home/<myusername>/.vnc/xstartup Jun 06 13:58:46 host runuser[1188]: Log file is /home/<myusername>/.vnc/host:2.log Jun 06 13:58:46 host runuser[1188]: pam_unix(runuser-l:session): session closed for user <myusername> Any idea what is happening here, maybe a race condition? If I restart the systemd service manually later it works, no problem. I don't know it /tmp/.X11-unix/X1 file exists immediately after an unsuccessful start, I always forget to check.
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel