1

Update:

I have solved the problem. I will share my experience here:

  • The new vncsession will fork and keep check status on the child
  • The child checks /home/$USER/.vnc/. Actually the main issue is with this folder. It seems this folder is created before, and SELinux context is different than vncsession. Remove the folder and re-create password.
  • Compile tigervnc following the RPM spec, remember that the RPM version uses prefix /usr but git version uses /usr/local.
  • Replace all perror with syslog(LOG_CRIT, ... to truly capture the error message.

The main issue is the forked process' errors are not reflected in either in journalct -t vncsession or journalctl -u vncserver@:$DISPLAY. You need to modify vncsession's source code to find out the root cause.

Original question:

I am working with TigerVNC on Fedora 33. The latest update on TigerVNC switches from vncserver to vncsession. Systemd unit file is updated to reflect the latest change. However, I cannot start VNC with the latest systemd unit file and I am debugging it. The service runs properly (I add -x to the wrapper bash code to see if the vncsession was called properly) and then service turns inactive.

The basic structure of the unit file is:

Type=forking
ExecStart=/.../vncsession-start DISPLAY

The vncsession-start is actually a wrapper:

...
exec /.../vncsession USER DISPLAY

The problem is when I systemctl start the service, it ends without error (only main PID is listed and ExitCode=0). But I run it in two other ways:

  • run directly from bash: it runs, Xvnc launches
  • modify unit file to ExecStart=/bin/bash -cx 'strace -f vncsession USER DISPLAY' and change Type=simple: Xvnc also launches

The first try is to rule out wrong vnc configurations; the second is to check SELinux setup.

The Type=forking handles fork() syscall, according to doc. I checked vncsession with strace, what I see is:

  • bash exec vncsession
  • vncsession calls clone(), not fork()
  • vncsession then calls execev() to launch Xvnc

So my question is: what is the 1) proper Type= for this case, is forking the right choice? 2) how to debug this type of problem?

Thank you!

2
  • My goodness! TigerVNC has got worse since 2018 and unix.stackexchange.com/q/472190/5132 . It's a whole mess of new compulsory unnecessary dæmonization, new rickety and dangerous PID files, and new "users" files now. And all that in the name of introducing systemd support. Commented Oct 16, 2020 at 12:54
  • Sigh, preliminary debugging shows the PID file contains wrong PID. Commented Oct 16, 2020 at 14:18

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.