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?

raspi
  • 1,376
  • 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 00:55
  • Does this answer your question? https://unix.stackexchange.com/questions/384499/systemd-user-units-fail-to-auto-start/653118#653118 – Stewart Oct 17 '21 at 08:12
  • This one may also work: https://unix.stackexchange.com/questions/644886/vnc-server-with-gdm-login – Stewart Oct 17 '21 at 08:13

1 Answers1

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

JdeBP
  • 68,745