The officially official Devuan Forum!

You are not logged in.

#1 2019-04-21 20:10:37

pota
Member
Registered: 2019-02-08
Posts: 12  

Devuan and WireGuard / Mullvad VPN

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

#2 2019-04-21 20:42:57

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 316  
Website

Re: Devuan and WireGuard / Mullvad VPN

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.


Fabricando fit faber

Offline

#3 2019-04-22 08:18:50

pota
Member
Registered: 2019-02-08
Posts: 12  

Re: Devuan and WireGuard / Mullvad VPN

Head_on_a_Stick wrote:

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

#4 2019-04-22 08:53:32

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 316  
Website

Re: Devuan and WireGuard / Mullvad VPN

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.


Fabricando fit faber

Offline

#5 2019-04-22 09:50:46

pota
Member
Registered: 2019-02-08
Posts: 12  

Re: Devuan and WireGuard / Mullvad VPN

Head_on_a_Stick wrote:

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

#6 2019-04-22 10:22:40

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 316  
Website

Re: Devuan and WireGuard / Mullvad VPN

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.


Fabricando fit faber

Offline

#7 2019-04-22 11:27:20

pota
Member
Registered: 2019-02-08
Posts: 12  

Re: Devuan and WireGuard / Mullvad VPN

Head_on_a_Stick wrote:
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

#8 2019-04-22 11:30:34

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 316  
Website

Re: Devuan and WireGuard / Mullvad VPN

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)


Fabricando fit faber

Offline

#9 2019-04-22 11:43:13

pota
Member
Registered: 2019-02-08
Posts: 12  

Re: Devuan and WireGuard / Mullvad VPN

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

#10 2019-04-22 12:20:18

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 316  
Website

Re: Devuan and WireGuard / Mullvad VPN

# chmod +x /etc/init.d/wireguard

Fabricando fit faber

Offline

#11 2019-04-22 12:38:18

pota
Member
Registered: 2019-02-08
Posts: 12  

Re: Devuan and WireGuard / Mullvad VPN

Thank you. done but not working. does not start automatically

Offline

#12 2019-04-22 14:19:14

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 316  
Website

Re: Devuan and WireGuard / Mullvad VPN

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.


Fabricando fit faber

Offline

#13 2019-04-22 16:16:53

pota
Member
Registered: 2019-02-08
Posts: 12  

Re: Devuan and WireGuard / Mullvad VPN

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

#14 2019-04-22 16:37:36

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 316  
Website

Re: Devuan and WireGuard / Mullvad VPN

pota wrote:

I don't have the necessary skills

Me neither, that's why it didn't work big_smile

pota wrote:

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
pota wrote:

excuse the trouble

That's OK, it was no trouble at all.

Sorry I couldn't get it working for you.


Fabricando fit faber

Offline

#15 2019-04-23 09:00:19

pota
Member
Registered: 2019-02-08
Posts: 12  

Re: Devuan and WireGuard / Mullvad VPN

I solved it using OpenVPN instead of WireGuard ;-)

Offline

#16 2019-07-24 22:34:19

paulxx
Member
Registered: 2019-07-24
Posts: 1  

Re: Devuan and WireGuard / Mullvad VPN

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

Board footer