0

I'm trying to start VNC server in systemd in user mode automatically after boot. Using Arch Linux running as virtual machine.

VNC server is Tiger VNC:

$ pacman -Qs vnc
local/tigervnc 1.9.0-1
    Suite of VNC servers and clients. Based on the VNC 4 branch of TightVNC.

/home/raspi/vnc.service:

[Unit]
Description=Remote desktop service (VNC)

[Service]
Type=simple
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver :1 -geometry 1920x1080 -alwaysshared -fg -name remote
ExecStop=/usr/bin/vncserver -kill :1

[Install]
WantedBy=default.target

Linger is enabled:

$ loginctl show-user raspi | grep -i linger
Linger=yes

Installed with:

$ systemctl --user enable /home/raspi/vnc.service
Created symlink /home/raspi/.config/systemd/user/default.target.wants/vnc.service → /home/raspi/vnc.service.
Created symlink /home/raspi/.config/systemd/user/vnc.service → /home/raspi/vnc.service.

Started with:

$ systemctl --user start vnc.service

I can start it and connect to it but it doesn't automatically start when system boots. I have to log in and run systemctl --user start vnc.service manually. What I'm missing?

  • It's a user service, not a system service, why would yopu expect it to start at boot? And after user login, are you sure it's not auto started? Have you checked journalctl? – 炸鱼薯条德里克 Sep 29 '18 at 0:55
0

You are missing that your per-user service management does not itself start at bootstrap in the default configuration. It starts when you first log on, the consequence of a hook by the service manager into the login system.

Further reading

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.