The strange case of the changing GDM session

For the rare times when I’m not working, I’ve got a Fedora-based media center running the very excellent XBMC. It logs in automatically with GDM, and starts a xinit-compat session (see the xorg-x11-xinit-session package). I’ve got a few other things to do when I log in, which is why I’m not going with the XBMC session.

It works perfectly, except when it doesn’t. Once in a rare while, my choice of default desktop manager session is completely ignored, and I get a Gnome session instead. With the keyboard and mouse safely locked away outside the reach of curious 2-year old hands, logging out, picking the right session type and logging in again is a bother. That, and the sporadic nature of the issue pisses me of.

So, let’s take a peek at /etc/gdm/custom.conf – the file that tells GDM who to log in automatically (empty sections removed):

[daemon]
TimedLoginEnable=true
TimedLogin=xbmc
TimedLoginDelay=10
AutomaticLoginEnable=False
AutomaticLogin=xbmc

With account and delay specified (twice?) in this file, it seemed only reasonable that this would also be the place to select what type of session to start. Using my Googles, I found references to DefaultSession, but this seems to be obsolete in GDM3. Other people pointed to ~/.dmrc as the de-facto configuration file for specifying the default language and session type. Alas, this also is not supported by GDM anymore. In Ubuntu-country, people were talking about gdm-set-default-session but I was unable to find any source or package for Fedora with this file.

It turns out that GDM3 is using a service called AccountsService to store and retrieve information about users’ sessions. It’s apparently fully accessible via DBUS, which means absolutely nothing to me. Luckily enough it seems that AccountsService stores its information in plain text files in /var/lib/AccountsService/users/, so writing this to /var/lib/AccountsService/users/xbmc will ensure that the xbmc user always gets an xinit-compat session:

[User]
Language=en_US.utf8
XSession=xinit-compat

.. and to make absolutely sure GDM doesn’t modify this file, set the i attribute (file completely locked until root removes the flag again) on the file:

chattr +i /var/lib/AccountsService/users/xbmc
Posted Tuesday, October 2nd, 2012 under Uncategorized.

Leave a Reply

You must be logged in to post a comment.