I've a Raspberry Pi 4 with Ubuntu 18.04 server. I often control it via VNC, so I create a systemd service to start vnc4server at boot, it worked well until yesterday, now the service doesn't start. If I check with sudo systemctl status vnc4server@1, I get:

[email protected] - Start VNC server at startup
   Loaded: loaded (/etc/systemd/system/[email protected]; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-03-31 07:14:41 CEST; 11s ago
  Process: 5103 ExecStart=/usr/bin/vnc4server -depth 24 -geometry 1280x720 :1 (code=exited, status=9
  Process: 5098 ExecStartPre=/usr/bin/vnc4server -kill :1 > /dev/null 2>&1 (code=exited, status=2)

mar 31 07:14:40 bornonpiday systemd[1]: Starting Start VNC server at startup...
mar 31 07:14:40 bornonpiday systemd[5098]: pam_unix(login:session): session opened for user icolumbrmar 31 07:14:40 bornonpiday systemd[5103]: pam_unix(login:session): session opened for user icolumbrmar 31 07:14:41 bornonpiday systemd[1]: [email protected]: Control process exited, code=exited stmar 31 07:14:41 bornonpiday systemd[1]: [email protected]: Failed with result 'exit-code'.
mar 31 07:14:41 bornonpiday systemd[1]: Failed to start Start VNC server at startup.

This is my systemd service file:

Description=Start VNC server at startup
After=syslog.target network.target

ExecStartPre=-/usr/bin/vnc4server -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vnc4server -depth 24 -geometry 1280x720 :%i
ExecStop=/usr/bin/vnc4server -kill :%i


If I start the server manually, it works. What's wrong?

  • add Wants=network-online.target in Unit section before After=.... line and append network-online.target to the line After=syslog.target network.target network-online.target and try again. Mar 31, 2020 at 11:08


You must log in to answer this question.

Browse other questions tagged .