Should VoidPup run void's runit services?

Moderators: peebee, Forum moderators

Post Reply
artemis
Posts: 44
Joined: Wed Mar 24, 2021 8:16 pm
Has thanked: 8 times
Been thanked: 5 times

Should VoidPup run void's runit services?

Post by artemis »

VoidLinux uses runit for its init system and service manager. But something that is nice about runit is that you dont have to use it for both of those things! You can use it as just a service manager without any of the init system stuff. We could make VoidPup launch the service management part called runsvdir to run service scripts from void packages installed with vpm.

Something I have done on my fossapup install is that I have my /etc/inittab set up to launch runsvdir to manage some runit services I have written to use over there. We could also do this in VoidPup in a way compatible with how void usually uses runit to make it so runit services from installed void packages would work correctly.

Alternatively I could make a sysvinit script to put in /etc/init.d to run runsvdir from there. Maybe there's an advantage there to make sure it runs only once the startup sequence gets to rc.services. (I'm not really sure if my inittab is waiting until after the main puppy startup is done to run runsvdir or not)

Anywayl if any of that is something you are interested in I could get it working and share those changes.

If i did this it might also be nice to make a GUI for managing which runit services are enabled or disabled. runit is pretty simple and mainly just works on whether a file is symlinked somewhere or if the "down" file exists, so this would not be too complicated for me to do

User avatar
peebee
Posts: 1636
Joined: Mon Jul 13, 2020 10:54 am
Location: Worcestershire, UK
Has thanked: 157 times
Been thanked: 714 times
Contact:

Re: Should VoidPup run void's runit services?

Post by peebee »

artemis wrote: Fri Aug 05, 2022 3:45 am

We could make VoidPup launch the service management part called runsvdir to run service scripts from void packages installed with vpm.

Questions:
- does vpm try to run runsvdir? what happens if it is absent?
- have you encountered problems due to the absence of runsvdir?
- are there many void packages with runit service scripts?
- are all void runit service scripts "safe" to run in VoidPup?
- runsvdir is just one app in the runit package - are any other parts of runit needed?

If you can make a package to add to the build in conjunction with runit (perhaps a .pet with a pinstall that deletes the parts of runit that aren't needed?) then happy to consider if it meets a need....

from https://voidlinux.pkgs.org/current/void ... .xbps.html
runit contains:
/usr/bin/chpst
/usr/bin/runit
/usr/bin/runit-init
/usr/bin/runsv
/usr/bin/runsvchdir
/usr/bin/runsvdir
/usr/bin/sv
/usr/bin/svlogd
/usr/bin/utmpset

Builder of LxPups, SPups, UPup32s, VoidPups; LXDE, LXQt, Xfce addons; Chromium, Firefox etc. sfs; & Kernels

User avatar
fredx181
Posts: 3085
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 376 times
Been thanked: 1315 times
Contact:

Re: Should VoidPup run void's runit services?

Post by fredx181 »

There's also package "runit-void" : https://voidlinux.pkgs.org/current/void ... .xbps.html

User avatar
peebee
Posts: 1636
Joined: Mon Jul 13, 2020 10:54 am
Location: Worcestershire, UK
Has thanked: 157 times
Been thanked: 714 times
Contact:

Re: Should VoidPup run void's runit services?

Post by peebee »

fredx181 wrote: Fri Aug 05, 2022 10:02 am

There's also package "runit-void" : https://voidlinux.pkgs.org/current/void ... .xbps.html

I think it adds the runit system services needed by Void - and therefore would not be needed for VoidPup..... but I may be wrong!

Builder of LxPups, SPups, UPup32s, VoidPups; LXDE, LXQt, Xfce addons; Chromium, Firefox etc. sfs; & Kernels

artemis
Posts: 44
Joined: Wed Mar 24, 2021 8:16 pm
Has thanked: 8 times
Been thanked: 5 times

Re: Should VoidPup run void's runit services?

Post by artemis »

So the way it works is basically you run runsvdir on a service directory, and then runsvdir will use runsv on each of the folders inside that. the sv command is used for stop/start/restarting like "sv stop <name>" "sv restart <name>" etc.

You can see this page for how it's recommended to use runit with other init systems http://smarden.org/runit/useinit.html via inittab or /etc/rc.local (but probably rc.services for us). This page mentions a file called runsvdir-start which void's runit package does not include. But its just a small shell script!

Code: Select all

#!/bin/sh

PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin

exec env - PATH=$PATH \
runsvdir -P /service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'

To your other questions!

Q: does vpm try to run runsvdir? what happens if it is absent?
A: no it doesnt. runsvdir is something the init system does to manage a service directory and that is about it. The way runit enables new services is just by symlinking from one folder (the folder with all possible services) into another folder (the folder with all enabled services) and then the already-running runsvdir will see them and turn them on. So if runsvdir is absent nothing explodes.

Q: have you encountered problems due to the absence of runsvdir?
Q: are there many void packages with runit service scripts?
A: The answer to these are sort of the same. Basically there are some packages with services to manage daemons. A lot are the sort of things you would run on a server- like nginx and mysql. BUT some are services that are good to have on a desktop. For example, the void package for tailscale (a meshnet vpn service) uses a runit service to launch tailscaled. Other examples I have personally used on desktop systems are tor, lm_sensors' and thinkfans' fan control services, syncthing, tlp (power saving tool), virtualbox, and wireguard. So it is nice to have the services working for these in my opinion. I also like to run a lot of my own runit scripts so I like to have it working anyway.

Q: are all void runit service scripts "safe" to run in VoidPup?
A: I think some are and some are not. While i like services I also know it can be annoying if software is running in the background just because you installed it. Stuff like tailscale, tlp, syncthing, or thinkfan only make sense to install if you have the service turned on but other things like tor or hiawatha maybe you don't want the service on by default. I don't remember if void defaults to enabling services on install or if it leaves them disabled by default. I need to download all the packages with runit scripts and see what they do.

If everything defaults to disabled then whether it's safe is not a big concern. But if some default to enabled, then maybe a better option would be to make a separate voidpup runit service folder and use runsvdir on that. That way we make sure the only things running are things turned on on purpose.

Q: runsvdir is just one app in the runit package - are any other parts of runit needed?
A: Yeah some other parts are but I do not remember specifically which parts can be discarded when you are not using it as an init system.

From reading the official docs at http://smarden.org/runit/, I know you need
- sv
- runsvdir
- runsvchdir
- runsv
- chpst (used by most of the runit services for changing user / privileges if needed)

I know that some services also use svlogd to write their logs into /var/log including syncthing. So it's probably best to have that too. I have not tested deleting the other things to make 100% sure this is all that is needed!

Clarity
Posts: 3842
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1632 times
Been thanked: 526 times

Re: Should VoidPup run void's runit services?

Post by Clarity »

Curious

Is this a replacement for PUP's current INIT or is this an implementation which follows INIT subsequent to boot?

User avatar
rockedge
Site Admin
Posts: 6552
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2757 times
Been thanked: 2628 times
Contact:

Re: Should VoidPup run void's runit services?

Post by rockedge »

Yes @Clarity, runit has a function similar to what systemd does in Debian or Ubuntu. It deals with services, like for a Hiawatha web server that will start automatically during system boot when enabled. Then can be controlled with commands like sv stop hiawatha once configured to do so.

User avatar
fredx181
Posts: 3085
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 376 times
Been thanked: 1315 times
Contact:

Re: Should VoidPup run void's runit services?

Post by fredx181 »

Lots of info on reddit about (void) runit can be found.
This strokes me as as being a very clear view (and with lot of humor :lol: ) on runit and on (lack of ?) boot optimization and prioritizing services (brilliant simplicity .... :?: :shock: );
https://www.reddit.com/r/voidlinux/comm ... _services/ , see second post by "etosan".
Small excerpt;

....
Edgy former archer teen now might ask: "But, but, but ... that means no dependecies senpai? Runit sucks! This is the end!"

No, wrong my young friend, this is just the glorious beginning :).

Most glorious, indeed!
....

artemis
Posts: 44
Joined: Wed Mar 24, 2021 8:16 pm
Has thanked: 8 times
Been thanked: 5 times

Re: Should VoidPup run void's runit services?

Post by artemis »

Clarity wrote: Sat Aug 06, 2022 1:37 am

Curious

Is this a replacement for PUP's current INIT or is this an implementation which follows INIT subsequent to boot?

runit has init and service management split up so that you can have either one without the other. So in theory one COULD replace current INIT with runit. and I think maybe that is an interesting idea for someone to explore.

but that's not what I'm proposing. I'm suggesting we set up runit to be able to do service management on the services that come installed out of the box with many softwares accessible from vpm (void linux uses runit, so its software comes with runit services). So the normal puppy init would run just like it does now, including launching all the /etc/init.d services. And then it would also launch runit to manage on any enabled void services. Which is ok because runit is very very lightweight! So this will not eat up extra resources unnecessarily.

By the way, to a thing I mentioned earlier- I spoke with a friend who has been a long time void user and they told me void packages do NOT come with their runit services enabled by default on install. To quote, "at most they have an INSTALL.msg that prints on the terminal to tell the user to make the symlink to enable the service" (enabling is done by symlinking a service folder from one place to another). So that is good news in my opinion- no surprises by doing this!

Post Reply

Return to “VoidPup”