s6 Init Sequence - blitterated/docker-dev-env-s6 GitHub Wiki

First read this description of s6's init sequence and code

s6-overlay / doc / init.txt

s6 initialization sequence

stage0 call to s6-linux-init-maker

Here's the call to s6-linux-init-maker, which can be found in stage0 here.

s6-linux-init-maker -NC -D top -c "$basedir" -p "$PATH" -f /package/admin/s6-overlay-@VERSION@/etc/s6-linux-init/skel $stampopt $dumpopt $logopt $loguseropt $graceopt $syncopt -- "$basedir"

Impact on s6-linux-init-maker variable values:

| switch | variable | value | comments | | ----- | ----- | ----- | | -N | mounttype | 0 | passed in as -NC | | -C | inns | 1 | passed in as -NC | | -D | initdefault | top | | | -c | robase | /run/s6/basedir | passed as -c "$basedir". basedir set here | | -f | skeldir | /package/admin/s6-overlay-@VERSION@/etc/s6-linux-init/skel | Directory contents can be seen here | | -p | initial_path | /command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | passed as -p "$PATH". This picks up on what was set in /init. See here for how it's added. See here, here, and here for defaults. | | -s | env_store | /run/s6/container_environment | set due to S6_KEEP_ENV | | -B | nologger | 1 | set due to lack of S6_LOGGING |

s6-linux-init-maker generated init script

Dumped in container with:

cat /run/s6/basedir/bin/init

Contents:

#!/package/admin/execline/command/execlineb -S0

/package/admin/s6-linux-init/command/s6-linux-init -c "/run/s6/basedir" -m 0022 -p "/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -s "/run/s6/container_environment" -D "top" -N -C -B -- "$@"

Impact on s6-linux-init variable values:

switch variable value
-c basedir /run/s6/basedir
-m if (!uint0_oscan(l.arg, &mask)) dieusage() Default for mask is 0022, root's umask. I think this is checking that umask matches either root or another explicitly specified user's umask
-p path /command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-s envdumpdir /run/s6/container_environment
-D initdefault top
-N mounttype 0
-C inns 1
-B nologger 1

Other observations

switch var name info links
-d slashdev specify a devtmpfs directory overriding udev and /dev tmpfs using devtmpfs for /dev
-C inns is this used to specify an init runlevel? tldp: Run Levels, s6-linux-init code that looks like run levels