Re: Can you use s6-rc with the sysvinit PID1?
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
Re: Can you use s6-rc with the sysvinit PID1?
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
Can you use s6-rc with the sysvinit PID1?
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