Installing not succesful, service could not be found, Interactive authentication required
Opened this issue · 3 comments
Joetjah commented
I'm running Ubuntu 22.04.2 LTS, installed through the Windows Store, but installing gives the following error:
joetjah@X:~/wsl-vpn$ sudo ./wsl-vpnkit-setup.sh --no-docker
[sudo] password for joetjah:
joetjah ALL=(ALL) NOPASSWD: /usr/sbin/service wsl-vpnkit *
Setup complete!
Unit wsl-vpnkit.service could not be found.
Failed to start wsl-vpnkit.service: Unit wsl-vpnkit.service not found.
When trying to run the service manually, I get the following error:
joetjah@X:~/wsl-vpn$ service wsl-vpnkit status > /dev/null || service wsl-vpnkit start
Unit wsl-vpnkit.service could not be found.
Failed to start wsl-vpnkit.service: Interactive authentication required.
See system logs and 'systemctl status wsl-vpnkit.service' for details.
Any ideas?
andyneff commented
Does the file /etc/init.d/wsl-vpnkit
exist?
Joetjah commented
Yes:
#!/usr/bin/env sh
WSLVPNKIT_PATH="/usr/local/bin/wsl-vpnkit-start.sh"
PID_PATH="/var/run/wsl-vpnkit.pid"
LOG_PATH="/var/log/wsl-vpnkit.log"
cmd="/sbin/start-stop-daemon --startas /bin/sh --make-pidfile --remove-pidfile --pidfile ${PID_PATH}"
ret=0
start()
{
# using `wsl.exe` allows the daemon to keep running in the background even when you close your terminal
"/mnt/c/Windows/system32/wsl.exe" -d "Ubuntu" --user root -- $cmd --oknodo --background --start -- -c "exec ${WSLVPNKIT_PATH} >> ${LOG_PATH} 2>&1"
ret=$?
}
stop()
{
$cmd --oknodo --stop
ret=$?
}
status()
{
$cmd --status
ret=$?
echo "status is $ret"
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: wsl-vpnkit {start|stop|restart|status}"
exit 1
esac
exit $ret
donfiguerres commented
You Need to add the headers to that script.
### BEGIN INIT INFO
# Provides: my-service-name
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: your description here
### END INIT INFO
Then enable the service
sudo systemctl enable wsl-vpnkit
reference: https://serverfault.com/a/897193/485373