Bedrock Linux should support getting an init from a client. There are a number
of things that make this tricky, but it does seem like it might be possible.
/sbin/init, the first process run, should be a Bedrock Linux program. It
will likely be a shell script. This will read some configuration to
determine which init the user desires from which client and then proceeds to
do setup work for that particular init. The setup work will do things such as:
When Bedrock Linux's /sbin/init finishes setup, it will exec() to brc which
then exec()'s the target init. Using the exec()s for this is important
because some inits, most notably systemd, require being PID1. When performing
an exec() the PID does not change between the parent and new executable -
they're effectively the same process.
It may be necessary to have the target init call something to finalize
bedrock-specific setup when the target init's one-time setup is done, if that
type of thing could not be done by Bedrock's /sbin/init before hand without
messing up the target init.
It may be useful to have /sbin/init start a getty in an unusual place, such as
TTY9, as a fall back in case the client init fails. We may want to wrap this
getty in a loop so it automatically restarts.
Once implicit path pinning is setup, that should ensure the target init's
commands - such as systemctl - are provided by the exact same client providing
It may be wise to have brs refuse, or at least warn, about disabling the client
providing init, as that will likely crash the entire system.
I have successfully booted Bedrock Linux using systemd from an Arch Linux client. systemctl shows everything started correctly, and everything, both systemd- and bedrock-specific, seems to be working fine. Things like suspending when a laptop's lid is closed "just work". Various utilities may have to be at least partially re-written to support some changes this requires. Minimal testing has thus far been done for other init systems; however, systemd seems to be both the pickiest and most difficult to debug, and so if systemd is working it is very likely the others will fall in line with less work.
I have successfully booted Bedrock Linux using the inits from Arch (systemd), Debian (sysv), and Ubuntu (upstart). Everything works as expected. While I have not yet tested other init systems such as openrc, it seems this general strategy works.
The only issues with the strategy which are currently evident:
The cleanest solution to the mount point issues discussed above is to
pivot_root so that the client which provides init will be on the "real root"
in the global/primary/default mount namespace. It will then be able to see all
of the other mount points on the system and be able to unmount them on
Side effects of this strategy:
bri -p 1
Done in 1.0beta2 Nyla