summaryrefslogtreecommitdiffstats
path: root/documentation/dev-manual
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2023-04-27 17:30:05 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-04-28 14:46:17 +0100
commitb01a12a13531c56a336a399456cb71709bb1a549 (patch)
tree88f070c0f2aa59f1972b0da62353ffd3b9c9d45d /documentation/dev-manual
parent7f39a583e772a45003db20d29a1e67faacb6be58 (diff)
downloadpoky-b01a12a13531c56a336a399456cb71709bb1a549.tar.gz
manuals: expand init manager documentation
- Add details about INIT_MANAGER Correct the fact that "none" currently generates an image with "sysvinit", at least on Poky. This behaviour should probably be changed. - Expand the "Selecting an Initialization Manager" section. - Stop mentioning "rescue image" generation, as this is not detailed anywhere else. (From yocto-docs rev: fd99f2753b50b7ad6133b787b90331fcb3a35152) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> CC: Paul Eggleton <bluelightning@bluelightning.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/dev-manual')
-rw-r--r--documentation/dev-manual/device-manager.rst2
-rw-r--r--documentation/dev-manual/init-manager.rst108
2 files changed, 74 insertions, 36 deletions
diff --git a/documentation/dev-manual/device-manager.rst b/documentation/dev-manual/device-manager.rst
index 4248c23b44..0343d19b9c 100644
--- a/documentation/dev-manual/device-manager.rst
+++ b/documentation/dev-manual/device-manager.rst
@@ -1,5 +1,7 @@
1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK 1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2 2
3.. _device-manager:
4
3Selecting a Device Manager 5Selecting a Device Manager
4************************** 6**************************
5 7
diff --git a/documentation/dev-manual/init-manager.rst b/documentation/dev-manual/init-manager.rst
index 10c4754e62..fd8747b9b0 100644
--- a/documentation/dev-manual/init-manager.rst
+++ b/documentation/dev-manual/init-manager.rst
@@ -1,71 +1,107 @@
1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK 1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2 2
3.. _init-manager:
4
3Selecting an Initialization Manager 5Selecting an Initialization Manager
4*********************************** 6***********************************
5 7
6By default, the Yocto Project uses SysVinit as the initialization 8By default, the Yocto Project uses :wikipedia:`SysVinit <Init#SysV-style>` as
7manager. However, there is also support for systemd, which is a full 9the initialization manager. There is also support for BusyBox init, a simpler
8replacement for init with parallel starting of services, reduced shell 10implementation, as well as support for :wikipedia:`systemd <Systemd>`, which
9overhead and other features that are used by many distributions. 11is a full replacement for init with parallel starting of services, reduced
12shell overhead, increased security and resource limits for services, and other
13features that are used by many distributions.
14
15Within the system, SysVinit and BusyBox init treat system components as
16services. These services are maintained as shell scripts stored in the
17``/etc/init.d/`` directory.
10 18
11Within the system, SysVinit treats system components as services. These 19SysVinit is more elaborate than BusyBox init and organizes services in
12services are maintained as shell scripts stored in the ``/etc/init.d/`` 20different run levels. This organization is maintained by putting links
13directory. Services organize into different run levels. This 21to the services in the ``/etc/rcN.d/`` directories, where `N/` is one
14organization is maintained by putting links to the services in the 22of the following options: "S", "0", "1", "2", "3", "4", "5", or "6".
15``/etc/rcN.d/`` directories, where `N/` is one of the following options:
16"S", "0", "1", "2", "3", "4", "5", or "6".
17 23
18.. note:: 24.. note::
19 25
20 Each runlevel has a dependency on the previous runlevel. This 26 Each runlevel has a dependency on the previous runlevel. This
21 dependency allows the services to work properly. 27 dependency allows the services to work properly.
22 28
29Both SysVinit and BusyBox init are configured through the ``/etc/inittab``
30file, with a very similar syntax, though of course BusyBox init features
31are more limited.
32
23In comparison, systemd treats components as units. Using units is a 33In comparison, systemd treats components as units. Using units is a
24broader concept as compared to using a service. A unit includes several 34broader concept as compared to using a service. A unit includes several
25different types of entities. Service is one of the types of entities. 35different types of entities. ``Service`` is one of the types of entities.
26The runlevel concept in SysVinit corresponds to the concept of a target 36The runlevel concept in SysVinit corresponds to the concept of a target
27in systemd, where target is also a type of supported unit. 37in systemd, where target is also a type of supported unit.
28 38
29In a SysVinit-based system, services load sequentially (i.e. one by one) 39In systems with SysVinit or BusyBox init, services load sequentially (i.e. one
30during init and parallelization is not supported. With systemd, services 40by one) during init and parallelization is not supported. With systemd, services
31start in parallel. Needless to say, the method can have an impact on 41start in parallel. This method can have an impact on the startup performance
32system startup performance. 42of a given service, though systemd will also provide more services by default,
43therefore increasing the total system boot time. systemd also substantially
44increases system size because of its multiple components and the extra
45dependencies it pulls.
33 46
34If you want to use SysVinit, you do not have to do anything. But, if you 47On the contrary, BusyBox init is the simplest and the lightest solution and
35want to use systemd, you must take some steps as described in the 48also comes with BusyBox mdev as device manager, a lighter replacement to
36following sections. 49:wikipedia:`udev <Udev>`, which SysVinit and systemd both use.
37 50
38Using systemd Exclusively 51The ":ref:`device-manager`" chapter has more details about device managers.
52
53Using SysVinit with udev
39========================= 54=========================
40 55
41Set the :term:`INIT_MANAGER` variable in your distribution configuration 56SysVinit with the udev device manager corresponds to the
42file as follows:: 57default setting in Poky. This corresponds to setting::
58
59 INIT_MANAGER = "sysvinit"
60
61Using BusyBox init with BusyBox mdev
62====================================
63
64BusyBox init with BusyBox mdev is the simplest and lightest solution
65for small root filesystems. All you need is BusyBox, which most systems
66have anyway::
67
68 INIT_MANAGER = "mdev-busybox"
69
70Using systemd
71=============
72
73The last option is to use systemd together with the udev device
74manager. This is the most powerful and versatile solution, especially
75for more complex systems::
43 76
44 INIT_MANAGER = "systemd" 77 INIT_MANAGER = "systemd"
45 78
46This will enable systemd and remove sysvinit components from the image. 79This will enable systemd and remove sysvinit components from the image.
47See ``meta/conf/distro/include/init-manager-systemd.inc`` for exact 80See :yocto_git:`meta/conf/distro/include/init-manager-systemd.inc
81</poky/tree/meta/conf/distro/include/init-manager-systemd.inc>` for exact
48details on what this does. 82details on what this does.
49 83
50Using systemd for the Main Image and Using SysVinit for the Rescue Image 84Controling systemd from the target command line
51======================================================================== 85-----------------------------------------------
52
53Set these variables in your distribution configuration file as follows::
54 86
55 DISTRO_FEATURES:append = " systemd" 87Here is a quick reference for controling systemd from the command line on the
56 VIRTUAL-RUNTIME_init_manager = "systemd" 88target. Instead of opening and sometimes modifying files, most interaction
89happens through the ``systemctl`` and ``journalctl`` commands:
57 90
58Doing so causes your main image to use the 91- ``systemctl status``: show the status of all services
59``packagegroup-core-boot.bb`` recipe and systemd. The rescue/minimal 92- ``systemctl status <service>``: show the status of one service
60image cannot use this package group. However, it can install SysVinit 93- ``systemctl [start|stop] <service>``: start or stop a service
61and the appropriate packages will have support for both systemd and 94- ``systemctl [enable|disable] <service>``: enable or disable a service at boot time
62SysVinit. 95- ``systemctl list-units``: list all available units
96- ``journalctl -a``: show all logs for all services
97- ``journalctl -f``: show only the last log entries, and keep printing updates as they arrive
98- ``journalctl -u``: show only logs from a particular service
63 99
64Using systemd-journald without a traditional syslog daemon 100Using systemd-journald without a traditional syslog daemon
65========================================================== 101----------------------------------------------------------
66 102
67Counter-intuitively, ``systemd-journald`` is not a syslog runtime or provider, 103Counter-intuitively, ``systemd-journald`` is not a syslog runtime or provider,
68and the proper way to use systemd-journald as your sole logging mechanism is to 104and the proper way to use ``systemd-journald`` as your sole logging mechanism is to
69effectively disable syslog entirely by setting these variables in your distribution 105effectively disable syslog entirely by setting these variables in your distribution
70configuration file:: 106configuration file::
71 107
@@ -73,5 +109,5 @@ configuration file::
73 VIRTUAL-RUNTIME_base-utils-syslog = "" 109 VIRTUAL-RUNTIME_base-utils-syslog = ""
74 110
75Doing so will prevent ``rsyslog`` / ``busybox-syslog`` from being pulled in by 111Doing so will prevent ``rsyslog`` / ``busybox-syslog`` from being pulled in by
76default, leaving only ``journald``. 112default, leaving only ``systemd-journald``.
77 113