Hi, Consolekit support in xfce4-session 4.7.0 is really nice, but it seems that currently, xfce4-session always recreates a new ck session (in xfsm_manager_consolekit_init () probably) without checking if an active one already exists. Then, AFAUI, everything spawned by xfce4-session after that will inherit for the new (inactive) ck session, and so won't have the correct permissions (e.g. here, xfce4-power-manager can't suspend/hibernate). I checked the value of XDG_SESSION_COOKIE for a few apps, that are started before and after xfce4-session: xinitrc: XDG_SESSION_COOKIE=27e14772b14a5ae9383cb5f000000009-1283792776.683894-380420199 xfce4-session: XDG_SESSION_COOKIE=27e14772b14a5ae9383cb5f000000009-1283792776.683894-380420199 <--- this is the correct session, created by gdm? xfpm: XDG_SESSION_COOKIE=27e14772b14a5ae9383cb5f000000009-1283792776.888235-177056952 urxvt: XDG_SESSION_COOKIE=27e14772b14a5ae9383cb5f000000009-1283792776.888235-177056952 <--- this is the inactive session, created by xfce4-session? As you can see, everything I launch on the desktop get a different XDG_SESSION_COOKIE, and I guess this is the reason for my permissions' issue… If I kill this instance of xfce4-power-manager, and launch a new one with the correct XDG_SESSION_COOKIE, such as: $ XDG_SESSION_COOKIE=27e14772b14a5ae9383cb5f000000009-1283792776.683894-380420199 xfce4-power-manager Then it gets the correct permissions and can suspend/hibernate. I don't know consolekit well enough, but isn't it possible to check that XDG_SESSION_COOKIE isn't already set to an active session for the current user on the current x11 display? Then, if it's the case, reuse it, otherwise, create a new one? Thanks! (again, I'm not sure to understand everything wrt consolekit :/ so feel free to correct)
(In reply to comment #0) > I don't know consolekit well enough, but isn't it possible to check that > XDG_SESSION_COOKIE isn't already set to an active session for the current user > on the current x11 display? Then, if it's the case, reuse it, otherwise, create > a new one? correct, that's what the solution is. uxlaunch will also start a consolekit session for xfce4-session, also leading to a double CK session being active.
*** Bug 6688 has been marked as a duplicate of this bug. ***
As I understand, the proper solution is to check if XDG_SESSION_COOKIE is set. If it has not been set yet xfce4-session should try to open a new session in order to become its leader. If it is already set, it should not try to open another session. Is this correct?
This should be fixed in master: commit 35c620aa3749581580e0917ff7c2db1c223564a8 Author: Jannis Pohlmann <jannis@xfce.org> Date: Wed Sep 8 12:02:46 2010 +0200 Reuse existing ConsoleKit sessions (bug #6685). According to the ConsoleKit documentation, only one session leader may exist for a session. An application becomes the leader of a session by calling org.freedesktop.ConsoleKit.Manager.OpenSession() which returns a session identifier. This identifier is then made available to other session clients by setting the XDG_SESSION_COOKIE environment variable. GDM and upstart open ConsoleKit sessions on their own and desktop environments are supposed to reuse these sessions instead of opening new ones. So with this commit, xfce4-session checks for XDG_SESSION_COOKIE and, if it exists, does not try to call OpenSession in order to overwrite this environment variable. I tested this with xfce4-session-logout which finally allows me to reboot and shutdown again. Also fix the indentation, use spaces instead of tabs etc.