GNOME Bugzilla – Bug 594733
Set default session in custom.conf
Last modified: 2013-11-18 15:05:29 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
Created attachment 142880 [details] [review] prefer "default.session" over "gnome.session"
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 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
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.
(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
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.
> [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.
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 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.
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
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.
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) ...
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.
is there an updated version of this patch available?
http://patch-tracker.debian.org/patch/series/view/gdm3/3.8.3-2/09_default_session.patch
the user's session now comes from accountsservice. If we want something like this, it should probably be implemented there. Closing.