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.service
shows
# 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.
Best Answer
As
x0vncserver
will only start after xsession, and as mine is an LXDE environment, the easier way is to create ascript.sh
file like followingand make it executable by
sudo chmod +x script.sh
and add a line in~/.config/lxsession/LXDE/autostart
file like followingand the
x0vncserver
starts as my LXDE desktop session starts and that's what I need.