-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libpam-cgfs breaks systemd user sessions #117
Comments
Hmm, @hallyn thoughts? |
The bug doesn't give much details on exactly what's going on. libpam-cgfs isn't supposed to mangle pre-configured cgroup controlers, at least not by moving you to another. It should just change cgroup ownership if required. Could you paste /proc/self/cgroup of a good and of a broken session, that'd help us see what's lxcfs doing exactly and how we can make it smarter... |
Without libpam-cgfs:
With libpam-cgfs:
This is with systemd 230 |
FTR this is the PAM config in Debian/Ubuntu
|
On Fri, Jun 03, 2016 at 12:12:27PM -0700, Laurent Bigonville wrote:
Right, this is the problem: the format of the systemd-generated Now I'm not quite certain whether it has changed again, or whether this libpam-cgfs only creates a new cgroup if it detects that the existing |
It's probably more an issue with systemd --user If you are using debian/ubuntu this can be tested by installing |
Note this is a touchy issue. When you log in, lxcfs can do one of several things:
So the question is - do we think that, long term, we can keep up with Maybe it's always safe so long as, relative to (X= Alternatively we could switch lxcfs's strategy: lxcfs always simply That may be the safest and most resilient way to go here. It also keeps |
Hmm, so how about the following:
This would avoid similar breakage in the future as we'd hit the "do nothing case" rather than have libpam-cgfs create a new path and move the task when it was already in a configured cgroup. We'd still need to update the path matching logic to match any path under the user-specific one but I don't see this as particularly controversial. |
As for your proposal to change LXC, the main downside I can see to this (besides having to update LXC everywhere) is that the containers wouldn't be under the user session anymore, so if systemd did setup a controller with some limits, this would effectively bypass those limits. |
Quoting Stéphane Graber (notifications@github.com):
That one is not really legitimate - as it would use the current cgroup if it exists. So it
I lament that this sounds like conceding that systemd should be the way to set those limits :) But yes, that would be an issue. |
Quoting Stéphane Graber (notifications@github.com):
that was the original idea. The problem is that 'known' keeps changing. So for the moment, do we consider a valid v3 systemd-generated path iow ignore the rest of the path in
|
Well, it didn't change so much as when using systemd for the user session, it moves things in paths under the path we were already tracking. So yeah, I think that considering our current path as a prefix rather than an absolute path to check against should do the trick. |
Ok - I'll get to it if no patches get mysteriously and anonymously
dropped off.
|
…uid.slice Closes lxc#117 Signed-off-by: Serge Hallyn <serge@fermat.io>
…uid.slice Closes lxc#117 Signed-off-by: Serge Hallyn <serge@fermat.io>
…uid.slice Closes lxc#117 Signed-off-by: Serge Hallyn <serge@fermat.io>
…uid.slice (relative to our init's path) Closes lxc#117 Signed-off-by: Serge Hallyn <serge@fermat.io>
I've tested this patch in the debian package https://anonscm.debian.org/cgit/pkg-lxc/lxcfs.git/commit/?id=73b2f113829c8f6bead764f168df42d80cbc5923 and the cgroups are not the same: Without libpam-cgfs:
With libpam-cgfs (and the patch):
|
…uid.slice (relative to our init's path) Closes #117 Signed-off-by: Serge Hallyn <serge@hallyn.com>
Drat. Would you mind running with a patch to print out
c->cur_path, c->init_path, buf, initlen and curlen before
the final strcmp?
|
I've set up a ubuntu xenial vm where I've put the following: [Unit] [Service] into .local/share/systemd/user/debug.service, where ~/dome.sh is: #!/bin/sh i do systemd --user in one terminal, then do systemctl --user start debug in another. /tmp/cgroup shows: ubuntu@lxcfs:~$ cat /tmp/cgroup This is both with the xenial package and with a package built from I see that unstable is at a much newer systemd version 230-2. So it appears that a change in systemd likely regressed this behavior, but |
Ah - found the problem. When init is in the root cgroup, it is '/', |
The new fix is in github.com/lxc/lxcfs. It fixed the issue for me
on a debian jessie system. Could you please confirm whether it
works for you?
|
debs are on https://people.debian.org/~evgeni/tmp/lxcfs/, bigon has promised tot test them when he has some time. |
I now get this with the package provided by @evgeni
So it looks OK now I think |
Great, thanks for the update. |
From: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826260
Hi,
The default configuration of libpam-cgfs breaks systemd user session
management.
All the processes started by systemd --user are not properly put in the
correct systemd cgroup. This can be verified with "loginctl user-status"
command.
This is at least breaking stuffs like policykit.
Removing "name=systemd" from the call to the pam module seems to fix
this. I don't think it's the role of libpam-cgfs to mangle with systemd
cgroups.
The text was updated successfully, but these errors were encountered: