Only use the user unit for pane scope dependencies

Pane scopes are created in the user manager, but when the server is not
in a user unit, for example when it was started from a login session's
session-N.scope, sd_pid_get_unit() returned that system unit and it was
set as Before and PartOf of the pane scope. The user manager cannot see
system units, so this only leaves a reference to a missing unit.

Set the dependencies only when sd_pid_get_user_unit() finds a unit.
GitHub issue 5741.
This commit is contained in:
dualfroz committed 2026-10-17 03:22:03 +02:00
1 parent fa169233c0
commit 76c86c34d6
1 file changed
+1 -2
+1 -2
View File
@@ -234,8 +234,7 @@ systemd_new_scope_message(sd_bus *bus, int oom_policy, sd_bus_message **mp,
* as dependent on it. Use "Before" to make sure systemd will not try to * as dependent on it. Use "Before" to make sure systemd will not try to
* kill them first. * kill them first.
*/ */
if (sd_pid_get_user_unit(parent_pid, &unit) == 0 || if (sd_pid_get_user_unit(parent_pid, &unit) == 0) {
sd_pid_get_unit(parent_pid, &unit) == 0) {
r = sd_bus_message_append(*mp, "(sv)", "Before", "as", 1, r = sd_bus_message_append(*mp, "(sv)", "Before", "as", 1,
unit); unit);
if (r >= 0) { if (r >= 0) {