From 5a8a6d471e8786980304d96b6ce908ad8983a368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 9 Oct 2025 12:17:09 +0200 Subject: [PATCH 1/3] man/crypttab: avoid using jargon spelling --- man/crypttab.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/crypttab.xml b/man/crypttab.xml index ab77dea837..1f77939589 100644 --- a/man/crypttab.xml +++ b/man/crypttab.xml @@ -353,7 +353,7 @@ particular, if the device is used for a mount point, the mount point itself also needs to have the option, or the boot will fail if the device is not unlocked successfully. If a keyfile and/or a are specified, the dependencies on - their respective directories will also not be fatal, so that umounting said directories will + their respective directories will also not be fatal, so that unmounting said directories will not cause the generated cryptset unit to be deactivated. From 938f7fea7c953e5f5e9e199a5fcd22ac84fd1240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 10 Oct 2025 18:28:09 +0200 Subject: [PATCH 2/3] man/systemd-systemd.conf: describe DefaultEnvironment= and ManagerEnvironment= better The description of ME= said "see above", but it was actually above the other one. So change the order. But while reading this, I found it very hard to understand. So reword things, hopefully in a way that is easier to understand. The current behaviour is rather complex and unintuitive, but this description just tries to describe it truthfully. --- man/systemd-system.conf.xml | 50 ++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml index 164cfee1ed..cf5a3612f6 100644 --- a/man/systemd-system.conf.xml +++ b/man/systemd-system.conf.xml @@ -640,35 +640,15 @@ Environment - - ManagerEnvironment= - - Takes the same arguments as DefaultEnvironment=, see above. Sets - environment variables for the manager process itself. These variables are inherited by processes - spawned by user managers, but not the system manager - use DefaultEnvironment= - for that. Note that these variables are merged into the existing environment block. In particular, in - case of the system manager, this includes variables set by the kernel based on the kernel command line. - As with DefaultEnvironment=, this environment block is internal, and changes are not - reflected in the manager's /proc/PID/environ. - - Setting environment variables for the manager process may be useful to modify its behaviour. - See Known Environment Variables for a - descriptions of some variables understood by systemd. - - Simple %-specifier expansion is supported, see below for a list of supported - specifiers. - - - - - DefaultEnvironment= Configures environment variables passed to all executed processes. Takes a space-separated list of variable assignments. See environ7 for - details about environment variables. + details about environment variables. This environment block is internal, and changes are not + reflected in the manager's /proc/PID/environ. + Simple %-specifier expansion is supported, see below for a list of supported specifiers. @@ -684,6 +664,30 @@ + + + ManagerEnvironment= + + Sets environment variables for the manager process itself. Takes a space-separated + list of variable assignment in the same format as DefaultEnvironment=, see above. + These variables are merged into the existing environment block of the manager process. In particular, + in case of the system manager, this block includes variables set by the kernel based on the kernel + command line, and in case of the user manager, the variables passed by the system manager. After + those variables have been merged, they will persist until overriden, even if the manager is reloaded + or reexecuted. In case of the user manager, these variables are also inherited by processes spawned + by the manager. As with DefaultEnvironment=, this environment block is internal, + and changes are not reflected in the manager's /proc/PID/environ. + + Setting environment variables for the manager process may be useful to modify its behaviour. + See Known Environment Variables for a description + of some variables understood by systemd. + + Simple %-specifier expansion is supported, see below for a list of supported + specifiers. + + + + From 8f2c5dea63b43c85628e5ced045f5f8a24cfffc4 Mon Sep 17 00:00:00 2001 From: huyubiao Date: Tue, 30 Sep 2025 15:26:43 +0800 Subject: [PATCH 3/3] core: delete redundant log_parse_environment() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/systemd/systemd/issues/38895. Fix the confusing behavior where when an incorrect configuration item such as 'ManagerEnvironment=SYSTEMD_LOG_LEVEL=' is set, the first daemon-reload uses old environment variables while the second daemon-reload uses LogLevel=. Co-authored-by: Zbigniew Jędrzejewski-Szmek The difference in behaviour is that the operations that were done between the first log_parse_environment() and the second one might not be logged now, e.g. if the environment enabled debug logging. That is unfortunate, but parsing the environment twice and not having the explicit configuration take effect until a second daemon-reload is confusing. We will always have some window where the configuration for logging does not apply, in particular this must be true when parsing the logging configuration. To make that window smaller, move operations that could log after the call to log_parse_environment() as far as possible. --- src/core/main.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 0f363d5c8f..822d2eedcd 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2810,26 +2810,24 @@ static int parse_configuration(const struct rlimit *saved_rlimit_nofile, log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); } - /* Initialize some default rlimits for services if they haven't been configured */ - fallback_rlimit_nofile(saved_rlimit_nofile); - fallback_rlimit_memlock(saved_rlimit_memlock); - - /* Note that this also parses bits from the kernel command line, including "debug". */ - log_parse_environment(); - - /* Initialize the show status setting if it hasn't been set explicitly yet */ + /* Initialize the show status setting if it hasn't been explicitly set yet */ if (arg_show_status == _SHOW_STATUS_INVALID) arg_show_status = SHOW_STATUS_YES; - /* Slightly raise the OOM score for our services if we are running for unprivileged users. */ - determine_default_oom_score_adjust(); - /* Push variables into the manager environment block */ setenv_manager_environment(); - /* Parse log environment variables again to take into account any new environment variables. */ + /* Parse log environment variables to take into account any new environment variables. + * Note that this also parses bits from the kernel command line, including "debug". */ log_parse_environment(); + /* Initialize some default rlimits for services if they haven't been configured */ + fallback_rlimit_nofile(saved_rlimit_nofile); + fallback_rlimit_memlock(saved_rlimit_memlock); + + /* Slightly raise the OOM score for our services if we are running for unprivileged users. */ + determine_default_oom_score_adjust(); + return 0; }