VNC display number auto increase on fail

Issues related to applications and software problems
Post Reply
Benik3
Posts: 6
Joined: 2019/04/10 13:38:56

VNC display number auto increase on fail

Post by Benik3 » 2019/08/21 07:24:34

Hello.

I pretty successfully get VNC working as service on my Centos 7 with multiple instances for different users.
But I found one problem. I need the display of specific user always on the same port, but when the service fail to start VNC, it automatically try next display number.
I found that this happen, when PC shut down without proper ending of VNC. Then there is left opened socket in /tmp/.X11-unix/X# (where # is number of the display). Even that I have

Code: Select all

ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
in the service, it doesn't remove the orphan socket.

So my 2 questions are:
1. Is there a way, how to properly remove orphan socket of VNC, when PC shut down without proper VNC turn off?
(except rm /tmp/.x11-unix/X%i)
2. Even if there will be this problem and VNC try to start, is possible to fail immediately without increasing automatically display number?

Thank you very much :)

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: VNC display number auto increase on fail

Post by TrevorH » 2019/08/21 09:39:09

1. Is there a way, how to properly remove orphan socket of VNC, when PC shut down without proper VNC turn off?
One way would be to enable the systemd tmp.mount and move /tmp to tmpfs so it's recreated each and every time you reboot.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Benik3
Posts: 6
Joined: 2019/04/10 13:38:56

Re: VNC display number auto increase on fail

Post by Benik3 » 2019/08/21 12:31:48

Interesting idea.

I though about some init.d script with just sudo rm /tmp/.x11-unix/* but I don't know if I can guarantee that the script will be run always before the services at boot time.
In theory I could simply delay for a while the VNC services at boot...

Benik3
Posts: 6
Joined: 2019/04/10 13:38:56

Re: VNC display number auto increase on fail

Post by Benik3 » 2019/12/10 14:52:11

Hello.

Back to this problem. I though that auto incrementing of the display number on a fail is a feature of TigerVNC, but after asking on tigervnc I found, that not.
It's only feature of CentOS (maybe also RHEL?) package. I confirmed this also by compiling my own TigerVNC server from source.

Does anyone know the reason for this behaviour? For me it's pretty dangerous function, because when you have multiple vncservers and you need them on specific port, this is able to crash/mix multiple of the displays if there is one blocked...

Thank you.

Post Reply