diff options
Diffstat (limited to 'documentation/dev-manual/init-manager.rst')
-rw-r--r-- | documentation/dev-manual/init-manager.rst | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/documentation/dev-manual/init-manager.rst b/documentation/dev-manual/init-manager.rst new file mode 100644 index 0000000000..0617fed516 --- /dev/null +++ b/documentation/dev-manual/init-manager.rst | |||
@@ -0,0 +1,89 @@ | |||
1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK | ||
2 | |||
3 | Selecting an Initialization Manager | ||
4 | *********************************** | ||
5 | |||
6 | By default, the Yocto Project uses SysVinit as the initialization | ||
7 | manager. However, there is also support for systemd, which is a full | ||
8 | replacement for init with parallel starting of services, reduced shell | ||
9 | overhead and other features that are used by many distributions. | ||
10 | |||
11 | Within the system, SysVinit treats system components as services. These | ||
12 | services are maintained as shell scripts stored in the ``/etc/init.d/`` | ||
13 | directory. Services organize into different run levels. This | ||
14 | organization is maintained by putting links to the services in the | ||
15 | ``/etc/rcN.d/`` directories, where `N/` is one of the following options: | ||
16 | "S", "0", "1", "2", "3", "4", "5", or "6". | ||
17 | |||
18 | .. note:: | ||
19 | |||
20 | Each runlevel has a dependency on the previous runlevel. This | ||
21 | dependency allows the services to work properly. | ||
22 | |||
23 | In comparison, systemd treats components as units. Using units is a | ||
24 | broader concept as compared to using a service. A unit includes several | ||
25 | different types of entities. Service is one of the types of entities. | ||
26 | The runlevel concept in SysVinit corresponds to the concept of a target | ||
27 | in systemd, where target is also a type of supported unit. | ||
28 | |||
29 | In a SysVinit-based system, services load sequentially (i.e. one by one) | ||
30 | during init and parallelization is not supported. With systemd, services | ||
31 | start in parallel. Needless to say, the method can have an impact on | ||
32 | system startup performance. | ||
33 | |||
34 | If you want to use SysVinit, you do not have to do anything. But, if you | ||
35 | want to use systemd, you must take some steps as described in the | ||
36 | following sections. | ||
37 | |||
38 | Using systemd Exclusively | ||
39 | ========================= | ||
40 | |||
41 | Set these variables in your distribution configuration file as follows:: | ||
42 | |||
43 | DISTRO_FEATURES:append = " systemd" | ||
44 | VIRTUAL-RUNTIME_init_manager = "systemd" | ||
45 | |||
46 | You can also prevent the SysVinit distribution feature from | ||
47 | being automatically enabled as follows:: | ||
48 | |||
49 | DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" | ||
50 | |||
51 | Doing so removes any | ||
52 | redundant SysVinit scripts. | ||
53 | |||
54 | To remove initscripts from your image altogether, set this variable | ||
55 | also:: | ||
56 | |||
57 | VIRTUAL-RUNTIME_initscripts = "" | ||
58 | |||
59 | For information on the backfill variable, see | ||
60 | :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED`. | ||
61 | |||
62 | Using systemd for the Main Image and Using SysVinit for the Rescue Image | ||
63 | ======================================================================== | ||
64 | |||
65 | Set these variables in your distribution configuration file as follows:: | ||
66 | |||
67 | DISTRO_FEATURES:append = " systemd" | ||
68 | VIRTUAL-RUNTIME_init_manager = "systemd" | ||
69 | |||
70 | Doing so causes your main image to use the | ||
71 | ``packagegroup-core-boot.bb`` recipe and systemd. The rescue/minimal | ||
72 | image cannot use this package group. However, it can install SysVinit | ||
73 | and the appropriate packages will have support for both systemd and | ||
74 | SysVinit. | ||
75 | |||
76 | Using systemd-journald without a traditional syslog daemon | ||
77 | ========================================================== | ||
78 | |||
79 | Counter-intuitively, ``systemd-journald`` is not a syslog runtime or provider, | ||
80 | and the proper way to use systemd-journald as your sole logging mechanism is to | ||
81 | effectively disable syslog entirely by setting these variables in your distribution | ||
82 | configuration file:: | ||
83 | |||
84 | VIRTUAL-RUNTIME_syslog = "" | ||
85 | VIRTUAL-RUNTIME_base-utils-syslog = "" | ||
86 | |||
87 | Doing so will prevent ``rsyslog`` / ``busybox-syslog`` from being pulled in by | ||
88 | default, leaving only ``journald``. | ||
89 | |||