diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 413e13b..0699682 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -32,6 +32,9 @@ systemd manages restarts now and the Stackable agent cannot detect if a service is in a restart loop ({263}). +=== Fixed +* Systemd services in session mode are restarted after a reboot ({263}). + == 0.5.0 - 2021-07-26 :224: https://github.com/stackabletech/agent/pull/224[#224] diff --git a/src/provider/systemdmanager/systemdunit.rs b/src/provider/systemdmanager/systemdunit.rs index 906635c..d3d1d95 100644 --- a/src/provider/systemdmanager/systemdunit.rs +++ b/src/provider/systemdmanager/systemdunit.rs @@ -227,7 +227,15 @@ impl SystemDUnit { } // This one is mandatory, as otherwise enabling the unit fails - unit.set_property(Section::Install, "WantedBy", "multi-user.target"); + unit.set_property( + Section::Install, + "WantedBy", + if user_mode { + "default.target" + } else { + "multi-user.target" + }, + ); Ok(unit) } @@ -727,7 +735,7 @@ mod test { TimeoutStopSec=30 [Install] - WantedBy=multi-user.target"#} + WantedBy=default.target"#} )] #[case::set_termination_timeout( BusType::System,