manager_get_session_by_pidref() are misplaced. Reverting them to elogind
upstream at least passes a compile test. I'll have to set up a test
environment. But you might want to try the attached patch.
Mark
commit 83b0ef382d2d043a58107862d0917b40e02cf8ca
Author: Mark Hindley <mark@hindley.org.uk>
Date: Sat Aug 29 13:10:18 2026 +0100
Drop changes in manager_get_session_by_pidref.
diff --git a/debian/patches/Use-libsystemd0-compatible-cgroups-layout.patch b/debian/patches/Use-libsystemd0-compatible-cgroups-layout.patch
index 7955fe73ec..9dcec5eac6 100644
--- a/debian/patches/Use-libsystemd0-compatible-cgroups-layout.patch
+++ b/debian/patches/Use-libsystemd0-compatible-cgroups-layout.patch
@@ -404,54 +404,6 @@ index 80c3282..40bc721 100644
int unit_name_build(const char *prefix, const char *instance, const char *suffix, char **ret);
int unit_name_build_from_type(const char *prefix, const char *instance, UnitType, char **ret);
-diff --git a/src/login/logind-core.c b/src/login/logind-core.c
-index 7807a49..63d2112 100644
---- a/src/login/logind-core.c
-+++ b/src/login/logind-core.c
-@@ -372,11 +372,11 @@ int manager_process_button_device(Manager *m, sd_device *d) {
- }
-
- int manager_get_session_by_pidref(Manager *m, const PidRef *pid, Session **ret) {
--#if 0 /// elogind does not support systemd units, but its own session system
-+#if LIBSYSTEMD_COMPATIBLE_CGROUPS /// elogind does not support systemd units, but its own session system
- _cleanup_free_ char *unit = NULL;
--#else // 0
-+#else // LIBSYSTEMD_COMPATIBLE_CGROUPS
- _cleanup_free_ char *session_name = NULL;
--#endif // 0
-+#endif // LIBSYSTEMD_COMPATIBLE_CGROUPS
- Session *s;
- int r;
-
-@@ -385,13 +385,14 @@ int manager_get_session_by_pidref(Manager *m, const PidRef *pid, Session **ret)
- if (!pidref_is_set(pid))
- return -EINVAL;
-
-+
- s = hashmap_get(m->sessions_by_leader, pid);
- if (s) {
-- r = pidref_verify(pid);
-- if (r < 0)
-- return r;
-- } else {
--#if 0 /// elogind does not support systemd units, but its own session system
-+ r = pidref_verify(pid);
-+ if (r < 0)
-+ return r;
-+ } else {
-+#ifdef LIBSYSTEMD_COMPATIBLE_CGROUPS /// elogind does not support systemd units, but its own session system
- r = cg_pidref_get_unit(pid, &unit);
- if (r >= 0)
- s = hashmap_get(m->session_units, unit);
-@@ -404,7 +405,7 @@ int manager_get_session_by_pidref(Manager *m, const PidRef *pid, Session **ret)
-
- log_debug_elogind("Session Name \"%s\" -> Session \"%s\"",
- strnull(session_name), s && s->id ? s->id : "(null)");
--#endif // 0
-+#endif // LIBSYSTEMD_COMPATIBLE_CGROUPS
- }
-
- if (ret)
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 4a2cde9..b13ddb4 100644
--- a/src/login/logind-session.c