[systemd-devel] Fwd: sd 221 regression: login - nonexistent sessions via lightdm

Robert Ancell robert.ancell at gmail.com
Tue Jul 7 16:53:42 PDT 2015


---------- Forwarded message ---------
From: Robert Ancell <robert.ancell at gmail.com>
Date: Wed, 8 Jul 2015 at 11:49
Subject: Re: sd 221 regression: login - nonexistent sessions via lightdm
To: David Herrmann <dh.herrmann at gmail.com>, poma <pomidorabelisima at gmail.com
>
Cc: systemd Mailing List <systemd-devel at lists.freedesktop.org>, LightDM
Mailing List <lightdm at lists.freedesktop.org>


On Wed, 8 Jul 2015 at 04:31 David Herrmann <dh.herrmann at gmail.com> wrote:

> Hi
>
> On Tue, Jul 7, 2015 at 6:14 PM, poma <pomidorabelisima at gmail.com> wrote:
> >
> > Revert "login: re-use VT-sessions if they already exist" - commit 0204c4b
> > http://cgit.freedesktop.org/systemd/systemd/commit/?id=0204c4b
>
> Can someone elaborate what exactly lightdm does here? We really want
> to prevent multiple sessions on the same VT. This is just nasty and
> never made any sense. So I'm really interested why lightdm doesn't
> kill it's manager-session before it starts the new session. Any
> particular reason here?
>
> Furthermore, how exactly does lightdm do all this. Is there a control
> daemon running outside the session, then there's the graphical login
> processes with their own 'lightdm' session? Once the login is done,
> you start the new session from the control daemon and _afterwards_
> destroy the lightdm-session?
>
>
If I follow the thread correctly the issue here is having two logind
sessions open using the same VT?

Yes, this can definitely happen in LightDM in the following case:

1. LightDM starts up
2. LightDM starts an X server on a free VT (e.g. 7)
3. LightDM starts a greeter process which connects to the X server. Via
libpam-systemd a logind session is opened.
4. User logs in via greeter.
5. LightDM stops the greeter by sending a SIGTERM to it.  The greeter
closes the PAM session which closes the logind session.
6. LightDM starts the user session. The existing X server is used so this
session is on the same VT as the greeter session was.

The issue is that after step 5 LightDM considers the greeter session to be
completely closed. However, it appears that closing the PAM session only
cases the logind session to be put into the "closing" state. As pointed out
we have an issue where Unity Greeter isn't waiting for some of its child
processes before exiting and that is keeping the logind session open for a
short time. I think there's still a race here in any case because the
display manager just has no idea when the session is really closed.

I've been looking for the right way to handle this with logind since we
should be able to make the daemon completely aware of the state of the
session so we can avoid this. GDM as far as I can tell also doesn't appear
to check if the logind sesion is actually closed.

The check for the greeter is certainly a workaround for the particular
first login case as described above. The issue can also probably occur by a
misbehaving user session. i.e. logging out then in again could leave the
display manager thinking a VT is free while there are still logind sessions
open with that VT.

So the correct solution might be to just to ignore logind sessions in the
"closing" state when checking if a VT is used more than once.

Another option is to require display managers to ensure a logind session is
closed before reusing VTs. This would require more work and also is a
little bit weird in the traditional X case since the VT is actually owned
by the X server and not the session.

--Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150707/05ea0587/attachment-0001.html>


More information about the systemd-devel mailing list