From 5ffa2eaa541b718122a3422e911ef95f4c9981d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 2 Feb 2021 14:19:59 +0100 Subject: [PATCH 1/4] meson: remove one more instance of install_dir:bindir bindir is the default, c.f. a1fd722b5df83e526cb5feb3fb271ffe1d903472. --- src/kernel-install/meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/kernel-install/meson.build b/src/kernel-install/meson.build index 4117188f147..92ce23ecf91 100644 --- a/src/kernel-install/meson.build +++ b/src/kernel-install/meson.build @@ -4,8 +4,7 @@ want_kernel_install = get_option('kernel-install') if want_kernel_install install_data('kernel-install', - install_mode : 'rwxr-xr-x', - install_dir : bindir) + install_mode : 'rwxr-xr-x') install_data('00-entry-directory.install', '50-depmod.install', From 7e215af765cf2cebbd8e9dd721ec57a1680950f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 31 Jan 2021 16:48:44 +0100 Subject: [PATCH 2/4] man: move content from the wiki to systemd.preset(5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wiki was slightly stale, and almost all the information there was already present in the man page. I moved the remaing part (discussion) into the man page and adjusted all links to point to the man page instead. daemon(7) has a some examples of packaging scriptlets… I don't think it fits there very well. Most likely they should be moved to systemd.preset(5) or maybe even removed, but I'm leaving that for later. --- docs/PORTABILITY_AND_STABILITY.md | 2 +- man/systemctl.xml | 4 +- man/systemd.preset.xml | 71 ++++++++++++++++++++++--------- 3 files changed, 53 insertions(+), 24 deletions(-) diff --git a/docs/PORTABILITY_AND_STABILITY.md b/docs/PORTABILITY_AND_STABILITY.md index 0caa5cc0484..27562c17d8f 100644 --- a/docs/PORTABILITY_AND_STABILITY.md +++ b/docs/PORTABILITY_AND_STABILITY.md @@ -120,7 +120,7 @@ And now, here's the list of (hopefully) all APIs that we have introduced with sy | `/run` | File hierarchy change | yes | yes | numerous | yes | OpenSUSE, Debian, ArchLinux | no | | [Generators](https://www.freedesktop.org/software/systemd/man/systemd.generator.html) | Subprocess | yes | yes | - | no | - | no | | [System Updates](https://www.freedesktop.org/software/systemd/man/systemd.offline-updates.html) | System Mode | yes | yes | - | no | - | no | -| [Presets](https://freedesktop.org/wiki/Software/systemd/Preset) | File format | yes | yes | - | no | - | no | +| [Presets](https://www.freedesktop.org/software/systemd/man/systemd.preset.html) | File format | yes | yes | - | no | - | no | | Udev rules | File format | yes | yes | numerous | no | no | partially | diff --git a/man/systemctl.xml b/man/systemctl.xml index e49a12a146e..db4e2b2c65c 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -793,9 +793,7 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err For more information on the preset policy format, see systemd.preset5. - For more information on the concept of presets, please consult the - Preset - document. + diff --git a/man/systemd.preset.xml b/man/systemd.preset.xml index 5697e50be7c..cbd89daf162 100644 --- a/man/systemd.preset.xml +++ b/man/systemd.preset.xml @@ -32,28 +32,20 @@ Description - Preset files may be used to encode policy which units shall - be enabled by default and which ones shall be disabled. They are - read by systemctl preset (for more information - see - systemctl1) - which uses this information to enable or disable a unit according - to preset policy. systemctl preset is used by - the post install scriptlets of RPM packages (or other OS package - formats), to enable/disable specific units by default on package - installation, enforcing distribution, spin or administrator preset - policy. This allows choosing a certain set of units to be - enabled/disabled even before installing the actual package. + Preset files may be used to encode policy which units shall be enabled by default and which ones + shall be disabled. They are read by systemctl preset which uses this information to + enable or disable a unit. Depending on that policy, systemctl preset is identical to + systemctl enable or systemctl disable. - For more information on the preset logic please have a look - at the Presets - document. + systemctl preset is used by the post install scriptlets of rpm packages (or other OS + package formats), to enable/disable specific units by default on package installation, enforcing + distribution, spin or administrator preset policy. This allows choosing a certain set of units to be + enabled/disabled even before installing the actual package. For more information, see + systemctl1. - It is not recommended to ship preset files within the - respective software packages implementing the units, but rather - centralize them in a distribution or spin default policy, which - can be amended by administrator policy. + It is not recommended to ship preset files within the respective software packages implementing the + units, but rather centralize them in a distribution or spin default policy, which can be amended by + administrator policy, see below. If no preset files exist, systemctl preset will enable all units that are installed by @@ -175,6 +167,38 @@ disable * override all other preset policy files. + + Motiviation for the preset logic + + Different distributions have different policies on which services shall be enabled by default when + the package they are shipped in is installed. On Fedora all services stay off by default, so that + installing a package will not cause a service to be enabled (with some exceptions). On Debian all + services are immediately enabled by default, so that installing a package will cause its services to be + enabled right-away. + + Even within a single distribution, different spins (flavours, remixes, whatever you might want to + call them) of a distribution also have different policies on what services to enable, and what services + to leave off. For example, Fedora Workstation will enable gdm as display manager by + default, while the Fedora KDE spin will enable sddm instead. + + Different sites might also have different policies what to turn on by default and what to turn + off. For example, one administrator would prefer to enforce the policy of "sshd should + be always on, but everything else off", while another one might say "snmpd always on, + and for everything else use the distribution policy defaults". + + Traditionally, policy about which services shall be enabled were implemented in each package + individually. This made it cumbersome to implement different policies per spin or per site, or to create + software packages that do the right thing on more than one distribution. The enablement mechanism was + also encoding the enablement policy. + + The preset mechanism allows clean separation of the enablement mechanism (inside the package + scriptlets, by invoking systemctl preset) and enablement policy (centralized in the + preset files), and lifts the configuration out of individual packages. Preset files may be written for + specific distributions, for specific spins or for specific sites, in order to enforce different policies + as needed. It is recommended to apply the policy encoded in preset files in package installation + scriptlets. + + See Also @@ -182,6 +206,13 @@ disable * systemctl1, systemd-delta1 + + daemon8 + has a discussion of packaging scriptlets. + + Fedora page introducing the use of presets: + Features/PackagePresets. + From ea8b9b2f8ab960fb96157af2f4131511a853aa9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 2 Feb 2021 14:38:19 +0100 Subject: [PATCH 3/4] meson: take oomd out of the doghouse It's on by default in Fedora 34 [1], so we can't say it's just a preview. [1] https://fedoraproject.org/wiki/Changes/EnableSystemdOomd --- meson.build | 8 -------- meson_options.txt | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 0af0cce8b85..e5d7c2710e3 100644 --- a/meson.build +++ b/meson.build @@ -1450,14 +1450,6 @@ have = have and conf.get('HAVE_PAM') == 1 conf.set10('ENABLE_PAM_HOME', have) have = get_option('oomd') -if have == 'auto' - have = get_option('mode') == 'developer' -else - have = have == 'true' - if have and get_option('mode') != 'developer' - warning('oomd is not ready for release mode (yet)') - endif -endif conf.set10('ENABLE_OOMD', have) substs.set10('ENABLE_OOMD', have) diff --git a/meson_options.txt b/meson_options.txt index a4214730299..425e958ba20 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -99,7 +99,7 @@ option('coredump', type : 'boolean', description : 'install the coredump handler') option('pstore', type : 'boolean', description : 'install the pstore archival tool') -option('oomd', type : 'combo', choices : ['auto', 'true', 'false'], +option('oomd', type : 'boolean', description : 'install the userspace oom killer') option('logind', type : 'boolean', description : 'install the systemd-logind stack') From 0411a11811430bd5e5e3b1b4d52cc8ddbe54132b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 2 Feb 2021 14:39:48 +0100 Subject: [PATCH 4/4] meson: use ellipses for ranges C.f. 1d3a473b4a0a4a0c49963297103af16ff6d841fa. --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index e5d7c2710e3..01eeeb750e5 100644 --- a/meson.build +++ b/meson.build @@ -3660,8 +3660,8 @@ status = [ conf.get('SYSTEM_ALLOC_UID_MIN')), 'system GIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'), conf.get('SYSTEM_ALLOC_GID_MIN')), - 'dynamic UIDs: @0@–@1@'.format(dynamic_uid_min, dynamic_uid_max), - 'container UID bases: @0@–@1@'.format(container_uid_base_min, container_uid_base_max), + 'dynamic UIDs: @0@…@1@'.format(dynamic_uid_min, dynamic_uid_max), + 'container UID bases: @0@…@1@'.format(container_uid_base_min, container_uid_base_max), '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')), 'render group access mode: @0@'.format(get_option('group-render-mode')), 'certificate root directory: @0@'.format(get_option('certificate-root')),