supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Can you use s6-rc with the sysvinit PID1?
@ 2020-10-23 16:48 Steve Litt
  2020-10-23 17:04 ` Laurent Bercot
  2020-10-24  5:25 ` Colin Booth
  0 siblings, 2 replies; 3+ messages in thread
From: Steve Litt @ 2020-10-23 16:48 UTC (permalink / raw)
  To: supervision

Hi all,

If I use sysvinit's PID1, is it possible for me to use s6-rc by
declaring an s6-rc program in /etc/inittab?

Also, and this is offtopic, is there a way to tell sysvinit not to run
the programs in /etc/rc.d/rc3.d or whatever? This would make it trivial
to switch between an sysvinit initted system and an s6-rc/s6 supervised
system just by commenting in or out the inittab entry and switching
sysvinit to looop /etc/rc.d/rc3.d?

Thanks,

SteveT

Steve Litt 
Autumn 2020 featured book: Thriving in Tough Times
http://www.troubleshooters.com/thrive

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can you use s6-rc with the sysvinit PID1?
  2020-10-23 16:48 Can you use s6-rc with the sysvinit PID1? Steve Litt
@ 2020-10-23 17:04 ` Laurent Bercot
  2020-10-24  5:25 ` Colin Booth
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Bercot @ 2020-10-23 17:04 UTC (permalink / raw)
  To: Steve Litt, supervision

>If I use sysvinit's PID1, is it possible for me to use s6-rc by
>declaring an s6-rc program in /etc/inittab?

  Yes. You have to tell /etc/inittab to launch a s6 supervision tree
first, then s6-rc-init, then s6-rc -u change top (if "top" is the bundle
containing all the services you need), as one-time services.

  There is an example with OpenRC in Adélie: a sysvinit init, that
controls a s6 supervision tree then runs an openrc service manager.
  
https://code.foxkit.us/adelie/packages/-/blob/master/system/sysvinit/inittab-2.88
(The s6-svscanboot code is in the same directory in the repository.)
  If you remove the 'openrc sysinit' and 'openrc boot' lines,
and change the 'openrc $runlevel' lines below to 's6-rc change 
$runlevel'
invocations, then you will have a s6-rc managed system running on top
of sysvinit.

  However, it's much more work to convert a set of init scripts to
s6-rc than it is to switch from sysvinit to s6-linux-init, so you may
just as well switch to s6-linux-init first and spare yourself some
unnecessary work and some ugly init code. ;)


>Also, and this is offtopic, is there a way to tell sysvinit not to run
>the programs in /etc/rc.d/rc3.d or whatever? This would make it trivial
>to switch between an sysvinit initted system and an s6-rc/s6 supervised
>system just by commenting in or out the inittab entry and switching
>sysvinit to looop /etc/rc.d/rc3.d?

  You can just comment out the lines you don't want in /etc/inittab.
  However, controlling init via a file is awkward and fragile, and you
may find yourself performing a lot of scripting (and making your
system unbootable and having to recover via init=/bin/sh once or
twice), which is another reason why s6-svscan makes a better pid 1.

--
  Laurent


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can you use s6-rc with the sysvinit PID1?
  2020-10-23 16:48 Can you use s6-rc with the sysvinit PID1? Steve Litt
  2020-10-23 17:04 ` Laurent Bercot
@ 2020-10-24  5:25 ` Colin Booth
  1 sibling, 0 replies; 3+ messages in thread
From: Colin Booth @ 2020-10-24  5:25 UTC (permalink / raw)
  To: supervision

On Fri, Oct 23, 2020 at 12:48:47PM -0400, Steve Litt wrote:
> Hi all,
> 
> If I use sysvinit's PID1, is it possible for me to use s6-rc by
> declaring an s6-rc program in /etc/inittab?
> 
> Also, and this is offtopic, is there a way to tell sysvinit not to run
> the programs in /etc/rc.d/rc3.d or whatever? This would make it trivial
> to switch between an sysvinit initted system and an s6-rc/s6 supervised
> system just by commenting in or out the inittab entry and switching
> sysvinit to looop /etc/rc.d/rc3.d?
> 
> Thanks,
> 
> SteveT
> 
Yes. In your /etc/inittab call a script that backgrounds the rc call
hanging on some event. Here's an execline fragment that'll do what you
want, though it could obviously be made a lot better by taking advantage
of the native readyness notification that s6-svscan provides instead of
sleeping for a second.

background {
  foreground { sleep 1 }
  foreground { s6-rc-init /path/to/scandir }
  s6-rc change up
}
s6-svscan /path/to/scandir

Jam that into the startup script that you use for booting your
supervision tree and you'll be good to go.

-- 
Colin Booth

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-24  5:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23 16:48 Can you use s6-rc with the sysvinit PID1? Steve Litt
2020-10-23 17:04 ` Laurent Bercot
2020-10-24  5:25 ` Colin Booth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).