Sample Header Ad - 728x90

TigerVNC Unable to Start Systemd Service

1 vote
1 answer
15841 views
I recently followed a guide I found here: How to Install VNC Server on RHEL 8 to create a VNC session for a given user. I have since created a new user account: engineer and updated the systemd service file to point to the new user account as shown below:
[engineer@localhost ~]$ cat /etc/systemd/system/vncserver@.service
[Unit]
Description=Remote Desktop Service (VNC)
After=syslog.target network.target

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

PIDFile=/home/engineer/.vnc/%H%i.pid

ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -autokill %i
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target
I created a new vnc password for the engineer account and then executed the systemctl daemon-reload command after creating my service file, then executed the command: systemctl start vncserver@:1 as per the guide and now I get the follow error message:
Failed to import environment: Process org.freedesktop.systemd1 exited with status 1
Annoyingly everything was working fine until updated the vncserver@ service file. Interestingly if I revert all the settings in the service file back to the original user it works without fail.
Asked by hymcode (133 rep)
Aug 31, 2023, 02:30 PM
Last activity: Sep 1, 2023, 08:05 AM