[Xfce4-commits] <xfce4-session:master> Reuse existing ConsoleKit sessions (bug #6685).

Jannis Pohlmann jannis at xfce.org
Sun Sep 19 23:17:38 CEST 2010

On Sun, 19 Sep 2010 15:03:38 +0200
Enrico Tröger <enrico at xfce.org> wrote:

> On Sun, 19 Sep 2010 14:15:19 +0200, Yves-Alexis wrote:
> >> Since ages, I start Xfce after logging into a console with
> >> 'startxfce4' and except the Policykit/Consolekit mess, it
> >> always worked perfectly.
> >
> >Which is doomed to fail, because startxfce4 has no way (and
> >shouldn't, anyway) to know everything to start. In Debian, we
> >use /etc/X11/Xsession.d for that, where the stuff you install put
> >scripts to be run when the session is run.
> Ok, I realise we are not supposed to use startxfce4 anymore. Sad but
> ok.

If Yves-Alexis is right then you are not supposed to call startxfce4
yourself anymore but it still can be used in your .xsession.

I'm not 100% sure here but this is what I think about the situation:

Before ConsoleKit, there was no "real" concept of sessions in the
desktop world. There was communication between processes via ICE and of
course there was basic session management based on X11 (a desktop
environment may only run as long as the X server is up for instance) and
in Xfce we had a dedicated D-Bus API for handling session management in
client applications. The only session management of importance was our
own, initiated by xfce4-session and valid only as long as xfce4-session
was running. That's why startxfce4 could be used the same way in all

Now we are facing different conditions: xfce4-session no longer is the
only session manager out there. Init systems like upstart and systemd
initiate session management at an early stage; ttys have ConsoleKit
sessions that are unusable for Xfce; gdm and uxlaunch open sessions for
us which we can reuse. Before we always launched our own "session"
with xfce4-session, but now there no longer is an easy way to decide
whether to launch a new session or reuse an existing one. 

It looks like we're not supposed to touch ConsoleKit at all in our
scripts and the session manager. For people using gdm/uxlaunch there
are no consequences: just call startxfce4 in the xsession .desktop
entry. For people without a login manager, distributions should provide
ways that set up ConsoleKit properly before startxfce4 is started.

Yves-Alexis explained how it is supposed to be done in Debian. Now I
wonder how other distributions handle this situation? What about
Fedora, Arch etc.? We need to figure out if there is a standard way, so
we can teach the "manual people" how to do it right. 

> >> > The “correct” way to do it, using console is:
> >> > 
> >> > * install consolekit
> >> > * don't use a .xinitrc
> >> > * don't call startxfce4
> >> > * put “exec startxfce4" in .xsessionrc
> >> > * call startx (*only*, no arg, nothing)
> >> > 
> >> > This way, scripts in /etc/X11/Xsession.d will be executed, and
> >> > especially 90consolekit, which will start it for you.
> >> 
> >> Thanks.
> >> Done that exactly like this but it doesn't help.
> >> Same result: no reboot/halt/mount.
> >
> >Sorry, I was wrong, it's not .xsessionrc (which is only sourced,
> >by /etc/X11/Xsession.d/40x11-common_xsessionrc and is useful to
> >export some envvar), it's .xsession:
> Ok, thanks.
> That took me a bit further:
> With my .xsession I can now start X and Xfce starts up, partly.
> It stops with the following message:
> "Unable to determine failsafe session name.  Possible causes: xfconfd
> isn't running (D-Bus setup problem); environment variable
> $XDG_CONFIG_DIRS is set incorrectly (must include
> "/home/enrico/apps/xfce/etc"), or xfce4-session is installed
> incorrectly."

Are you sure you have "exec startxfce4" in your .xsession and not
"exec xfce4-session"? I don't have a clear idea what might be wrong
here but maybe it's your completely custom setup and a path variable
that causes the problem here...?
> $XDG_CONFIG_DIRS contains /home/enrico/apps/xfce/etc though I think it
> should be /home/enrico/apps/xfce/etc/xdg. Jannis?

Yes, probably. Can you check where this path is added to
XDG_CONFIG_DIRS in your startup process?

> But actually, xfconfd is not running when this message appears. That
> leads me to the question who usually starts xfconfd?

It should be started implicitely via D-Bus service activation when a
program needs it. startxfce4 has a few 

> (Debian-specific)
> In /etc/X11/Xsession.options I disabled "use-session-dbus" so
> dbus-launch is used within Xfce's xinitrc script. Then the message
> disappears, Xfce starts up completely and the logout dialog offers
> Reboot/Halt. But when choosing e.g. Reboot, it asks for the root
> password. So it also won't properly but this might be because of the
> late start of the session bus *after* Xsession stuff.
> But why doesn't it work with the early started DBus session bus?
> Any ideas?

Hmm, no. No idea. :-/

  - Jannis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20100919/13ccf68f/attachment.pgp>

More information about the Xfce4-dev mailing list