Bug 66018

Summary: Clean up closing empty sessions when not running under systemd
Product: systemd Reporter: Pacho Ramos <pachoramos1>
Component: generalAssignee: systemd-bugs
Status: RESOLVED WONTFIX QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: lxnay, martin.pitt, w.d.hubbs
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: cleanup-empty-sessions.patch

Description Pacho Ramos 2013-06-21 18:20:20 UTC
Created attachment 81180 [details]
cleanup-empty-sessions.patch

Hello

Distributions like Gentoo and Debian that needs to still support running logind without systemd being always running need to apply attached patch to prevent problems. The patch is being applied since March in Debian/Ubuntu without problems, and I thought that maybe upstream could be interested...

Thanks!
Comment 1 Lennart Poettering 2013-06-21 20:01:09 UTC
No way. that would mean we'd iterate through the entire cgroup tree on every single event loop iteration. Sorry, but that's not how we do things here.
Comment 2 Martin Pitt 2013-06-22 11:49:45 UTC
Pacho, I didn't even consider forwarding this upstream, as it's too much of a hack..
Comment 3 William Hubbs 2013-06-22 14:27:49 UTC
Is there another way we could do something like this that wouldn't be considered a hack and that would be acceptable upstream?

Thanks much,

William
Comment 4 Lennart Poettering 2013-06-22 16:57:58 UTC
Dunno what you guys are doing, but the idea is that systemd-cgroup-agent is hooked into /sys/fs/cgroup/systemd/release_agent and notify_release is on. With that in place I am not sure why you need any further work.
Comment 5 William Hubbs 2013-06-22 17:44:02 UTC
Ok, I have some things to do today, but when I get back later, I'll work on this on the Gentoo side. I believe I can set this up without the patch.
Comment 6 William Hubbs 2013-06-23 18:20:26 UTC
Hello Lennart,

The goal is to make logind work without systemd so distros like Gentoo and Debian can use logind without requiring systemd right away.

If I create the named cgroup under /sys/fs/cgroup/system, can we use the
systemd-cgroups-agent without running system?

Can you give me any other tips to make this setup work?
Comment 7 William Hubbs 2013-06-24 00:07:43 UTC
Lennart,

I have looked at the code, and correct me if I am wrong, but it doesn't look like systemd-cgroup-agent can run if systemd isn't running because the cgroup agent sends a message over dbus to systemd, so I am researching the group agent mechanism to see exactly when the agent is run.
Comment 8 Martin Pitt 2013-06-24 05:02:03 UTC
(In reply to comment #7)
> I have looked at the code, and correct me if I am wrong, but it doesn't look
> like systemd-cgroup-agent can run if systemd isn't running because the
> cgroup agent sends a message over dbus to systemd, so I am researching the
> group agent mechanism to see exactly when the agent is run.

That's right. I have a shelved patch to install the agent, but as you say this would need some rewiring first. We have this https://github.com/desrt/systemd-shim/  thing to implement the minimum required o.f.systemd interfaces and make things like suspend and NTP work properly, and eventually we need to teach it about the cgroup cleanup, too. Until then we use this hack.
Comment 9 Lennart Poettering 2013-06-24 12:29:39 UTC
It shouldn't be too hard to come up with the right command line of dbus-send to use for echoing into release_agent.

But you know: here's another way to make this work: just run systemd as PID 1.

We explicitly list logind as something that is not supported on non-systemd hosts. You do anyway -- so *you* need to find a way to make this work.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.