Problem setting up a sysvinit service to start on boot  [Solved]

Message
Author
horseyman66

Problem setting up a sysvinit service to start on boot

#1 Post 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!

User avatar
dolphin_oracle
Developer
Posts: 22059
Joined: Sun Dec 16, 2007 12:17 pm

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

#2 Post 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.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

horseyman66

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

#3 Post 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...

User avatar
fehlix
Developer
Posts: 12623
Joined: Wed Apr 11, 2018 5:09 pm

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

#4 Post 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:

horseyman66

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

#5 Post 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

User avatar
fehlix
Developer
Posts: 12623
Joined: Wed Apr 11, 2018 5:09 pm

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

#6 Post 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
You do not have the required permissions to view the files attached to this post.

horseyman66

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

#7 Post by horseyman66 »

lol almost the same as mine, we both got it from https://gist.github.com/RichardBronosky ... 057200bd02

User avatar
fehlix
Developer
Posts: 12623
Joined: Wed Apr 11, 2018 5:09 pm

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

#8 Post 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:

horseyman66

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

#9 Post by horseyman66 »

I messaged you on slack ;)

User avatar
fehlix
Developer
Posts: 12623
Joined: Wed Apr 11, 2018 5:09 pm

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

#10 Post by fehlix »

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

Post Reply

Return to “Software / Configuration”