Home Explore Blog CI



man-pages

3rd chunk of `init.man`
ab1aaf7bcdd1857827bc6ae5f69f9422208ddabe5a1f6dd40000000100000faf
 pulling them in via dependencies. Usually, the unit name is just an alias (symlink) for
       either graphical.target (for fully-featured boots into the UI) or multi-user.target (for limited console-only boots for use in embedded or server environments, or similar; a subset of graphical.target). However, it is
       at the discretion of the administrator to configure it as an alias to any other target unit. See systemd.special(7) for details about these target units.

       On first boot, systemd will enable or disable units according to preset policy. See systemd.preset(5) and "First Boot Semantics" in machine‐id(5).

       systemd only keeps a minimal set of units loaded into memory. Specifically, the only units that are kept loaded into memory are those for which at least one of the following conditions is true:

        1. It is in an active, activating, deactivating or failed state (i.e. in any unit state except for "inactive")

        2. It has a job queued for it

        3. It is a dependency of at least one other unit that is loaded into memory

        4. It has some form of resource still allocated (e.g. a service unit that is inactive but for which a process is still lingering that ignored the request to be terminated)

        5. It has been pinned into memory programmatically by a D-Bus call

       systemd will automatically and implicitly load units from disk — if they are not loaded yet — as soon as operations are requested for them. Thus, in many respects, the fact whether a unit is loaded or not is invisible
       to clients. Use systemctl list-units --all to comprehensively list all units currently loaded. Any unit for which none of the conditions above applies is promptly unloaded. Note that when a unit is unloaded from
       memory its accounting data is flushed out too. However, this data is generally not lost, as a journal log record is generated declaring the consumed resources whenever a unit shuts down.

       Processes systemd spawns are placed in individual Linux control groups named after the unit which they belong to in the private systemd hierarchy. (see Control Groups v2[1] for more information about control groups,
       or short "cgroups"). systemd uses this to effectively keep track of processes. Control group information is maintained in the kernel, and is accessible via the file system hierarchy (beneath /sys/fs/cgroup/), or in
       tools such as systemd‐cgls(1) or ps(1) (ps xawf -eo pid,user,cgroup,args is particularly useful to list all processes and the systemd units they belong to.).

       systemd is compatible with the SysV init system to a large degree: SysV init scripts are supported and simply read as an alternative (though limited) configuration file format. The SysV /dev/initctl interface is
       provided, and compatibility implementations of the various SysV client tools are available. In addition to that, various established Unix functionality such as /etc/fstab or the utmp database are supported.

       systemd has a minimal transaction system: if a unit is requested to start up or shut down it will add it and all its dependencies to a temporary transaction. Then, it will verify if the transaction is consistent (i.e.
       whether the ordering of all units is cycle-free). If it is not, systemd will try to fix it up, and removes non-essential jobs from the transaction that might remove the loop. Also, systemd tries to suppress
       non-essential jobs in the transaction that would stop a running service. Finally it is checked whether the jobs of the transaction contradict jobs that have already been queued, and optionally the transaction is
       aborted then. If all worked out and the transaction is consistent and minimized in its impact it is merged with all already outstanding jobs and added to the run queue. Effectively this means that before executing a
       requested operation, systemd will verify that it makes sense, fixing it if possible, and only failing

Title: Systemd Boot Process, Memory Management, and Compatibility
Summary
This section describes systemd's boot process, where the default.target unit is activated, aliased to graphical.target or multi-user.target, and customizable by the administrator. It explains how systemd handles unit enablement on the first boot, guided by preset policies. It details systemd's memory management, keeping only units in active states, those with queued jobs, dependencies, allocated resources, or those programmatically pinned in memory. Systemd automatically loads units from disk when needed and unloads them promptly when conditions no longer apply. Processes are placed in individual Linux control groups for effective tracking, accessible via the file system or tools like systemd-cgls(1). The text highlights systemd's compatibility with SysV init, supporting init scripts and providing compatibility implementations. Finally, it explains systemd's transaction system, which verifies the consistency of unit operations before execution, fixing inconsistencies if possible.