2015-09-09 2:04 GMT-03:00 Steve Litt: > > If I want to use s6 as my init, what do I do, just put into my Grub > kernel line init=/usr/bin/s6 or whatever the s6 executable is?
If you want to use the s6-linux-init package and minimum customization, in addition to s6 and s6-linux-init, you'll need to download and build two more skarnet.org packages, s6-linux-utils and s6-portable-utils, and then you can follow the quickstart guide: http://www.skarnet.org/software/s6-linux-init/quickstart.html The described procedure however replaces /sbin/init, after backing it up, with the saved output of s6-linux-init-maker, i.e. /tmp/init, which is what the s6-linux-init documentation calls "the stage1 script". If you want to go the "new GRUB menu entry" route, it would change to something like: (As root) rm -rf /tmp/s6-linux-init /tmp/s6-stage1-init s6-linux-init-maker [options] /tmp/s6-linux-init > /tmp/s6-stage1-init chmod 0700 /tmp/s6-stage1-init mv /tmp/s6-linux-init /etc mv /tmp/s6-stage1-init /sbin The new GRUB menu entry can then pass an 'init=/sbin/s6-stage1-init' option to the kernel. And you halt, reboot or poweroff the machine with 's6-svscanctl -st /run/service', 's6-svscanctl -rt /run/service' or 's6-svscanctl -pt /run/service', respectively. The s6-linux-init-maker options you may additionally need or want are -d, -u, -p and -e. Note that you also need to write two scripts, /etc/rc.init and /etc/rc.shutdown. These are what the s6-linux-init documentation calls "the stage2 script" and "the stage3 script". But they serve the same purpose as the ones in your Suckless Init document, so you already know what goes in there. There are some notable differences, though: * The scan directory is /run/service, not /service, so it will be a directory in a tmpfs, that is created and populated at boot time with a (very small) initial set of services by the stage1 script. You then have to copy or make symbolic links to the service directories you want, which you would have in a non-volatile "service repository", like /etc/sv, /var/service, /var/svc.d as OpenRC likes it, etc. and then do an 's6-svscanctl -a /run/service'. All these actions can be programmed inside /etc/rc.init. * /etc/rc.init will start executing when s6-svscan is already running as process 1, so you don't need to call any svscanboot-like command at the end of the script. You just let it finish and return when it's done. It will be running as a child of s6-svscan and get reaped when it returns. * /etc/rc.shutdown will be called with a single argument: 'halt', 'poweroff' or 'reboot', depending on the requested shutdown mode. And will run as process 1 when the machine is shutting down, so if it aborts or exits before executing the final halt, reboot or poweroff, you'll get a kernel panic. Write it carefully. * Inside /etc/rc.shutdown, you can use s6-halt, s6-poweroff and s6-reboot in place of sysvinit's counterparts. These programs come with the s6-linux-utils package. And you can use 's6-nuke -t' and 's6-nuke -k' in place of 'killall5 -15' and 'killall5 -9', respectively. The s6-nuke program comes with the s6-portable-utils package. This will remove all dependencies on sysvinit-like binaries. In particular, the ones that expect to talk to process 1 through /dev/initctl won't even work. Cheers, G.
