Open Joetjah opened 1 year ago
Does the file /etc/init.d/wsl-vpnkit
exist?
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
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
I'm running Ubuntu 22.04.2 LTS, installed through the Windows Store, but installing gives the following error:
When trying to run the service manually, I get the following error:
Any ideas?