You are not logged in.
I'm trying to configure WireGuard (with Mullvad) on Devuan by following this guide:
https://mullvad.net/it/guides/easy-wire … ultihop-wg
everything works.
the only problem is the following passage which obviously on devuan is not possible:
Q: How do I make WireGuard start automatically on boot?
A: systemctl enable wg-quick@mullvad-se4
how to do on devuan?
thank you!
Offline
Here is the unit file:
https://git.zx2c4.com/WireGuard/plain/s … k@.service
The ExecStart line is the command that is executed by the unit file, replace %i with mullvad-se4 and incorporate it into a boot script for sysvinit.
Brianna Ghey — Rest In Power
Offline
Here is the unit file:
https://git.zx2c4.com/WireGuard/plain/s … k@.service
The ExecStart line is the command that is executed by the unit file, replace %i with mullvad-se4 and incorporate it into a boot script for sysvinit.
Thank you for your answer.
in which folder do I find the file unit to be edited?
excuse ignorance
Offline
The wgquick@.service unit file uses the .ini style ('cos the devs love Windows, presumably) and so cannot be used with sysvinit, you will need to convert it to a shell script instead.
Something like this executable file in /etc/init.d/wireguard might work:
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: wireguard
# Required-Start: mountkernfs $local_fs
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: WireGuard via wg-quick(8)
### END INIT INFO
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
/usr/bin/wg-quick up mullvad-se4
}
do_stop() {
/usr/bin/wg-quick down mullvad-se4
}
case $1 in
(start|restart|reload|force-reload)
do_invoke start
;;
(stop)
do_invoke stop
;;
(*)
echo >&2 "Usage: $0 {start|stop|restart|reload|force-reload}"
exit 3
;;
esac
Enable it with
# update-rc.d wireguard defaults
Disclaimer: I'm crap with sysvinit scripts so perhaps wait for somebody to point out my mistakes before trying this.
Brianna Ghey — Rest In Power
Offline
The wgquick@.service unit file uses the .ini style ('cos the devs love Windows, presumably) and so cannot be used with sysvinit, you will need to convert it to a shell script instead.
Something like this executable file in /etc/init.d/wireguard might work:
#!/bin/sh -e ### BEGIN INIT INFO # Provides: wireguard # Required-Start: mountkernfs $local_fs # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # Short-Description: WireGuard via wg-quick(8) ### END INIT INFO . /lib/init/vars.sh . /lib/lsb/init-functions do_start() { /usr/bin/wg-quick up mullvad-se4 } do_stop() { /usr/bin/wg-quick down mullvad-se4 } case $1 in (start|restart|reload|force-reload) do_invoke start ;; (stop) do_invoke stop ;; (*) echo >&2 "Usage: $0 {start|stop|restart|reload|force-reload}" exit 3 ;; esac
Enable it with
# update-rc.d wireguard defaults
Disclaimer: I'm crap with sysvinit scripts so perhaps wait for somebody to point out my mistakes before trying this.
so. summarizing. I have to create a "blank file" in /etc/init.d/wireguard with the extension .ini named as I want. I paste into it the content of the text you provided me. I make it executable and active with the command
# update-rc.d wireguard defaults
okay?
Sorry again and thanks
Offline
with the extension .ini
No "extension" is needed, that's a Windows thing. And .ini-style files are what systemd uses.
Also, please don't full quote for a straight reply, it reduces the readability of the thread.
Brianna Ghey — Rest In Power
Offline
pota wrote:with the extension .ini
No "extension" is needed, that's a Windows thing. And .ini-style files are what systemd uses.
Also, please don't full quote for a straight reply, it reduces the readability of the thread.
Okay. Sorry. So I'm giving this command:
nano /etc/init.d/wireguard
I insert the text you posted to me. and finally activate it with the command:
update-rc.d wireguard defaults
right?
Offline
Yes.
Thinking about this a bit more: you may have to add networking to the Required-Start line to get the network up before the VPN is started but I'm not really sure.
I can't believe you full-quoted me again though (and even included the request to stop full-quoting in the quote). Ah well.
Last edited by Head_on_a_Stick (2019-04-22 11:39:51)
Brianna Ghey — Rest In Power
Offline
update-rc.d wireguard defaults
insserv: script wireguard is not an executable regular file, skipped!
Releases me this error.
(I thought you were asking me not to mention long fragments of conversation. now I have not mentioned anything. excuse me.)
Offline
# chmod +x /etc/init.d/wireguard
Brianna Ghey — Rest In Power
Offline
Thank you. done but not working. does not start automatically
Offline
In which case check the journal logs to find out what's going wrong and then fiddle with the service file to get it to work.
Brianna Ghey — Rest In Power
Offline
I'm sorry, but I don't have the necessary skills.
I start it manually.
Is it possible to remove what we have done so far?
thanks. excuse the trouble
Offline
I don't have the necessary skills
Me neither, that's why it didn't work
Is it possible to remove what we have done so far?
Of course: just run
# update-rc.d -f wireguard remove
# rm /etc/init.d/wireguard
excuse the trouble
That's OK, it was no trouble at all.
Sorry I couldn't get it working for you.
Brianna Ghey — Rest In Power
Offline
I solved it using OpenVPN instead of WireGuard ;-)
Offline
For anyone else needing help, unless I'm missing something, just add
wg-quick up wg0
to /etc/rc.local before the "exit 0" line. That will run it on startup.
Offline
Greetings!
Mullvad's philosophy is spot on: both accessible and permissive in exactly the sense a privacy application should be.
Please find here simpler SysVinit script which either runs the binary, hangs up, or employs devuan's init-functions to query the status.
1 install Mullvad's .deb package
2 create this /etc/init.d/mullvad
#! /bin/sh
### BEGIN INIT INFO
# Provides: mullvad-daemon
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Start and stop mullvad-daemon
# Description: A simple init for Mullvad VPN
### END INIT INFO
. /lib/lsb/init-functions
name=${0##*/}
bin=/opt/Mullvad\ VPN/resources/mullvad-daemon
case "$1" in
start)
"$bin" &
;;
stop)
start-stop-daemon --stop --exec "$bin" --
;;
status)
status_of_proc "mullvad-daemon" "$name"
;;
*)
log_action_msg "Usage: $0 {start|stop|status}"
;;
esac
exit 0
3 update-rc.d mullvad defaults
The daemon will now run at startup. Configure wireguard or anything as a normal user with mullvad(1) client program.
All the best,
Offline