Is it possible to start vncserver automatically at boot time?

104 views
Skip to first unread message

torsten

unread,
May 10, 2018, 5:02:46 PM5/10/18
to TurboVNC User Discussion/Support
Hi,

I tried to start "/opt/TurboVNC/bin/vncserver" automatically at boot time by a systemd unit (OS is Ubuntu 16.04). I used these instructions:


This is the content of my service unit file:

[Unit]
Description=TurboVNC-Server

[Service]
Type=simple
User=torsten
Group=users
WorkingDirectory=~
ExecStart=/opt/TurboVNC/bin/vncserver

[Install]
WantedBy=multi-user.target

When I start "/opt/TurboVNC/bin/vncserver" manually, "/opt/TurboVNC/bin/vncserver -list" writes this:

TurboVNC server sessions:

X DISPLAY #     PROCESS ID
:1              14184

The displayed process id represents the Xvnc process created by vncserver, which is the X server used to display the TurboVNC session.

When I kill this server using "/opt/TurboVNC/bin/vncserver -kill :1" and start the above service unit using systemctl, "/opt/TurboVNC/bin/vncserver -list" writes the same (only the prosess id differs), but a process with the new process id doesn't exist (and the TurboVNC Viewer fails to connect). I compared the log files written by both vncserver calls. They are completely identical (only the time stamps differ). So where is the Xvnc process gone when started through systemd? Is there a way to get more log file content, that could tell me, why Xvnc won't run? If needed I can give some more detailed infos.

Kind Regards
Torsten

DRC

unread,
May 10, 2018, 11:20:18 PM5/10/18
to turbovn...@googlegroups.com
Edit /etc/sysconfig/tvncservers and specify the TurboVNC Server
instances you want to start, as well as their associated display
numbers, user accounts, and command-line arguments. Then do

sudo systemctl enable tvncserver
sudo systemctl start tvncserver

torsten

unread,
May 12, 2018, 8:41:01 AM5/12/18
to TurboVNC User Discussion/Support
Hi DRC,

I did this. And once (before rebooting) it worked. But after reboot it doesn't work anymore. Also the manual start by "sudo systemctl start tvncserver" doesn't work now (it did before rebooting!). "/opt/TurboVNC/bin/vncserver -list" displays no X display and no process id. There is no Xvnc process too. Only the start by "/opt/TurboVNC/bin/vncserver" works as before.

Could you say, what I'm doing wrong?

Kind Regards
Torsten

DRC

unread,
May 12, 2018, 9:04:34 AM5/12/18
to turbovn...@googlegroups.com
I have no idea. I just tried it with an Ubuntu 16 virtual machine, and
it worked.

On 5/12/18 7:41 AM, torsten wrote:
> Hi DRC,
>
> I did this. And once (before rebooting) it worked. But after reboot it
> doesn't work anymore. Also the manual start by "sudo systemctl start
> tvncserver" doesn't work now (it did before rebooting!).
> "/opt/TurboVNC/bin/vncserver -list" displays no X display and no process
> id. There is no Xvnc process too. Only the start by
> "/opt/TurboVNC/bin/vncserver" works as before.
>
> Could you say, what I'm doing wrong?
>
> Kind Regards
> Torsten
>
> Am Freitag, 11. Mai 2018 05:20:18 UTC+2 schrieb DRC:
>
> Edit /etc/sysconfig/tvncservers and specify the TurboVNC Server
> instances you want to start, as well as their associated display
> numbers, user accounts, and command-line arguments.  Then do
>
> sudo systemctl enable tvncserver
> sudo systemctl start tvncserver
>
> On 5/10/18 4:02 PM, torsten wrote:
> > Hi,
> >
> > I tried to start "/opt/TurboVNC/bin/vncserver" automatically at boot
> > time by a systemd unit (OS is Ubuntu 16.04). I used these
> instructions:
> >
> > https://wiki.ubuntuusers.de/systemd/Units/
> <https://wiki.ubuntuusers.de/systemd/Units/>
> > https://wiki.ubuntuusers.de/systemd/Service_Units/
> <https://wiki.ubuntuusers.de/systemd/Service_Units/>
> > https://wiki.ubuntuusers.de/systemd/systemctl/
> --
> You received this message because you are subscribed to the Google
> Groups "TurboVNC User Discussion/Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to turbovnc-user...@googlegroups.com
> <mailto:turbovnc-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/turbovnc-users/75c26c8e-1a6b-4913-959b-1b6943f74d7a%40googlegroups.com
> <https://groups.google.com/d/msgid/turbovnc-users/75c26c8e-1a6b-4913-959b-1b6943f74d7a%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

torsten

unread,
May 12, 2018, 10:01:58 AM5/12/18
to TurboVNC User Discussion/Support
Hi,

here ist what "sudo systemctl status tvncserver" writes:

● tvncserver.service - LSB: Starts and stops the TurboVNC Server
   Loaded: loaded (/etc/init.d/tvncserver; bad; vendor preset: enabled)
   Active: active (exited) since Sa 2018-05-12 13:55:43 CEST; 1h 26min ago
     Docs: man:systemd-sysv-generator(8)

Mai 12 13:55:43 ws-torsten systemd[1]: Starting LSB: Starts and stops the TurboVNC Server...
Mai 12 13:55:43 ws-torsten tvncserver[878]: Starting TurboVNC server: 1:torsten  * [FAILED]
Mai 12 13:55:43 ws-torsten systemd[1]: Started LSB: Starts and stops the TurboVNC Server.
Mai 12 14:03:26 ws-torsten systemd[1]: Started LSB: Starts and stops the TurboVNC Server.
Mai 12 14:05:15 ws-torsten systemd[1]: Started LSB: Starts and stops the TurboVNC Server.
Mai 12 14:08:23 ws-torsten systemd[1]: Started LSB: Starts and stops the TurboVNC Server.
Mai 12 14:19:08 ws-torsten systemd[1]: Started LSB: Starts and stops the TurboVNC Server.
Mai 12 14:26:19 ws-torsten systemd[1]: Started LSB: Starts and stops the TurboVNC Server.
Mai 12 14:29:24 ws-torsten systemd[1]: Started LSB: Starts and stops the TurboVNC Server.

The line with "[FAILED]" appeared directly after the reboot. All subsequent lines followed when trying a manual start through systemctl. Are there any log files or other sources giving infos, why it's failing? I googled this issue without any success.

torsten

unread,
May 12, 2018, 10:30:12 AM5/12/18
to TurboVNC User Discussion/Support
Hi again,

I just rebooted a second time, and now "sudo systemctl status tvncserver" writes something other:

● tvncserver.service - LSB: Starts and stops the TurboVNC Server
   Loaded: loaded (/etc/init.d/tvncserver; bad; vendor preset: enabled)
   Active: active (exited) since Sa 2018-05-12 16:12:09 CEST; 1min 27s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 956 ExecStart=/etc/init.d/tvncserver start (code=exited, status=0/SUCCESS)

Mai 12 16:12:09 ws-torsten systemd[1]: Starting LSB: Starts and stops the TurboVNC Server...
Mai 12 16:12:09 ws-torsten su[1109]: No passwd entry for user 'torsten'
Mai 12 16:12:09 ws-torsten su[1109]: FAILED su for torsten by root
Mai 12 16:12:09 ws-torsten su[1109]: - ??? root:torsten
Mai 12 16:12:09 ws-torsten tvncserver[956]: Starting TurboVNC server: 1:torsten  * [FAILED]
Mai 12 16:12:09 ws-torsten systemd[1]: Started LSB: Starts and stops the TurboVNC Server.

I configured a password when installing TurboVNC on the host and thought, that this will be used by the start by systemd too. How do I have to configure the password now?

Kind Regards
Torsten

torsten

unread,
May 12, 2018, 12:25:20 PM5/12/18
to TurboVNC User Discussion/Support
Hi,

I just read, that my entry in /etc/passwd must be missing. And that's right, there isn't any line with "torsten" in /etc/passwd. But I'm a legal user and actually logged in on that host. When I try "sudo adduser torsten", I get this:

adduser: Der Benutzer »torsten« existiert bereits.

In English: "adduser: The user »torsten« already exists." What goes wrong here?

Kind Regards
Torsten

DRC

unread,
May 12, 2018, 4:28:34 PM5/12/18
to turbovn...@googlegroups.com

No clue, unless maybe you are using some sort of network login such as LDAP.

--
You received this message because you are subscribed to the Google Groups "TurboVNC User Discussion/Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbovnc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/turbovnc-users/a1f6e28e-cd05-4bcb-aec4-349e13b95ab4%40googlegroups.com.

torsten

unread,
May 12, 2018, 5:30:12 PM5/12/18
to TurboVNC User Discussion/Support
Yes, indeed, on the host I login via LDAP. The owner - my employer - insists on doing so. So, what can I do now to get tvncserver starting at boot time?

DRC

unread,
May 12, 2018, 6:02:54 PM5/12/18
to turbovn...@googlegroups.com
Good question. I don't know if anyone has tried that with LDAP. My
guess would be that the problem is that the TurboVNC service is starting
prior to the LDAP service. If it were an init.d system, I could tell
you how to change the service order, but I'm not sure how to do that
with systemd. I would have to Google it, which you can do just as easily.
>> send an email to turbovnc-user...@googlegroups.com <javascript:>.
>> <https://groups.google.com/d/msgid/turbovnc-users/a1f6e28e-cd05-4bcb-aec4-349e13b95ab4%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "TurboVNC User Discussion/Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to turbovnc-user...@googlegroups.com
> <mailto:turbovnc-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/turbovnc-users/2c619e7f-1063-4a73-9c92-b847db5521ec%40googlegroups.com
> <https://groups.google.com/d/msgid/turbovnc-users/2c619e7f-1063-4a73-9c92-b847db5521ec%40googlegroups.com?utm_medium=email&utm_source=footer>.

torsten

unread,
May 13, 2018, 11:29:41 AM5/13/18
to TurboVNC User Discussion/Support
Hi DRC,

it works now! I did following changes:

In /etc/init.d/tvncserver I appended "nslcd" in one of the first lines:

# Required-Start: $syslog nslcd

nslcd is the LDAP connection daemon (see /etc/init.d/nslcd). So this change does the service order change you mentioned. Since systemd emulates the old init.d feature, this works for systemd too.

In /etc/sysconfig/tvncservers I have these lines:

VNCSERVERS="1:torsten"
VNCSERVERARGS[1]="-geometry 3290x1210 -nohttpd"

My TurboVNC server now starts both at boot time and by manual command "sudo systemctl start tvncserver".

If other users of TurboVNC don't run the LDAP daemon on their host, my change in /etc/init.d/tvncserver probably will have the opposite effect of my one. The TurboVNC server won't start anymore at boot time. So this change is recommended only for users logging in via LDAP. I don't know, how this can be differentiated in /etc/init.d/tvncserver.

Kind Regards
Torsten

DRC

unread,
May 13, 2018, 12:15:06 PM5/13/18
to turbovn...@googlegroups.com

Yeah, that mechanism is not very well documented in general.  I added a comment to the tvncserver init.d script indicating the need to add any applicable distributed auth services to Required-Start.

--
You received this message because you are subscribed to the Google Groups "TurboVNC User Discussion/Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbovnc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/turbovnc-users/5083fb36-1eb8-4d99-8a37-7ac41be6fb18%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages