summaryrefslogtreecommitdiffstats
path: root/documentation
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-05-03 11:46:09 +0100
commit2c2ab20c21ec51039b032d1a0d1059a4719d4e38 (patch)
tree612c528af729b184e246afe486b504c62111d1b3 /documentation
parent4a1c9c4eb1b6cc4620736cb0a845b2031cf20dc7 (diff)
downloadpoky-2c2ab20c21ec51039b032d1a0d1059a4719d4e38.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')
-rw-r--r--documentation/dev-manual/device-manager.rst2
-rw-r--r--documentation/dev-manual/init-manager.rst108
-rw-r--r--documentation/ref-manual/variables.rst31
3 files changed, 98 insertions, 43 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
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 071e064cb7..a0f1c3aef1 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -3959,16 +3959,33 @@ system and gives an overview of their function and contents.
3959 :term:`INIT_MANAGER` 3959 :term:`INIT_MANAGER`
3960 Specifies the system init manager to use. Available options are: 3960 Specifies the system init manager to use. Available options are:
3961 3961
3962 - ``sysvinit`` - System V init (default for poky) 3962 - ``sysvinit``
3963 - ``systemd`` - systemd 3963 - ``systemd``
3964 - ``mdev-busybox`` - mdev provided by busybox 3964 - ``mdev-busybox``
3965 - ``none`` - no init manager 3965 - ``none``
3966
3967 With ``sysvinit``, the init manager is set to
3968 :wikipedia:`SysVinit <Init#SysV-style>`, the traditional UNIX init
3969 system. This is the default choice in the Poky distribution, together with
3970 the Udev device manager (see the ":ref:`device-manager`" section).
3971
3972 With ``systemd``, the init manager becomes :wikipedia:`systemd <Systemd>`,
3973 which comes with the :wikipedia:`udev <Udev>` device manager.
3974
3975 With ``mdev-busybox``, the init manager becomes the much simpler BusyBox
3976 init, together with the BusyBox mdev device manager. This is the simplest
3977 and lightest solution, and probably the best choice for low-end systems
3978 with a rather slow CPU and a limited amount of RAM.
3979
3980 With ``none``, the init manager is also set to ``sysvinit``. This is the
3981 default setting in OpenEmbedded-Core. This option also selects the
3982 :wikipedia:`udev <Udev>` device manager.
3966 3983
3967 More concretely, this is used to include 3984 More concretely, this is used to include
3968 ``conf/distro/include/init-manager-${INIT_MANAGER}.inc`` into the global 3985 ``conf/distro/include/init-manager-${INIT_MANAGER}.inc`` into the global
3969 configuration. You can have a look at the ``conf/distro/include/init-manager-*.inc`` 3986 configuration. You can have a look at the
3970 files for more information, and also the 3987 :yocto_git:`meta/conf/distro/include/init-manager-*.inc </poky/tree/meta/conf/distro/include>`
3971 ":ref:`dev-manual/init-manager:selecting an initialization manager`" 3988 files for more information, and also the ":ref:`init-manager`"
3972 section in the Yocto Project Development Tasks Manual. 3989 section in the Yocto Project Development Tasks Manual.
3973 3990
3974 :term:`INITRAMFS_DEPLOY_DIR_IMAGE` 3991 :term:`INITRAMFS_DEPLOY_DIR_IMAGE`