After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 594733 - Set default session in custom.conf
Set default session in custom.conf
Status: RESOLVED OBSOLETE
Product: gdm
Classification: Core
Component: general
2.27.x
Other Linux
: Normal enhancement
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-10 10:34 UTC by Martin Pitt
Modified: 2013-11-18 15:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
prefer "default.session" over "gnome.session" (752 bytes, patch)
2009-09-10 10:46 UTC, Martin Pitt
rejected Details | Review
Set default session in custom.conf (14.02 KB, patch)
2010-01-19 09:56 UTC, Didier Roche
none Details | Review

Description Martin Pitt 2009-09-10 10:34:36 UTC
Right now, gdm prefers "gnome.session", and if that does not exist, just picks the first .session it comes across.

This makes life inconvenient for other desktop environments like XFCE which don't want to default to GNOME, but to XFCE. (See https://launchpad.net/bugs/403291)

These other environments need a way to change the default session of gdm. Our current approach is to make gdm check for and prefer "default.session" and then fall back the usual gdm.session, and then "any session".

Would you consider adopting that, too? Or do you see a better way of specifying the system's default session?

Thanks for considering!

Martin
Comment 1 Martin Pitt 2009-09-10 10:46:17 UTC
Created attachment 142880 [details] [review]
prefer "default.session" over "gnome.session"
Comment 2 Brian Cameron 2009-09-10 16:19:33 UTC
This seems a good fix to me.  However, this sort of change should be mentioned in the docs.  In this section:

http://library.gnome.org/admin/gdm/2.27/configuration.html.en#sessionconfig

Could you update the docs/C/gdm.xml file to mention that GDM will default to default.session, and then to gnome.session?

Also, I notice the docs are wrong.  They currently say:

> These files are installed, by default, to <etc>/X11/sessions/. For backwards 
> compatibility any desktop files in the <etc>/Sessions, <share>/xsessions, and 
> <share/gdm/BuiltInSessions directories are also recognized by GDM. 

However, GDM normally installs its desktop files to <share>/xsessions and not to <etc>/X11/sessions, as the above suggests.

GDM will searche for desktop files in the following directories, which also is different than what the documentation suggests.

		<etc>/X11/sessions/
		<dmconfdir>/Sessions/
		<share>/xsessions/
		<share>/gdm/BuiltInSessions/

Note that <dmconfdir> is by default "<etc>/dm" unless you configure GDM with the --with-dmconfdir argument.

It would be good if we could correct this as well along with this fix.

Thanks,

Brian
Comment 3 Ray Strode [halfline] 2009-09-10 18:20:34 UTC
Comment on attachment 142880 [details] [review]
prefer "default.session" over "gnome.session"

So this fix has the appeal that it's a very small change, but it has one problem...

default.session is always going to duplicate some other session file.  It will either be a symlink, hardlink, or copy of some other file, which means we'll get a duplicate in the list.

One idea...We already read ~/.dmrc, it would probably make sense to read /etc/gdm/dmrc as well.

Alternatively we could bring back the old key from 2.20 defaults.conf
Comment 4 Brian Cameron 2009-09-11 00:21:43 UTC
Note I went ahead and fixed the error I pointed out above with how the desktop files are installed and searched for.  So, sorry for that noise.  Back with the bug.  I agree with Ray that using /etc/gdm/dmrc or adding a configuration option to specify the default is the right way to fix this.
Comment 5 Martin Pitt 2009-09-11 08:27:04 UTC
(In reply to comment #3)

> default.session is always going to duplicate some other session file.  It will
> either be a symlink, hardlink, or copy of some other file, which means we'll
> get a duplicate in the list.

That's not actually how we package that. We have the built in default (gnome.desktop), and no default.desktop. But if you install e. g. the mythbuntu-default-settings package, this will install default.desktop.

It works, but I'm not insisting on it at all, of course, if there's a better way.

> One idea...We already read ~/.dmrc, it would probably make sense to read
> /etc/gdm/dmrc as well.

That's the same situation in the end, it's one central file which is shipped by several packages (just like default.desktop). If you prefer it that way, it would make packaging a little more complex (since it's a configuration file in /etc/, which always needs extra care), but also possible.

Finally, if you think that this is not really something that upstream should provide, I'm also fine with keeping it as a distro patch. It's by and large a packaging helper and tiny.

> This seems a good fix to me.  However, this sort of change should be mentioned
> in the docs

Agreed. Once we settle for a particular implementation, I'm happy to update the patch to include the doc bits.

Thanks! Martin
Comment 6 Brian Cameron 2009-09-11 15:17:25 UTC
I think this should be configurable.  It's bad to hardcode to any particular setting without allowing users to configure.  I don't think it really matters whethre we use an /etc/gdm/gdmrc or a new configuration option.  If you feel that adding a new /etc file is extra work, why not add it as a new GDM daemon configuration option.  This is how it used to work with the old GDM 2.20, so 
perhaps its better to keep things consistent.  

Note the old GDM supported the following key in the custom.conf file:

[daemon]
DefaultSession=gnome.desktop

I'd say to use the same key & format so that people who have old configuration files find that things just keep working.
Comment 7 Martin Pitt 2009-09-11 15:26:42 UTC
> [daemon]
> DefaultSession=gnome.desktop
> 
> I'd say to use the same key & format so that people who have old configuration
> files find that things just keep working.

Agreed, makes sense.
Comment 8 Didier Roche 2010-01-19 09:56:17 UTC
Created attachment 151746 [details] [review]
Set default session in custom.conf

I've made the needed change to that the default session is stored in custom.conf.

The logic is the following:

run /usr/lib/gdm/gdm-set-default-session. It will update the default session using:

- over DBUS communication if gdm-daemon is running (with all the policykit integration), which will finally update /etc/gdm/custom.conf, adding DefaultSession=<session-name> under the [daemon] section.
- fallback to directly edit custom.conf if there is no daemon listening on dbus. This needs to be root. This is needed when a distributor call gdm-set-default-session on update and user isn't in a graphical runlevel, for instance.

the <session-name> should match a valid session-name.desktop, otherwise, it's still using gnome.desktop by default.


Here are the option of gdm-set-default-session:
 /usr/lib/gdm/gdm-set-default-session --helpUsage:
  gdm-set-default-session [OPTION...] - set gdm default session

Help Options:
  -h, --help         Show help options

Application Options:
  -d, --debug        Enable debugging
  -k, --keep-old     Only update if no default already set
  -r, --remove       Remove default session if it's this one


* by default, it updates unconditionnaly the DefaultSession.
* If --keep-old, it only update if there is no DefaultSession.
* --remove enable removing the DefaultSession key (and so, gnome.desktop will be choosen as default session).

We are using it for a couple of weeks on Ubuntu and it seems we don't have any regression. Keep me posted if more work is needed.
Comment 9 Martin Pitt 2010-01-19 23:18:25 UTC
Comment on attachment 142880 [details] [review]
prefer "default.session" over "gnome.session"

As discussed in the bug trail, setting the default session in custom.conf is much better, so obsoleting the original patch.
Comment 10 Ray Strode [halfline] 2010-09-15 23:03:41 UTC
Review of attachment 151746 [details] [review]:

Hey thanks for the patch.

I think there are two parts here and they should probably be evaluated indepdendently.

The first is the actual change to read the setting from the new config file and the second is the new config tool.

I'm not 100% sold on the config tool. From a user's perspective its sort of weird to have a tool that only changes one config item in the config file.  I can totally see how it would be useful as a distro tool though, so I understand the value there.

::: gdm-2.29.5/daemon/gdm-session-direct.c
@@ +672,1 @@
 

You should use the settings client wrapper api here.  It handles the dbus goo and also reading defaults from schemas.

@@ +724,1 @@
 }

this part's already landed independently think
Comment 11 Brian Cameron 2011-02-21 14:07:26 UTC
Yes, I'm all for adding a configuration option to support specifying a default session to use.  It doesn't make sense for GDM to hardcode this, since this seems the sort of things sysadmins would want to configure in some environments.

I agree with Ray, though, that a config tool that only supports one option doesn't seem a good idea.  Having a mechanism to update keys via D-Bus in general would be useful.  However, I agree with Ray that this idea should be separated into its own bug report.  Adding a config option to support specifying the default session should go in separately.
Comment 12 David Biesack 2012-01-06 19:17:21 UTC
Is there anything that works yet?

Note that
http://library.gnome.org/admin/gdm/stable/configuration.html.en#userconfig 
still says to update ~/.dmrc

I recently upgraded my Ubuntu from 10.04 to 11.10 then switched 
from lightdm to gdm but gdm does not save my preferred DE (GNOME/Openbox)
I tried 

sudo /usr/lib/gdm/gdm-set-default-session 'GNOME/Openbox'

which ran without complaint, and my /etc/gdm/custom.conf shows

[daemon]
# TimedLoginEnable=true
# AutomaticLoginEnable=true
# TimedLogin=sasdjb
# AutomaticLogin=sasdjb
# TimedLoginDelay=30
DefaultSession=GNOME/Openbox

but after logging out and logging back in, gdm still insists on defaulting
to Ubuntu (Unity), and I have to change it every time...

I even move the Unity/Ubunto .desktop files out of xsession and then
the dropdown is blank - it does not select any of the other existing desktops
such as GNOME/Openbox (from openbox-gnome.desktop) ...
Comment 13 David Biesack 2012-01-06 21:58:48 UTC
I guess I need to use the name of the .desktop file, not the label that shows up in gdm. So

sudo /usr/lib/gdm/gdm-set-default-session openbox-gnome

does indeed work... when I logout or restart, GNOME/Openbox is the default.

'Twould be nice if someone updated the doc page 

http://library.gnome.org/admin/gdm/stable/configuration.html.en#userconfig 

since ~/.dmrc is not used.
Comment 14 Ray Strode [halfline] 2012-04-09 15:39:39 UTC
is there an updated version of this patch available?
Comment 16 Ray Strode [halfline] 2013-11-18 15:05:29 UTC
the user's session now comes from accountsservice.  If we want something like this, it should probably be implemented there. Closing.