Re: Journey to s6-svscan as PID 1 on FreeBSD (almost there)

From: Crest <crest_at_rlwinm.de>
Date: Thu, 8 Apr 2021 20:29:33 +0200

On 08.04.21 15:15, Dewayne Geraghty wrote:
> First we started with the documented approach of appending to /etc/ttys
> "" "/usr/local/bin/s6-svscan /run/scan" "" on
>
> Which worked nicely under FreeBSD's /sbin/init.
>
> Then we added to loader.conf an init_script which is invoked via
> /sbin/init. This also
> worked well, but init remained as pid 1. The init_script variable is
> defined in /boot/loader.conf, in my case as:
> init_script="/root/bin/init_script.sh
> /sbin/init calls "init_script"
>
> This ran nicely, but still under init as pid=1.
>
> Finally I sucked up the courage and defined in /boot/loader.conf
> init_exec=/root/bin/init_exec.sh
> which contains
> #!/usr/local/bin/execlineb -S0
> redirfd -wnb 1 /m/fifo/catch_all
> redirfd -r - /dev/null
> fdmove -c 2 1
> exec -c /sbin/s6/svscan -t 0 -s /s/scan
>
> And finally /sbin/s6-svscan runs as pid 1.
There is a cleaner solution. I prefer to set the init_path kernel env
var in /boot/loader.conf and prepend the s6 stage1 script to the normal
search path. That way the kernel starts my execline script as PID 1 and
if I mess it I just have to clear the variable from the loader prompt.
Received on Thu Apr 08 2021 - 18:29:33 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC