You are not logged in.

#1 2017-10-04 04:04:02

Annoyingduck
Member
Registered: 2016-08-02
Posts: 179

Cannot Get Tigervnc's x0vncserver To Start At Boot

So I have x0vncserver working, but I can only use it when executed from the terminal using the command:

x0vncserver -display :0 -passwordfile ~/.vnc/passwd

I can't get the systemd autostart to work.  My file in /etc/systemd/system/x0vncserver.service is written exactly as the wiki describes with my username substituted:

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=cn
ExecStart=/usr/bin/sh -c '/usr/bin/x0vncserver -display :0 -rfbport 5900 -passwordfile /home/cn/.vnc/passwd &'

[Install]
WantedBy=multi-user.target

Now if I run "sudo systemctl start x0vncserver.service" it works correctly and I can remote in and use vnc.  But if I enable the service to start at boot the module fails and does not run.  Systemctl status shows this error:

[cn@ArchOptiplexServer ~]$ systemctl status x0vncserver.service
● x0vncserver.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/x0vncserver.service; enabled; vendor pres
   Active: failed (Result: exit-code) since Tue 2017-10-03 23:47:07 EDT; 1min 22
  Process: 266 ExecStart=/usr/bin/sh -c /usr/bin/x0vncserver -display :0 -rfbpor
 Main PID: 268 (code=exited, status=1/FAILURE)

Oct 03 23:47:07 ArchOptiplexServer systemd[1]: Starting Remote desktop service (
Oct 03 23:47:07 ArchOptiplexServer systemd[1]: Started Remote desktop service (V
Oct 03 23:47:07 ArchOptiplexServer systemd[1]: x0vncserver.service: Main process
Oct 03 23:47:07 ArchOptiplexServer systemd[1]: x0vncserver.service: Unit entered
Oct 03 23:47:07 ArchOptiplexServer systemd[1]: x0vncserver.service: Failed with 
lines 1-11/11 (END)...skipping...
● x0vncserver.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/x0vncserver.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2017-10-03 23:47:07 EDT; 1min 22s ago
  Process: 266 ExecStart=/usr/bin/sh -c /usr/bin/x0vncserver -display :0 -rfbport 5900 -passwordfile /home/cn/.vnc/passwd & (code=exited, status=0/SUCCESS)
 Main PID: 268 (code=exited, status=1/FAILURE)

Oct 03 23:47:07 ArchOptiplexServer systemd[1]: Starting Remote desktop service (VNC)...
Oct 03 23:47:07 ArchOptiplexServer systemd[1]: Started Remote desktop service (VNC).
Oct 03 23:47:07 ArchOptiplexServer systemd[1]: x0vncserver.service: Main process exited, code=exited, status=1/FAILURE
Oct 03 23:47:07 ArchOptiplexServer systemd[1]: x0vncserver.service: Unit entered failed state.
Oct 03 23:47:07 ArchOptiplexServer systemd[1]: x0vncserver.service: Failed with result 'exit-code'.
~

I also tried adding the command "x0vncserver -display :0 -passwordfile ~/.vnc/passwd" to the startup applications, and it seems to run after a reboot, however I can't log in through my other computers.  It keeps saying the password is wrong.  Which is strange because if I run that command from the terminal when booted, it works, and I can log in through other machines and the password is accepted.  I don't know how to get this to run at boot.  I'm using XFCE.

Last edited by Annoyingduck (2017-10-05 01:50:50)

Offline

#2 2017-10-05 01:47:33

Annoyingduck
Member
Registered: 2016-08-02
Posts: 179

Re: Cannot Get Tigervnc's x0vncserver To Start At Boot

I still cannot get this to autostart correctly.  For now I made a startup script that with this command in it, made it executable, and added it to my startup applications:

#!/bin/bash
(x0vncserver -display :0 -passwordfile ~/.vnc/passwd) &

It "seems" to be working, but I really would like to use the systemd service for autostart.  Or at a minimum track down why it's not working.

I have another issue too where the info in the wiki is just not working.  The clipboard is not working (copy on connected machine & paste to server). The wiki says to add "autocutsel -fork' into "~/.vnc/xstartup", but that is not working (that info is from a linked post almost 8 years ago with Tightvnc, not the current Tigervnc).  There is also another section in the wiki that says to create a startup script with this in it:

#!/bin/sh
vncconfig -nowin &

But that is not working either.  In fact running that command just kicks back  "No VNC extension on display :0.0". I aslo don't think it's intended for use with x0vncserver.  Coming from Vino, I'm just having a real hard time getting this stuff to work correctly.  I'm not a server or IT guy, and really could use some help here.

Last edited by Annoyingduck (2017-10-05 01:52:49)

Offline

#3 2017-10-07 15:53:39

Annoyingduck
Member
Registered: 2016-08-02
Posts: 179

Re: Cannot Get Tigervnc's x0vncserver To Start At Boot

Update, I've dropped TigerVNC and have moved to x11vnc.  I'm not having any of the issues that I was having with Tigervnc.  Copy & Paste working, autostart via systemd working. There are several things I had to different from the Arch Wiki to get it working properly though.  I used bits of info from other distros and combined them into a working x11vnc on Arch for me (the wiki would not work for password/execution).  I'll note them here:

-If running as user the log file should go in /home/your-user-name/.vnc/x11vnc.log
-The password is generated by running "x11vnc -storepasswd" and point it to /home/your-user-name/.vnc/passwd
-Add the "-rfbauth /home/your-user-name/.vnc/passwd" instead of "-passwd PASSWORD"
-Add the "-nocursor" command to the startup to use the host computers mouse cursor instead of the weird arrow when logged in.
-My startup command is this:

x11vnc -nap -wait 50 -noxdamage -rfbauth /home/cn/.vnc/passwd -display :0 -nocursor -forever -o /home/cn/.vnc/x11vnc.log -bg

-To autostart create x11vnc.service in /etc/systemd/system/x11vnc.service and add this to the file:

[Unit]
Description=VNC Server for X11
Requires=display-manager.service
After=display-manager.service

[Service]
Type=forking
ExecStart=/usr/bin/x11vnc -nap -wait 50 -noxdamage -rfbauth /home/your-user-name/.vnc/passwd -display :0 -nocursor -forever -o /home/your-user-name/.vnc/x11vnc.log -bg
Restart=on-failure
RestartSec=10
User=your-user-name

[Install]
WantedBy=multi-user.target

-Then a simple "sudo systemctl start x11vnc.service" and "sudo systemctl enable x11vnc.service" gets it all up and working.
-Also note that out of the box with those commands bVNCpro on Android connects without issue.  I could not connect with Tigervnc on Android - it apparently will never happen.

I won't mark this as solved, only due to the fact that the questions posed are not solved, but for me I'm sticking with x11vnc unless someone can fix the issues presented and explain why Tigervnc should be used over x11vnc.

Offline

#4 2019-11-26 02:59:20

jyaken
Member
Registered: 2014-09-12
Posts: 8

Re: Cannot Get Tigervnc's x0vncserver To Start At Boot

I think u should place x0vncserver.service in /home/username/.config/systemd/user/ ,
and run “systemctl start x0vncserver.service --user” instead of  "sudo systemctl start x0vncserver.service"

Offline

#5 2019-11-26 04:18:12

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,797

Re: Cannot Get Tigervnc's x0vncserver To Start At Boot

Closing this old thread.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB