Question

couldn't start vnc server

I followed tutorial on this link to access GUI on droplet running Ubuntu 16.01

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-16-04

But in Step 4 — Creating a VNC Service File when I try to start with

sudo systemctl start vncserver@1

I’m getting this error

Job for vncserver@1.service failed because the control process exited with error code. See "systemctl status vncserver@1.service" and "journalctl -xe" for details.

also I’m getting service status as below

vncserver@1.service - Start TightVNC server at startup
   Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2018-03-25 12:35:37 UTC; 12s ago
  Process: 26404 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i (code=exited, status=217/USER)
  Process: 26401 ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1 (code=exited, status=217/USER)

Mar 25 12:35:37 waspy systemd[1]: Starting Start TightVNC server at startup...
Mar 25 12:35:37 waspy systemd[26401]: vncserver@1.service: Failed at step USER spawning /usr/bin/vncserver: No such process
Mar 25 12:35:37 waspy systemd[26404]: vncserver@1.service: Failed at step USER spawning /usr/bin/vncserver: No such process
Mar 25 12:35:37 waspy systemd[1]: vncserver@1.service: Control process exited, code=exited status=217
Mar 25 12:35:37 waspy systemd[1]: Failed to start Start TightVNC server at startup.
Mar 25 12:35:37 waspy systemd[1]: vncserver@1.service: Unit entered failed state.
Mar 25 12:35:37 waspy systemd[1]: vncserver@1.service: Failed with result 'exit-code'.
Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I had a similar problem. My fix was that I copy-pasted the vnc config file without changing the usernames “sammy” to whatever that I used. Hope this helps anyone who made a similar mistake.

I didn’t get any error. Code gets executed successfully. But when executing

ssh -L 5901:127.0.0.1:5901 -N -f -l username ip-address

nothing happens…

if I enter into jump desktop/ vnc viewer and enter IP address, it would take time and then time out. Any help with GUI is much appreciated.

thanks!!

Hi Hashan,

Thi question is a bit old, but I couldn’t find an answer, but I managed to identify the root cause.

In this file:

sudo nano /etc/systemd/system/vncserver@.service

you forgot to change the value of User and the username in the value of PIDFILE to match your username. The same error appeared for me when just quickly copy-pasting the code. Using the correct username will solve the issue.

If you are getting an error running system start service command and you are ‘root’ user (as opposed to “sammy” or “ubuntu” for example) you may need to update the pathing in:

Location:

/etc/systemd/system/vncserver@.service

Content:

[Service]
Type=forking
User=sammy
Group=sammy
WorkingDirectory=/home/sammy

PIDFile=/home/sammy/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i

To this:

[Service]
Type=forking
User=root
Group=root
WorkingDirectory=/root

PIDFile=/root/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i

Specifically:

/home/sammy/.vnc

Changes to:

/root/.vnc
  1. Verify that /usr/bin/vncserver exists and is executable.
  2. see if you can start VNC Server manually.