It's generally a bad idea to close fd 2: it makes your system non-conformant to POSIX, and umount, if it assumes a conformant system, could have undefined behaviour here. If you don't want error messages, better redirect fd 2 to /dev/null instead. (util-linux's umount doesn't care, but that doesn't mean it's true for all other umount implementations.)
Thanks for the heads up I will not do this.
This is dangerous, because redirfd -wnb on a fifo will briefly open the fifo for reading (yes, it's a hack!) so depending on the scheduler your last redirfd can unblock the previous redirfd waiting on the catch-all logger, and spawn your rc.init too early. Use fdmove -c 2 1 instead of the last redirfd -wnb to ensure proper synchronization of your rc.init.
I learned that the hard way, after about an hour of trial and error xD
What init messages? If something floods you, it's probably that some s6-supervise is failing to bring a service up, and is trying again one second later.So it's likely that you just have something failing in your boot process.
All of the boot messages.It was due to the logger with the 1 directive duping to stdout which endet up in the catch all logger, duping it to stdout, ...
Exactly what Guillermo described here, except I forgot the -X fd:
If I understand correctly, it is the combined effect of:
* s6-linux-init (the program) dup()'ing standard error, and passing
the resulting file descriptor to s6-svscan using its -X option.
* s6-svscan acting on the -X option and redirecting the standard error
of the catch-all logger's s6-supervise process to the console.
* If using the catch-all logger 'run' script generated by s6-linux-init-maker:
* The script redirecting standard error to standard output (with
execline's fdmove)
* The script invoking s6-log with the '1' action directive (copy
logged messages to standard output).
I fixed it with s6-svscan -X.
This solves all issues, the current(tested) script looks like this:
| #!/usr/bin/execlineb
|
| export PATH /usr/bin/:/bin
|
| multisubstitute {
| define UMASK 0022
| define TMPFSDIR /run
| define BASEDIR /etc/s6-linux-init/current
| define RUNLEVEL default
| }
|
| foreground { echo s6-init }
|
| execline-cd /
| execline-umask ${UMASK}
|
| setsid
|
| redirfd -r 0 /dev/null
|
| foreground { redirfd -a 2 /dev/null umount ${TMPFSDIR} }
|
| if { mount -t tmpfs -o mode=0755 tmpfs ${TMPFSDIR} }
|
| if { cp -Rf ${BASEDIR}/run-image/. ${TMPFSDIR}/ }
|
| s6-envdir ${BASEDIR}/env
|
| redirfd -w -nb 1 ${TMPFSDIR}/service/s6-svscan-log/fifo
|
| background {
| redirfd -w 2 ${TMPFSDIR}/service/s6-svscan-log/fifo
| ${BASEDIR}/scripts/rc.init ${RUNLEVEL}
| }
|
| fdmove -c 2 1
|
| redirfd -w 3 /dev/console
|
| s6-svscan -X 3 ${TMPFSDIR}/service
Thank you both for your input!
Regards
Paul
OpenPGP_0x71C7C85A2EA30F62.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature
