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.
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?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.