Bug 867924 - LightDM lacks proper systemd support
LightDM lacks proper systemd support
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: lightdm (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Martin Bříza
Fedora Extras Quality Assurance
: FutureFeature
Depends On:
Blocks: 857254 859347
  Show dependency treegraph
 
Reported: 2012-10-18 11:09 EDT by Martin Bříza
Modified: 2013-05-20 21:53 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-05-20 21:53:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 930488 None None None Never

  None (edit)
Description Martin Bříza 2012-10-18 11:09:20 EDT
Description of problem:
LightDM does not work well with systemd session management (instead of ConsoleKit). Switching users is buggy and there is no multi-seat support.
Switching users in other environments than KDE is not working in LXDE nor GNOME (from those I tested now) using LightDM.
Also, ConsoleKit dependency can be dropped.

Version-Release number of selected component (if applicable):
lightdm-1.4.0-1.fc18.x86_64

How reproducible:
Always
Steps to Reproduce:
1. Have an installation with two users, let's say test1 and test2
2. Log in as test1
3. Switch session, create a new one with test2 logged in
4. Switch session back to test1
5. Log test1 out
  
Actual results:
Screen gets stuck, is black, only way out is alt+ctrl+f2

Expected results:
I'm not sure if the system should return to login prompt or ask test2 to unlock. 
I suppose login prompt would be better as there could be more users logged in...

Additional info:
Reproducing steps were made in KDE with my patch for #859347 that makes switching users with systemd possible in KDE.
I'm writing a patch for the black screen right now. I however don't know (so far) what to do with the other environments.
Comment 1 Rex Dieter 2012-10-18 11:18:17 EDT
Indeed, lightdm currently lacks any native systemd integration or support, marking RFE.

Will likely be something that we will have to help implement, as ubuntu likely won't be seeing systemd any time soon.
Comment 2 Christoph Wickert 2012-10-18 11:27:52 EDT
Is this really a lightdm issue?

Of course systemd support could be improved, e.g. power management doesn't currently work, however I can switch users with lightdm, lightdm-gtk and Xfce just fine. LXDE should work, too.

How do you switch users?
Comment 3 Martin Bříza 2012-10-18 11:43:25 EDT
Well, my experience regarding this is based on KDE, where, I'm pretty sure, everything is working well when GDM is used.
I do it the usual KDE way - using the Switch User dialog in Kickoff in KDE. The problem here, however, is not in switching users, but in impossibility to log out of the account that is on the first virtual terminal. In my opinion, it is caused by the fact LightDM is not registering its own session and reclaiming it after the child one has ended (as GDM does).
I wanted to try if it works in Xfce for me, installed @xfce-desktop and... umm... the system won't boot. I'm sorry, I'll try tomorrow or on Monday. It's still possible I'm testing it incorrectly...
Comment 4 Martin Bříza 2012-10-22 07:05:27 EDT
Okay, source of this Xfce issue is now known - LightDM won't start if Xfce is installed and ConsoleKit is not. (As I have removed the dependency on CK from LightDM spec file for the purposes of testing.) When I install it back, everything works as expected.
KDE, however, has its CK support turned off on compilation (I don't know if this is valid for whole KDE, but in kworkspace it is definitely like that). So, there are two options - support CK in KDE or systemd in LightDM...
Comment 5 Martin Bříza 2012-10-22 07:24:58 EDT
And in Beta TC6 it works in Xfce even without ConsoleKit, even though shutdown and restart is not available... This is frustrating
Comment 6 Martin Bříza 2012-10-22 12:00:20 EDT
After dwelling deeper into the issue today, I can tell for sure where is the problem with the user switching and logging out.
Kworkspace is using Activate method on a session in org.freedesktop.login1 and systemd itself is tracking currently opened sessions.
However, LightDM completely ignores this, as it uses its own SwitchToUser method for session switching and tracks active users on its own. I was thinking of working around this issue by converting loginctl session IDs to LightDM sessions, but this is not possible.
So, either LightDM will need to listen to change signals (I don't know how exactly to do this right now, but it shouldn't be so bad) or KDE will have to use both ConsoleKit and loginctl (this should be possible according to the manual).
Comment 7 Kevin Kofler 2012-10-22 17:47:35 EDT
ConsoleKit needs to go away, it's supposed to be already gone.

KWorkspace supposedly has support for LightDM's user switching functionality, is that not working? Or is LightDM's SwitchToUser method failing because it doesn't support systemd?
Comment 8 Martin Bříza 2012-10-24 07:31:38 EDT
It would be possible to use SwitchToUser but I can't find a way how to convert systemd sessions to LightDM ones.
LightDM counts the sessions on its own and names them typically "SessionX", incrementing the X for each session. SwitchToUser takes this string and user name as arguments.
Loginctl is not consistent with this system at all. For example, I currently have sessions named "c1", "c2" and "2" on this system (Fedora 17) where the same login actions were done (mbriza through LightDM and root through VT2 login) opposed to simple "Session0" tracked in LightDM.
Comment 9 Martin Bříza 2012-10-24 08:39:39 EDT
Or we can use LightDM's switching capabilities directly with all its limitations. It doesn't store anything more than user name for each session... Loginctl would be completely omitted in this process.
Comment 10 Kevin Kofler 2012-10-24 13:29:29 EDT
Using LightDM's switching capabilities directly is how I think things are expected to work, at least that's how we work with KDM, too.
Comment 11 Dan Mashal 2012-10-30 00:21:12 EDT
There are a number of bugfixes in 1.6. 

I have just built a lightdm 1.6 package using the source from launchpad and it seems to be working a lot better now.

Please see the commit history.

https://code.launchpad.net/~lightdm-team/lightdm/trunk
Comment 12 Dan Mashal 2012-10-30 00:21:46 EDT
Also you can test the package here if you're feeling adventerous:

http://koji.fedoraproject.org/koji/taskinfo?taskID=4638161
Comment 13 Kevin Kofler 2012-10-30 01:02:14 EDT
Huh?! I see exactly 9 commits since 1.4.0 (the version currently in F18), only one of which (commit 1558 "Fix autologin PAM configuration") can possibly fix any bug at all, and none of which is related in any way to this issue (which is NOT related to autologin). In addition, the version reported in NEWS is 1.4.1, not 1.6.0.
Comment 14 Dan Mashal 2012-10-30 01:06:42 EDT
I know it's unrelated. However there is a 1.6 in the works:

https://launchpad.net/lightdm/1.6

Compiling from the trunk with the spec file in the package (and a few source code hacks) fixed lightdm crashing on startup for me. 

Also lightdm is missing adwaita-gtk3-theme from the requires field. This causes the broken icons on the top right. 

As for the other stuff still investigating, however, the package I built and referenced above in the koji link did help.. along with installing adwaita-gtk3-theme.
Comment 15 Martin Bříza 2012-10-30 05:38:26 EDT
Kevin,
yes, it's done like that now but to me it seems just as a hack. In my opinion, both display managers and desktop environments should just bind to the session tracking API (ConsoleKit, logind) to avoid these hacky pieces of code determining which DM is on the other side and using their specific API even though there is a way how to do it in a general way.

Dan,
thank you for the package and information but I don't see any relation to this issue. The fixes in the 1.6.0 (or what seems to be going to be merged in 1.4 branch as 1.4.1) are only minor and nothing related to its tight dependency on ConsoleKit. I of course tried to install the package and then rebuilt it removing the "Requires: ConsoleKit" for my testing purposes and nothing changed.
What source code hacks did you do to stop the crashes?
To the issue with icons - I'm using the lightdm-kde greeter so there were no problems with icons on my side.
Thank you.
Comment 16 Dan Mashal 2012-10-30 23:39:33 EDT
Martin,

After installing all BR's did the following:

1) bzr branch lp:lightdm

2) NOCONFIGURE=1 ./autogen.sh

3) ./configure --disable-tests

4) Compilation fails:

[dan@localhost lightdm]$ make
make  all-recursive
make[1]: Entering directory `/home/dan/test1/lightdm'
Making all in liblightdm-gobject
make[2]: Entering directory `/home/dan/test1/lightdm/liblightdm-gobject'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/dan/test1/lightdm/liblightdm-gobject'
Making all in liblightdm-qt
make[2]: Entering directory `/home/dan/test1/lightdm/liblightdm-qt'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/dan/test1/lightdm/liblightdm-qt'
Making all in data
make[2]: Entering directory `/home/dan/test1/lightdm/data'
Making all in init
make[3]: Entering directory `/home/dan/test1/lightdm/data/init'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/dan/test1/lightdm/data/init'
make[3]: Entering directory `/home/dan/test1/lightdm/data'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/dan/test1/lightdm/data'
make[2]: Leaving directory `/home/dan/test1/lightdm/data'
Making all in po
make[2]: Entering directory `/home/dan/test1/lightdm/po'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/dan/test1/lightdm/po'
Making all in src
make[2]: Entering directory `/home/dan/test1/lightdm/src'
make  all-am
make[3]: Entering directory `/home/dan/test1/lightdm/src'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/dan/test1/lightdm/src'
make[2]: Leaving directory `/home/dan/test1/lightdm/src'
Making all in doc
make[2]: Entering directory `/home/dan/test1/lightdm/doc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/dan/test1/lightdm/doc'
Making all in help
make[2]: Entering directory `/home/dan/test1/lightdm/help'
Makefile:460: *** missing separator.  Stop.
make[2]: Leaving directory `/home/dan/test1/lightdm/help'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dan/test1/lightdm'
make: *** [all] Error 2
[dan@localhost lightdm]$ 

Delete the line with "@YELP_HELP_RULES@" (line 460) in help/ and compilation succeeds.


For lightdm-gtk-greeter:

Same thing.. instead run bzr branch lp:lightdm-gtk-greeter to get the source.

Then ran rpmbuild with the current spec files/patches and install.

---



In regards to lightdm and systemd Archlinux seems to have it working, maybe we can take a look at their package:

https://wiki.archlinux.org/index.php/LightDM#Enabling_Lightdm
Comment 17 Kevin Kofler 2012-10-31 09:15:00 EDT
What Arch has is just a service file to spawn LightDM from systemd, we have that too, that's not the issue at all. What is needed is support for systemd-logind in the LightDM code!
Comment 18 Martin Bříza 2012-11-01 09:35:45 EDT
Yep, I wanted to try how Arch is dealing without CK but I'm not willing to spend the whole afternoon installing it. I'll peek into their source packages maybe but I doubt there is anything to solve problems reported in this bug and by that I mean possibility to switch users properly and to turn off the computer from the greeter.
Comment 19 Dan Mashal 2012-11-01 11:43:45 EDT
I agree Martin. If you could take a peak I'd appreciate that. Don't have the time myself here either today.
Comment 20 Martin Bříza 2012-11-01 12:18:09 EDT
I took, Dan, and regarding this, there are only two patches written by Lukáš Tinkl that add systemd support to PowerDevil, so I think it's not even possible to switch users in their KDE when LightDM is used (although LightDM in Arch Linux is only in AUR and it seems the maintainer didn't do much about systemd support).
But once again, I may be wrong as I haven't tested it.
Comment 21 Martin Bříza 2012-11-23 06:29:30 EST
The user switching problem (that I have a quite large patch for... I'm just adding some error handling parts and cleaning it up) is our (e.g. systemd) problem only partially.
In Ubuntu, when the same recipe is followed except switching is done via ctrl+alt+fX, the screen gets stuck, too.
The main difference in this is, our LightDM doesn't allow unmanaged VTs to spawn a login prompt so the whole seat gets completely stuck when the session ends OR (and this is worse) user wants to switch to another VT manually.
What bugs me is the fact, I actually CAN switch VTs on my Fedora 17 so there's probably something wrong with the service file that's provided in Fedora 18.
Comment 22 Martin Bříza 2012-11-26 11:31:30 EST
I contacted the upstream regarding the impossibility to log out after a manual VT switch has been initiated as this bug is present in Ubuntu, too. My patch should solve this issue, but it introduces a huge amount of code into LightDM (in current state, it's about 1100 LoC), it's not absolutely done yet and I consider it very hacky, as seat tracking in LightDM is done on basis I'm not able to understand as ConsoleKit doesn't support seats according to their documentation.
The VT getting stuck bug resolved itself in updates so I suppose I just broke something in my testing virtual machine. On a clean one, it's perfectly OK.
In conclusion: waiting for the response of the upstream.
Comment 23 Martin Bříza 2012-12-12 05:06:14 EST
Created a new Bug 886442 with the user switching issue. Are there any further systemd-related bugs in LightDM?
The most important part of systemd support (shutdown dialog on the greeter) was fixed by Rex Dieter.
Comment 24 Adam Williamson 2013-05-20 20:30:18 EDT
what's the current state of this? can it be closed yet?
Comment 25 Rex Dieter 2013-05-20 21:53:03 EDT
I think we can close this, yeah, basic support is there... user switching could still use more love, but that's being tracked in bug #886442

Note You need to log in before you can comment on or make changes to this bug.