]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind-session: downgrade user@.service dep to Wants= 34096/head
authorMike Yuan <me@yhndnzj.com>
Sat, 17 Aug 2024 16:34:46 +0000 (18:34 +0200)
committerMike Yuan <me@yhndnzj.com>
Thu, 22 Aug 2024 18:07:47 +0000 (20:07 +0200)
This partially reverts 52bcc872b5f97a14a9b4e4e383f45bb3066e1643.

We explicitly support running without user manager,
hence only user-runtime-dir@.service should be
required.

Fixes #33405

src/login/logind-dbus.c
src/login/logind-dbus.h
src/login/logind-session.c

index 7222a5121ba9e774aaa49c938cd971b899b4c7d0..b66573f096356ebc0e091987ee883f7757aae273 100644 (file)
@@ -4353,6 +4353,7 @@ int manager_start_scope(
                 const char *slice,
                 const char *description,
                 const char * const *requires,
+                const char * const *wants,
                 const char * const *extra_after,
                 const char *requires_mounts_for,
                 sd_bus_message *more_properties,
@@ -4402,6 +4403,16 @@ int manager_start_scope(
                         return r;
         }
 
+        STRV_FOREACH(i, wants) {
+                r = sd_bus_message_append(m, "(sv)", "Wants", "as", 1, *i);
+                if (r < 0)
+                        return r;
+
+                r = sd_bus_message_append(m, "(sv)", "After", "as", 1, *i);
+                if (r < 0)
+                        return r;
+        }
+
         STRV_FOREACH(i, extra_after) {
                 r = sd_bus_message_append(m, "(sv)", "After", "as", 1, *i);
                 if (r < 0)
@@ -4464,6 +4475,7 @@ int manager_start_scope(
                                         slice,
                                         description,
                                         requires,
+                                        wants,
                                         extra_after,
                                         requires_mounts_for,
                                         more_properties,
index ebb75abaf34e9fb452ef6c02e88dfa86ed44e2cf..53e6888f5c4b06d2a633e8b85c449646f7b30fff 100644 (file)
@@ -32,6 +32,7 @@ int manager_start_scope(
                 const char *slice,
                 const char *description,
                 const char * const *requires,
+                const char * const *wants,
                 const char * const *extra_after,
                 const char *requires_mounts_for,
                 sd_bus_message *more_properties,
index bb77a20b5fc8de2ee018a89f9c6c48b24270508d..81c8b80dfdfd87fdff42e35eacc2816926b98bb2 100644 (file)
@@ -749,15 +749,15 @@ static int session_start_scope(Session *s, sd_bus_message *properties, sd_bus_er
                         s->user->slice,
                         description,
                         /* These should have been pulled in explicitly in user_start(). Just to be sure. */
-                        STRV_MAKE_CONST(s->user->runtime_dir_unit,
-                                        SESSION_CLASS_WANTS_SERVICE_MANAGER(s->class) ? s->user->service_manager_unit : NULL),
+                        /* requires = */ STRV_MAKE_CONST(s->user->runtime_dir_unit),
+                        /* wants = */ STRV_MAKE_CONST(SESSION_CLASS_WANTS_SERVICE_MANAGER(s->class) ? s->user->service_manager_unit : NULL),
                         /* We usually want to order session scopes after systemd-user-sessions.service
                          * since the unit is used as login session barrier for unprivileged users. However
                          * the barrier doesn't apply for root as sysadmin should always be able to log in
                          * (and without waiting for any timeout to expire) in case something goes wrong
                          * during the boot process. */
-                        STRV_MAKE_CONST("systemd-logind.service",
-                                        SESSION_CLASS_IS_EARLY(s->class) ? NULL : "systemd-user-sessions.service"),
+                        /* extra_after = */ STRV_MAKE_CONST("systemd-logind.service",
+                                                            SESSION_CLASS_IS_EARLY(s->class) ? NULL : "systemd-user-sessions.service"),
                         user_record_home_directory(s->user->user_record),
                         properties,
                         error,