6

I tried to make my tightvncserver start at boot on parabola arch Gnu/Linux in an auto GUI login setup using the wiki https://wiki.archlinux.org/index.php/TigerVNC#Using_tigervnc.27s_x0vncserver and by creating x0vncserver.service systemd unit following that and then systemctl enable x0vncserver.service but when I boot/reboot, I see no vnc server active and then checking I see this

# systemctl status x0vncserver.service
* x0vncserver.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/x0vncserver.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sat 2017-07-01 20:42:55 +06; 1min 34s ago
  Process: 302 ExecStart=/usr/bin/sh -c /usr/bin/x0vncserver -display :0 -rfbport 5900 -passwordfile /home/peruvian/.vnc/passwd & (code=exited, status=0/SUCCESS)

Jul 01 20:42:52 sky systemd[1]: Starting Remote desktop service (VNC)...
Jul 01 20:42:55 sky systemd[1]: Started Remote desktop service (VNC).

and my

# journalctl -xe | grep vnc
-- Subject: Unit x0vncserver.service has begun start-up
-- Unit x0vncserver.service has begun starting up.
-- Subject: Unit x0vncserver.service has finished start-up
-- Unit x0vncserver.service has finished starting up.
Jul 01 20:47:08 sky systemd[1]: x0vncserver.service: Main process exited, code=exited, status=1/FAILURE
Jul 01 20:47:08 sky systemd[1]: x0vncserver.service: Unit entered failed state.
Jul 01 20:47:08 sky systemd[1]: x0vncserver.service: Failed with result 'exit-code'.

But if I run the command systemctl start x0vncserver.service or systemctl restart x0vncserver.service after loading the desktop, it works without any issue as the # systemctl status x0vncserver.serviceshows

# systemctl status x0vncserver.service
* x0vncserver.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/x0vncserver.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2017-07-01 20:56:53 +06; 2s ago
  Process: 924 ExecStart=/usr/bin/sh -c /usr/bin/x0vncserver -display :0 -rfbport 5900 -passwordfile /home/peruvian/.vnc/passwd & (code=exited, status=0/SUCCESS)
 Main PID: 925 (x0vncserver)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/x0vncserver.service
           `-925 /usr/bin/x0vncserver -display :0 -rfbport 5900 -passwordfile /home/peruvian/.vnc/passwd

Jul 01 20:56:53 sky systemd[1]: Starting Remote desktop service (VNC)...
Jul 01 20:56:53 sky systemd[1]: Started Remote desktop service (VNC).

and my default.target is

# systemctl get-default       
graphical.target

I guess the service starts earlier than it supposed to and fails due to lack of resources at boot.

1

2 Answers 2

6

A little late, but I also just stumbled over this problem.

The problem is, that x0vncserver needs a logged in X session for your user, so you have to ensure two things:

  1. Your user must be configured for autologin

  2. Put a sleep in your ExecStart command, so that the desktop can start and log in before x0vncserver service tries to start:

    ExecStart=/usr/bin/sh -c 'sleep 3 && /usr/bin/x0vncserver -display :0 -rfbport 5900 -passwordfile /home/<your_user_name>/.vnc/passwd &'

The sleep did the trick for me and now my x0vnc is working.

4

As x0vncserver will only start after xsession, and as mine is an LXDE environment, the easier way is to create a script.sh file like following

#!/bin/bash
x0vncserver -display :0 -rfbport 5900 -passwordfile ~/.vnc/passwd

and make it executable by sudo chmod +x script.sh and add a line in ~/.config/lxsession/LXDE/autostart file like following

path_to_the_script_file/script.sh

and the x0vncserver starts as my LXDE desktop session starts and that's what I need.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .