Page 1 of 1

Problem setting up a sysvinit service to start on boot

Posted: Tue Apr 23, 2019 9:44 am
by horseyman66
Hi!

So i want my service to start on boot. I have created the following file `/etc/init.d/myvpn`: https://gist.github.com/banister/060d03 ... 4df9d1f724

and made it executable

I can start/stop the service correctly using:

Code: Select all

sudo service myvpn start


I then run:

Code: Select all

sudo sysv-rc-conf myvpn on
to add the symlink to

Code: Select all

/etc/rc5.d/
and i notice they are added successfully added. (

Code: Select all

/etc/rc5.d/S80myvpn -> ../init.d/myvpn
)

at this point, it should start at boot right?

however it doesn't.

Can someone tell me what i'm doing wrong?

Note again, the service DOES start fine when i manually go:

Code: Select all

sudo service myvpn start
- at this point i'm very confused

THanks!

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue Apr 23, 2019 9:57 am
by dolphin_oracle
I took a look at your init script.

do a

Code: Select all

 sudo update-rc.d myvpn defaults
to register all the symlinks needed.

you may also want to add "networking" to the "required-start" line of your script. Its very possible your script is starting up before the network is up, and so fails.

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue Apr 23, 2019 10:16 am
by horseyman66
Thanks, i tried that

but i get the following message:

insserv: warning: current start runlevel(s) (1) of script `mypn' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (2 3 4 5) of script `myvpn' overrides LSB defaults (0 1 6).

I ended up copying the header from /etc/init.d/openvpn just to be sure i didn't have a syntax error, but i still get the same issues

### BEGIN INIT INFO
# Provides: myvpn
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Should-Start: network-manager
# Should-Stop: network-manager
# X-Start-Before: $x-display-manager gdm kdm xdm wdm ldm sdm nodm
# X-Interactive: true
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: MY VPN service
# Description: This script will start MYVPN tunnels as specified
### END INIT INFO


also, what's the difference between between `update-rc.d` and `sysv-rc-conf` ? i already ran the latter...

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue Apr 23, 2019 10:48 am
by fehlix
horseyman66 wrote: Tue Apr 23, 2019 10:16 am insserv: warning: current start runlevel(s) (1) of script `mypn' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (2 3 4 5) of script `myvpn' overrides LSB defaults (0 1 6).
As a warning, it's probably that update-rc.d has a different interpretation of "LSB" standard,
just ignore.
horseyman66 wrote: Tue Apr 23, 2019 10:16 am also, what's the difference between between `update-rc.d` and `sysv-rc-conf` ? i already ran the latter...
As D_O mentioned, use "update-rc.d myvpn defaults" to set all service-init links in one go.
sysv-rc-conf is rather good for tweaking individual start/stop links.
I would probably make a clean start and remove all

Code: Select all

update-rc.d myvpn remove
check to see nothing left:

Code: Select all

ls -l /etc/rc?.d/*myvpn
and recreate again.

Code: Select all

update-rc.d myvpn defaults
Also better show your full initscript, which you have now, probably add some logging to see any error in one place when not started.
BTW, what is "myvpn", would you mind to share what you got.
Thanks
:puppy:

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue Apr 23, 2019 11:55 am
by horseyman66
Thanks guys, after copying across the header from openvpn and running the `update-rc.d` script as you guys stated, it appears to work.

The VPN is PIA, they don't appear to support sysvinit (only systemd) so i had to write my own service

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue Apr 23, 2019 12:11 pm
by fehlix
horseyman66 wrote: Tue Apr 23, 2019 11:55 am The VPN is PIA, they don't appear to support sysvinit (only systemd) so i had to write my own service
It appears that I have prepared a PIAVPN (Private Internet Access) init-script also,
if that works we might setup a installer within MX Package Installer for piavpn.
Would you mind trying the attached piavpn-init script.
Here what I have done to get latest piaVPN working in MX Linux booting in sysVinit:
Get latest version ( currently Version 1.1.1 ) from

Code: Select all

https://www.privateinternetaccess.com/pages/download
Open terminal and run the installer as normal user:

Code: Select all

./pia-linux-1.1.1-02545.run 
After installer finished do add the sysVinit init-script by extracting the attached tar-file:

Code: Select all

sudo tar -C / -xvf ./piavpn-init.tar
Now enable init-service:

Code: Select all

sudo update-rc.d piavpn defaults
and start the service:

Code: Select all

sudo service piavpn start
After running this I got the piavpn login popup :
piavpn-sysvinit-login.png
Within the menu look for the PIA VPN connect starter
Attached tar-file, with this content:

Code: Select all

$ tar -tf ./piavpn-init.tar 
./
./etc/
./etc/init.d/
./etc/init.d/piavpn
Thanks

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue Apr 23, 2019 1:55 pm
by horseyman66
lol almost the same as mine, we both got it from https://gist.github.com/RichardBronosky ... 057200bd02

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue Apr 23, 2019 2:02 pm
by fehlix
horseyman66 wrote: Tue Apr 23, 2019 1:55 pm lol almost the same as mine ...
I used probably nordvpn's init script as a template. But anyway, would you mind checking the one I attached and the procedure is working. As it would help to make sure the piavpn installer, which we are going to provided through MX Package Installer will work ok.
Thanks
:puppy:

Re: Problem setting up a sysvinit service to start on boot

Posted: Thu Apr 25, 2019 4:13 am
by horseyman66
I messaged you on slack ;)

Re: Problem setting up a sysvinit service to start on boot

Posted: Thu Apr 25, 2019 8:01 am
by fehlix
horseyman66 wrote: Thu Apr 25, 2019 4:13 am I messaged you on slack ;)
Thanks, but cannot find the message :lipsrsealed:

Re: Problem setting up a sysvinit service to start on boot

Posted: Thu Apr 25, 2019 12:38 pm
by horseyman66
sorry bro, do you work for private internet access? i might have confused you for someone else

Re: Problem setting up a sysvinit service to start on boot

Posted: Thu Apr 25, 2019 1:21 pm
by fehlix
horseyman66 wrote: Thu Apr 25, 2019 12:38 pm sorry bro, do you work for private internet access? i might have confused you for someone else
I read this as an compliment :happy:. Have you checked the tar-file , as I don't have a PIA vpn account, so I cannot test myself ;)

Re: Problem setting up a sysvinit service to start on boot

Posted: Fri Apr 26, 2019 7:28 am
by richb
fehlix wrote: Thu Apr 25, 2019 1:21 pm
horseyman66 wrote: Thu Apr 25, 2019 12:38 pm sorry bro, do you work for private internet access? i might have confused you for someone else
I read this as an compliment :happy:. Have you checked the tar-file , as I don't have a PIA vpn account, so I cannot test myself ;)
I tried this from github on MX 18.2 and it gives a working PIA client, (the latest version).

https://github.com/MX-Linux/piavpn-sysvinit-compat

Re: Problem setting up a sysvinit service to start on boot

Posted: Fri Apr 26, 2019 7:46 am
by fehlix
richb wrote: Fri Apr 26, 2019 7:28 am I tried this from github on MX 18.2 and it gives a working PIA client, (the latest version).

https://github.com/MX-Linux/piavpn-sysvinit-compat
Thanks for testing. Good that it works. So, we can prepare something within MX Package Installer -> Popular Apps -> VPN.

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue May 07, 2019 6:08 am
by Yellowhoney
fehlix wrote: Fri Apr 26, 2019 7:46 am
richb wrote: Fri Apr 26, 2019 7:28 am I tried this from github on MX 18.2 and it gives a working PIA client, (the latest version).

https://github.com/MX-Linux/piavpn-sysvinit-compat
Thanks for testing. Good that it works. So, we can prepare something within MX Package Installer -> Popular Apps -> VPN.
notice that PIA is in MX installer but it doesn't work correctly for me,. get stuck when asking for demo password

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue May 07, 2019 6:37 am
by JayM
Yellowhoney wrote: Tue May 07, 2019 6:08 am
fehlix wrote: Fri Apr 26, 2019 7:46 am
richb wrote: Fri Apr 26, 2019 7:28 am I tried this from github on MX 18.2 and it gives a working PIA client, (the latest version).

https://github.com/MX-Linux/piavpn-sysvinit-compat
Thanks for testing. Good that it works. So, we can prepare something within MX Package Installer -> Popular Apps -> VPN.
notice that PIA is in MX installer but it doesn't work correctly for me,. get stuck when asking for demo password
Please start a new topic for whatever problem you're having, providing the information that is requested in the please read this first post in the New Users section near the top of the forum. Thanks.

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue May 07, 2019 6:48 am
by fehlix
Yellowhoney wrote: Tue May 07, 2019 6:08 am notice that PIA is in MX installer but it doesn't work correctly for me,. get stuck when asking for demo password
Thanks, to let us know. We will look into this.

Re: Problem setting up a sysvinit service to start on boot

Posted: Tue May 07, 2019 11:48 am
by vtvbreech
fehlix wrote: Tue May 07, 2019 6:48 am
Yellowhoney wrote: Tue May 07, 2019 6:08 am notice that PIA is in MX installer but it doesn't work correctly for me,. get stuck when asking for demo password
Thanks, to let us know. We will look into this.
Can confirm, when installing from MXPI sudo password is not being accpeted. After exiting and running dpkg --configure -a in terminal install completed and client is running. Thank you for this fehlix :toast: