Code: Select all
[root@orcacomputers conf]# systemctl daemon-reload
[root@orcacomputers conf]# systemctl start vncserver@:1
Failed to start vncserver@:1.service: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status vncserver@:1.service' for details.
Code: Select all
[root@orcacomputers conf]# systemctl status vncserver@:1.service -l
● vncserver@:1.service - Remote desktop service (VNC)
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Nov 10 18:34:25 orcacomputers systemd[1]: vncserver@:1.service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Code: Select all
vim /etc/systemd/system/vncserver@\:1.service
Code: Select all
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=simple
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[b]ExecStart=/usr/bin/vncserver_wrapper netizen %i[/b]
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[b]ExecStart=/sbin/runuser -l netizen -c "/usr/bin/vncserver %i -geometry 1280x1024"[/b]
PIDFile=/home/netizen/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
Code: Select all
[b]ExecStart=/sbin/runuser -l netizen -c "/usr/bin/vncserver %i -geometry 1280x1024"[/b]
ExecStart=/usr/bin/vncserver_wrapper netizen %i
ExecStart=/sbin/runuser -l netizen -c "/usr/bin/vncserver %i -geometry 1280x1024"
I tried commenting each of them out but was not the solution I am looking for. Thought it a good time to ask for help.
I have
Code: Select all
services: vnc-server
I then edited
Code: Select all
[Neptune@orcacomputers ~]$ cat /usr/bin/vncserver_wrapper
Code: Select all
So that $USER was replaced with netizen. Reloaded and tried to start. Still the same error. Here is what I have now:
#!/bin/sh
USER="$1"
INSTANCE="$2"
die() {
echo "FATAL: ${@:-}" >&2
exit 2
}
cleanup() {
[ -n "$VNCPID" ] || return
if kill -0 $VNCPID 2>/dev/null; then
kill $VNCPID
fi
}
trap cleanup TERM INT HUP
[ -n "netizen" -a -n "$INSTANCE" ] || die "Invalid usage!"
/usr/sbin/runuser -l "netizen" -c "/usr/bin/vncserver ${INSTANCE}"
[ $? -eq 0 ] || die "'runuser -l $USER' failed!"
# Wait up to 5 seconds for vncserver to be up
for tries in $(seq 1 50); do
[ -e "~netizen/.vnc/$(hostname)${INSTANCE}.pid" ] && break
sleep 0.1
done
eval HOME=~netizen
VNCPID=$(cat "$HOME/.vnc/$(hostname)${INSTANCE}.pid" 2>/dev/null || true)
[ -n "$VNCPID" ] || die "'vncserver ${INSTANCE}' failed to start after 5 seconds!"
echo "'vncserver ${INSTANCE}' has PID $VNCPID, waiting until it exits ..."
while kill -0 $VNCPID 2>/dev/null; do
sleep 5
done
echo "PID $VNCPID exited, exiting ..."