Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [Solved] How to test init services? (Read 829 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[Solved] How to test init services?

Hi there,
How to test services for multiple init systems without switching default init systems?

For instance, right now dinit is default init on my system. I want to test some services of openrc or runit. What can be optimal solution for this situation?
Create problems which don't have solution


Re: How to test init services?

Reply #2
@strajder Can chroot environment be used for testing inits?
For me Updating VMs is too difficult because internet is not good
Create problems which don't have solution


Re: How to test init services?

Reply #4
If you only need to test a single service for particular service manager, you could also try to use container, though it can be a little more tricky
ARMtix

 

Re: How to test init services?

Reply #5
Runit is extremely modular, and you can reasonably test a service by just extracting the runsv executable from the runit package and running sudo runsv /path/to/service. Of course, you'd want to stop the service in your "real" init before doing so.

Dinit also accepts command-line switches telling from where it should load service definitions, and you can leverage them to test dinit for a single service (though the effect of dependencies can only really be tested with a container/VM).

I don't see a quick n' dirty way to test S6 and OpenRC services without a VM or a container, though.

Re: How to test init services?

Reply #6
I don't see a quick n' dirty way to test S6 and OpenRC services without a VM or a container, though.
You can actually quick n' dirty test s6 but not s6-rc. Anyone can just grab s6 from the repos (pacman -S s6) since it doesn't replace init or anything to get the needed programs/libraries. Then just make a service directory and run sudo s6-supervise /path/to/directory. If you need to test more sophisticated s6-rc features (dependencies, logging, etc.), then that wouldn't really suffice but if you just want to check some simple then that would work.

Re: How to test init services?

Reply #7
If you build / download a copy of the openrc package then unpack it somewhere then change the shebang of the script to point to this non standard location of openrc-run it might work to some degree at least:
Code: [Select]
$ tar -xvf openrc-0.44.10-1-x86_64.pkg.tar.zst
new shebang:
#!/tmp/openrc/test/usr/bin/openrc-run
/tmp/openrc/test$ sudo rc-status |ag clamd
 clamd                                                             [  started  ]
/tmp/openrc/test$ sudo ./clamd stop
/tmp/openrc/test$ sudo rc-status |ag clamd
 clamd                                                             [  stopped  ]
I have openrc installed already though, this approach might possibly help you try out some things but I wouldn't really trust any test like this for production use, a VM would be better, as the fs is compressed they don't take up as many resources as you might imagine and you could probably just update the OS in the vm once in a while when it has been installed.

Re: How to test init services?

Reply #8
Thanks for your responses, So I am going with VMs
Create problems which don't have solution