3

I have TightVNC installed and working on my Ubuntu 18.4 virtual server, following this guide. It says to use nano and create a 'unit' file called /etc/systemd/system/[email protected]. It then specifies the contents of the file, and I have checked and double-checked, but when I try and start the service with:

systemctl start vncserver@1

I get an error that says:

Job for [email protected] failed because the control process exited with error code.

Then I run:

systemctl status [email protected]

and I get this output:

[email protected] - Start TightVNC server at startup
   Loaded: loaded (/etc/systemd/system/[email protected]; indirect; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-08-28 19:13:08 UTC; 12h ago

Aug 28 19:13:08 BradysApp systemd[1]: Starting Start TightVNC server at startup...
Aug 28 19:13:08 BradysApp vncserver[1232]: Can't find file /home/brady/.vnc/BradysApp:1.pid
Aug 28 19:13:08 BradysApp vncserver[1232]: You'll have to kill the Xtightvnc process manually
Aug 28 19:13:08 BradysApp systemd[1]: [email protected]: Control process exited, code=exited status=2
Aug 28 19:13:08 BradysApp systemd[1]: [email protected]: Failed with result 'exit-code'.
Aug 28 19:13:08 BradysApp systemd[1]: Failed to start Start TightVNC server at startup.

My unit file looks like this:

[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target

[Service]
Type=forking
User=brady
Group=brady
WorkingDirectory=/home/brady
PIDFile=/home/brady/.vnc/%H:%i.pid
ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target

The user brady is my non-root user and works just fine, so that isn't the problem.

Any ideas or suggestions as to what might be wrong? I am a total Linux novice, working on a Digital Ocean VPS's web-based terminal.

10
  • It's best to post results as text, not screenshots. Also the lines in the screenshot are truncated. Suggest editing your question to include full results. Aug 28, 2020 at 19:36
  • @OrganicMarble I don't know how to copy from the Ubuntu clipboard to the Windows one, even using TightVNC, and the truncation looks just like that in my terminal - there isn't more you I can see that you can't.
    – ProfK
    Aug 29, 2020 at 5:48
  • How about the error that says can't find file /home/brady/.vnc/Bradysapp...? It looks like that might be related to the PIDFile line in your unit file. The Bradysapp part looks suspicious. What is %H supposed to represent? Aug 29, 2020 at 10:44
  • My 'droplet' name is Bradysapp (host name), so I assume %H is some sort of macro for hostname. I have no idea what a PID File is or what it must look like, I assumed the vnc installation should have created it, but now at your prompt, it is indeed missing.
    – ProfK
    Aug 29, 2020 at 13:38
  • I checked all the unit files on my computers and none have the PIDFile line in them. I was hoping to find a working example, but I couldn't. I'm going to spin up a virtual machine real quick and give it a try. Will report back. Aug 29, 2020 at 13:56

2 Answers 2

0

Based on discussions in comments and chat, the issue was resolved by re-running the setup procedure after the addition of the user whose desktop was to be shared.

0

The Group parameter should be set to the group in your system. It's not the same as your username in general. You may use ll (an alias for the ls -l command) to check what group should be set to.

Group should be set to users in the example below:

-rw-------  1 awen users    406 Sep 26 07:15 .Xauthority
-rw-r--r--  1 awen users   1600 Apr  9  2020 .Xdefaults
-rw-r--r--  1 awen users     80 Sep 23 10:22 .bash_aliases
-rw-------  1 awen users   8440 Sep 26 07:23 .bash_history

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .