:: Re: [DNG] Thoughts and infos on unm…
Forside
Slet denne besked
Besvar denne besked
Skribent: Steve Litt
Dato:  
Til: dng
Emne: Re: [DNG] Thoughts and infos on unmerged layout
tito via Dng said on Wed, 29 Nov 2023 15:29:45 +0100

>On Wed, 29 Nov 2023 10:27:03 -0300
>altoid via Dng <dng@???> wrote:


>I fully agree, let's stick with sysvinit until things are sorted out
>and stabilized, later on other init systems could be added
>if devuan is still alive.


I've been recommending this for years, with one alteration...

An init system consists of both a PID1 and a daemon manager/supervisor.
There's absolutely nothing wrong with sysvinit's PID1: It's great.
About the only good thing I can say about sysvinit's daemon manager is
it's better than the daemon manager of systemd. But this is not a
ringing endorsement.

It's relatively easy to use the PID1 of sysvinit and the daemon
supervisor of runit. You just put a simple command in /etc/inittab to
respawn runit, and you're good to go.

Simple instructions right here:

http://smarden.org/runit/useinit.html#sysv

The root of the runit documentation is here:

http://smarden.org/runit/index.html

Once the runit daemon supervisor (runsvdir) is respawned from
/etc/inittab, you can begin to switch daemons, one at a time,
to runit. Disable a sysvinit init script, create a runit run script,
fire it off and test. If it takes you a year to move most from sysvinit
to runit, so what? Where do you get the runit run script? Well, start
here:

http://smarden.org/runit/runscripts.html

These run scripts might require a little modification to run on *your*
setup, but sheesh, the vast majority are under 10 lines long.

By the way, if I were you I wouldn't try to make runlevels. Runlevels
make my Void runit setup much more difficult, and I bet they'll make
your Devuan setup harder too. I had runlevels thrust on me, but you
hopefully don't, especially if you ./configure;make;make install the
source. I did this in the Manjaro Experiments
(http://troubleshooters.com/linux/init/manjaro_experiments.htm), and
even though I didn't know squat back in those days, it was pretty easy
for me to do.

Installing runit is as simple as the following:

http://smarden.org/runit/install.html

You can either set directories the djb way, with /service right off the
root, or you can do it the LSB way, or the Debian way, or whatever.
Your software, your rules.

Because runit does parallel startups, you need daemon dependency
handling. No problem. See the following for the Gerrit Pape (runit
author) technique:

http://smarden.org/runit/faq.html#depends

Or you can do it the Steve Litt way, with a test. The following
run script refuses to run my_web_server until the network is up:

================================
#!/bin/sh
exec 2>&1
ping -W0.1 -c1 8.8.8.8 > /dev/null || exit 1
exec my_daemon
================================

The preceding tests always-up 8.8.8.8, so if it fails, your network has
problems and it exits. Five seconds later runit tries again, and if by
that time the network is up, it succeeds.

The preceding is good enough for me, because if it keeps retrying over
and over I'll find out. But what if you want to get emailed or logged
or whatever, or even quit after four tries.

Just insert a message-sending shellscript into the ping pipeline and
have that message-sending count the failures, and if over 5
the shellscript would send a message and wait a long time or disable
the daemon by placing a stop file in the daemon's runit directory.
The message sender returns error so you can simply or it with the
ping and then or the exit with the message-sender. I don't go to all
this trouble, but it's not hard to do if you're a purist wanting
messages or logs and shutdown of the daemon. Maybe some time I'll post
an example of such a message-sender.

Anyway, using a PID1 of sysvinit and slowly migrating daemon by daemon
from sysvinit to runit is easy and a good way to learn runit.
Personally I'm not as pessimistic about the future of Devuan some of
you, but if you're pessimistic it behooves you to learn a new init,
starting with the daemon supervisor, and then once that's under your
belt using the runit PID1.

SteveT

Steve Litt

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21