From 04e82f29add9e912e76f41de969d17415d62db8f Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Wed, 21 Feb 2024 12:10:26 -0800 Subject: [PATCH 1/2] Don't check /run for systemd if we're not starting the daemon --- src/action/common/configure_init_service.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/action/common/configure_init_service.rs b/src/action/common/configure_init_service.rs index a6b109f56..70e0f2a25 100644 --- a/src/action/common/configure_init_service.rs +++ b/src/action/common/configure_init_service.rs @@ -79,10 +79,12 @@ impl ConfigureInitService { }, #[cfg(target_os = "linux")] InitSystem::Systemd => { - // If /run/systemd/system exists, we can be reasonably sure the machine is booted - // with systemd: https://www.freedesktop.org/software/systemd/man/sd_booted.html - if !Path::new("/run/systemd/system").exists() { - return Err(Self::error(ActionErrorKind::SystemdMissing)); + if start_daemon { + // If /run/systemd/system exists, we can be reasonably sure the machine is booted + // with systemd: https://www.freedesktop.org/software/systemd/man/sd_booted.html + if !Path::new("/run/systemd/system").exists() { + return Err(Self::error(ActionErrorKind::SystemdMissing)); + } } if which::which("systemctl").is_err() { From 7ad01c7e37499a9b0f3063e648257b28cb33b26b Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 23 Feb 2024 08:07:04 -0800 Subject: [PATCH 2/2] Add a note about start_daemon and checking /run/systemd/system --- src/action/common/configure_init_service.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/action/common/configure_init_service.rs b/src/action/common/configure_init_service.rs index 70e0f2a25..bd5685956 100644 --- a/src/action/common/configure_init_service.rs +++ b/src/action/common/configure_init_service.rs @@ -79,6 +79,8 @@ impl ConfigureInitService { }, #[cfg(target_os = "linux")] InitSystem::Systemd => { + // If `no_start_daemon` is set, then we don't require a running systemd, + // so we don't need to check if `/run/systemd/system` exists. if start_daemon { // If /run/systemd/system exists, we can be reasonably sure the machine is booted // with systemd: https://www.freedesktop.org/software/systemd/man/sd_booted.html