Skip to main content
Topic: Mullvad VPN Init (Read 1696 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Mullvad VPN Init

Hi Friends,

I have installed Mullvad's VPN from the AUR.  However, I cannot find a way to add the service to my openrc runlevels.  Has anyone done this before?   The company said they do not use Gentoo or artix with OpenRC.  When I was using Express, I had copied the expressvpn.init to my /etc/init.d and added it without a hitch, but the Mullvad service has not been so easy to configure.  I am able to start the gui, although it hangs connecting to the system service, which I know is not running.

Any insights are appreciated.

Re: Mullvad VPN Init

Reply #1
I installed mullvad-vpn-beta-bin from AUR
i created the following file: 

/etc/init.d/mullvad

Code: [Select]
#!/sbin/openrc-run
description="Mullvad VPN Service"

depend() {
    need net
}

supervisor="supervise-daemon"
command="/opt/Mullvad\ VPN/resources/mullvad-daemon"
command_args="${MULLVPN_OPTS}"
#pidfile="/run/${SVCNAME}.pid"
command_background=true

I also set
/usr/share/applications/mullvad-vpn.desktop
to autostart (in KDE/plasma), then do the regular
rc-update add mullvadvpn default
 and so far it's been working well enough

Re: Mullvad VPN Init

Reply #2
wow @toxygen !

That is a really neat solution. All I did was add the company provided command to /etc/rc.local, so it looked like
Code: [Select]
#!/bin/sh

# /etc/rc.local -- rc.local for Artix Linux
#
# Enter your custom commands here.

/opt/Mullvad\ VPN/resources/mullvad-daemon -v

Do you think creating a separate init script for it is better practice?  Do one thing and do it well?

Again, thank you for your guidance.
Ive been using Artix now for three years, the only difference now is that I use OpenRC and KDE

Re: Mullvad VPN Init

Reply #3
i dont know if it's better practice, but it works automatically with openrc (ie.. the "daemon" starts after boot, and is killed prior to reboot/shutdown).  plus i dont even use rc.local, so YMMV

Re: Mullvad VPN Init

Reply #4
Do you think creating a separate init script for it is better practice?  Do one thing and do it well?
Ideally you should have <package_name>-<your_init> with scripts to manage the service through your init. Failing that, it's up to you how you manage that service. If it works, it works. /etc/rc.local is traditionally the script containing local setup, since at least System V, and many init systems have scripts to parse it for backwards compatibility (only in different location - 66 uses /etc/66/rc.local instead). If you know how to write a script for your package for your init, consider making one and asking the devs to include it in Artix.

P.S: 66's /etc/66/rc.local specifically states that you shouldn't start services using that script, because it is run as a one-shot on boot.