book/operation/index
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.
+----------------------------------+
|Root System Bus (syndicate–server)|
+----------------+-----------------+
|
+--------+--------+---------+----------+---------------+
| | | | | |
+--+--+ +---+---+ +--+--+ +----+----+ +---+---+ +-----+-----+
|init | |console| |udevd| |Network | |Wifi | |Session bus|
+-----+ |getty | +-----+ |Interface| |Daemon | ... |(syndicate–|
+-------+ |Monitor | |(wlan0)| | server) |
|Daemon | +-------+ +-----+-----+
+---------+ |
|
+----------+----------------------------+
| | |
+---+---+ +--+--+ +----+---+
|Browser| |Email| . . . |X Server|
+-------+ +-----+ +--------+
While init is PID 1, and thus the root of the tree of
processes according to the kernel, it is not the root of the
supervision tree. The init process, acting as management
daemon for the kernel from Synit’s perspective, is “supervised”
by the system bus like all other services. The supervision tree is a
Synit concept, not a Linux concept.
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
- Source code:
[synit]/synit-pid1/ - Packaging:
[synit]/packaging/packages/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
- Source code:
[synit]/packaging/packages/synit-pid1/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/.
Copyright © 2021–2023 Tony Garnock-Jones, CC BY 4.0
