[ConsoleKit] need better way to start sessions

Yclept Nemo orbisvicis at gmail.com
Wed Mar 3 14:45:10 PST 2010

> On Wed, Mar 3, 2010 at 4:20 PM, Ray Strode <halfline at gmail.com> wrote:
>> If you use .Xclients or .xsession you shouldn't need to do anything special
>> (on Fedora at least), you'll get a ck session "for free".  You'll also
>> get a dbus session.
>> pulseaudio should be activated automatically when used, and the polkit
>> authentication agent
>> should get autostarted by your session manager.
> I wonder how Fedora does this. I do have one CK session from login/pam
> but no X11 session.
> Unfortunately my window manager does not have a session manager.
> Even though "/usr/bin/pulseaudio" is started automatically I prefer to
> use "/usr/bin/start-pulseaudio-x11", a little script that initializes
> runtime X11 parameters.

Actually Fedora probably accomplishes this by only using one
ConsoleKit session, the one that was initiated by "/bin/login" via
PAM. But doesn't it make sense to have two sessions, one for the
console and one for X11. Otherwise what is the purpose in having
sessions associated with X11 displays and X11 display-devices?
(according to "ck-list-session")

>>> So a suggestion:
>>> A consolekit tool that will attach a ck session to the current
>>> process. "ck-attach-session" would not return until the session has
>>> been initialized. It can be placed in the beginning of ~/.xinitrc, and
>>> it wouldn't require major changes to the current ~/.xinitrc workflow.
>> It might make sense to make ck-launch-session have an "eval" mode
>> like dbus-launch, ssh-agent, etc have.


>> also having a ck-join-session that moves a shell to an already running
>> session would be useful.

So I thought:
1) find the current $XDG_SESSION_COOKIE
2) start a new CK session and verify different cookies
 $  ck-launch-session
3) attempt changing sessions by switching cookies and setting display
variables (assuming the CK daemon checks data consistency)
 $  export XDG_SESSION_COOKIE="old.cookie.value"
 $  export $DISPLAY=":0"
4) test..
 $  pkexec ls -lah /
 $  "Error executing command as another user: No authentication agent
was found."

Apparently there is more to "ck-launch-session" than meets the eye.
"ck-join-session" would have to work some sort of inner voodoo magic.
And if there is more to a session than simply the XDG_SESSION_COOKIE,
having "ck-launch-session" working in "eval" mode probably won't have
the desired effect.

More information about the ConsoleKit mailing list