synit-manual/src/operation/index.md

4.7 KiB
Raw Blame History

System overview

Synit uses the Linux kernel as a hardware abstraction and virtualisation layer.

All processes in the system are arranged into a supervision tree, conceptually rooted at the system bus (NB. not at PID 1).

              +----------------------------------+
              |Root System Bus (syndicateserver)|
              +----------------+-----------------+
                               |
   +--------+--------+---------+----------+---------------+
   |        |        |         |          |               |
+--+--+ +---+---+ +--+--+ +----+----+ +---+---+     +-----+-----+
|init | |console| |udevd| |Network  | |Wifi   |     |Session bus|
+-----+ |getty  | +-----+ |Interface| |Daemon | ... |(syndicate|
        +-------+         |Monitor  | |(wlan0)|     |  server)  |
                          |Daemon   | +-------+     +-----+-----+
                          +---------+                     |
                                                          |
                  +----------+----------------------------+
                  |          |                            |
              +---+---+   +--+--+                    +----+---+
              |Browser|   |Email|       . . .        |X Server|
              +-------+   +-----+                    +--------+

Boot process

The kernel first loads the stock PostmarketOS initrd, which performs a number of important tasks and then delegates to /sbin/init.

/sbin/init = synit-init.sh

The synit-config package overrides the usual contents of /sbin/init, replacing it with a short shell script, synit-init.sh. This script, in turn, takes care of a few boring tasks such as mounting /dev, /proc, /run, etc., ensuring that a few important directories exist, and remounting / as read-write before execing /sbin/synit-pid1.

For the remainder of the lifetime of the system, /sbin/synit-pid1 is the PID 1 init process.

/sbin/synit-pid1

The synit-pid1 program starts by spawning the system bus (syndicate-server in the process tree above) and the program /sbin/synit-log, connecting stderr of the former to stdin of the latter.

It then goes on to perform two tasks concurrently: the first is the Unix init role, reaping zombie processes, and the second is to interact with the system bus as an ordinary system service.

The latter allows the system to treat init just like any other part of the system, accessing its abilities to reboot or power off the system using messages and assertions in the system dataspace as usual.

Even though synit-pid1 is, to the kernel, a parent process of syndicate-server, it is logically a child process.

/sbin/synit-log

This short shell script invokes the S6 program s6-log to capture log output from the system bus, directing it to files in /var/log/synit/.