After upgrade to lightdm 1.7.7 I can't mount external disks or shutdown the system from the XFCE desktop.
As far as I could find out this is because lightdm doesn't create an active consolekit session therefore authentication for priviledged actions fails.

I went back to lightdm 1.4.0-r2 and the problem was gone.

Reproducible: Always

Steps to Reproduce:
1. upgrade to lightdm 1.7.7
2. restart lightdm
3. login and try to mount a USB disk or shutdown the system
Actual Results:
I get "not authorized" for the mount attempt.
The button for system shutdown is grey.

Expected Results:
mounted disk
coloured and working shutdown button

I've run a complete system upgrade (-uDN) when I came across this bug.
I reverted all changes in consolekit, pam, dbus and what else could have been involved config files:
emerge --noconfmem consolekit pambase shadow sys-fs/udisks sys-power/upower xfce-base/xfce4-session sys-auth/polkit gnome-extra/polkit-gnome udev xfce-base/xfdesktop
But that didn't help either.

I know that lightdm got some support for systemd in version 1.7.0 (2 months ago) but I would be surprised if they immediately removed consolekit support.
Also I don't see a logind ebuild (it doesn't depend on systemd afaik) and the lightdm ebuild doesn't have a systemd dependency.

I have now done some regression testing and this bug was introduced with lightdm 1.7.5. Version 1.7.4 is the last one that works correctly (I also checked with the latest 1.7.9 and it is still there).
Running a diff over the 2 versions shows that there have been a lot of changes in the session handling code.

: lightdm since x11-misc/lightdm-1.7.9 needs a valid allocated tty to work on.
: most often /dev/tty7 is used for X.
: run consolekit daemon before lightdm otherwise dbus will run it on tty0 and
: will lock the tty7 until you manually kill consolekit daemon.

I tested starting /etc/init.d/consolekit before lightdm at version 1.7.7, and that didn't work... does this mean that there has been some fixing between 1.7.7 and 1.7.9, or does Jimmy.Jazz do something special that I haven't grasped yet?

(In reply to Mads from comment #13)
> I tested starting /etc/init.d/consolekit before lightdm at version 1.7.7,
> and that didn't work... does this mean that there has been some fixing
> between 1.7.7 and 1.7.9, or does Jimmy.Jazz do something special that I
> haven't grasped yet?

For me that works with 1.7.4, 1.7.7 and 1.7.9 (didn't try other versions).
Of course I had consolekit already running (so no need for the first command) and had to stop /etc/init.d/xdm before running the second.

(In reply to Jimmy.Jazz from comment #12)
> : lightdm since x11-misc/lightdm-1.7.9 needs a valid allocated tty to work
> on.
> : most often /dev/tty7 is used for X.

I have to admit that I have no idea how lightdm (or any other DM) knows which terminal to use. I guess tty7 has just established itself as a default that is used if nothing else is configured.

> : run consolekit daemon before lightdm otherwise dbus will run it on tty0 and
> : will lock the tty7 until you manually kill consolekit daemon.

Not sure I get that. I see the lightdm greeter on tty7 and the opened session is also there. There is a change in lightdm-1.7.5 that is supposed to allow greeter and session to run on different display servers. But from my perspective both run on the same just as usual for a simple desktop system. So it "forgets" to inform consolekit that the created session is running on tty7. Or it just puts in the wrong value.

x11-display = ':0'
x11-display-device = ':0' <--- This looks just like the x11-display and should be '/dev/tty7'

This is the patch I submitted to the gentoo bug. It applies to lightdm-1.7.15.

The issue was that session_set_tty() was being set to the correct value "/dev/tty%d",vt by x_server_connect_session() if the vt value is valid, but then knobbled with an incorrect value later in the same function using the xdisplay value.

The patch removes the extra call to session_set_tty() that knobbles the tty value.

I guess it would be easy enough to apply to the trunk as it's just a one-line change.

(In reply to Markos Chandras from comment #19)
> Thanks for the patch but it has to be accepted upstream first. I'd rather
> avoid carrying this patch in Gentoo forever.
>
> For now, those that have this problem can use the 1.6.X ebuild?

I wonder how long it will take for upstream to apply the patch. So far they
haven't even confirmed that they have a bug. And I fear that they are so
focused on systemd that they won't even look at the bug report. :-(

(In reply to Robert from comment #20)
> (In reply to Markos Chandras from comment #19)
> > Thanks for the patch but it has to be accepted upstream first. I'd rather
> > avoid carrying this patch in Gentoo forever.
>
> I wonder how long it will take for upstream to apply the patch. So far they
> haven't even confirmed that they have a bug. And I fear that they are so
> focused on systemd that they won't even look at the bug report. :-(

I've been doing my best to remedy that. At the moment it's looking good (Triaged, High)!

jody, you have a different issue. You do have an active session (Session2) but
2 more sessions on the same display.

Also there is something wrong with your /etc/X11/Sessions/Xsession because it
doesn't contain "exec ck-launch-session startxfce4" unless you put it there.

What I think might be the problem is that you have set lightdm to start Xsession
instead of Xfce. I use the default GTK greeter and there the button to change
that is the one in the upper right screen corner, left of the accessability
button. Please check that.
Also make sure that /etc/X11/Sessions/Xfce4 (or /etc/X11/Sessions/Xfce) only
contains "startxfce4", no exec or ck-launch-session.

LightDM creates its own ConsoleKit session, so jody's configuration is trying to create a nested ConsoleKit session - something which won't work!

Interestingly, the LightDM developers removed ConsoleKit support sometime after LightDM development release 1.13.0 and reinstated it a couple of days later (so it's back in release 1.13.1). Although the original ConsoleKit is pretty much abandoned, it was forked by an XFCE developer and the fork is alive and well.

Guys this is an old bug. If this is not a bug but rather a user-side problem please take it to the forums or gentoo-user @ ML. If this is indeed a bug, you need to open a new after after you have tried the latest ~testing or even masked version of lightdm and we will see what to do.