GNOME Bugzilla – Bug 656094
gdm should not hardcode the path to the gnome-session executable
Last modified: 2011-10-27 14:20:18 UTC
This issue affects gdm-3.0.x and 3.1.x. Due to an annoying bug in my video driver, I must run the gnome-session executable with a particular environment variable set[1] - or the gnome-session process will hang on exit. And since gdm starts a gnome-session process, when that gnome-session hangs, the gdm greeter will hang, thus making it impossible to log in. However, gdm_greeter_session_new() in gdm-greeter-session.c hardcodes the path to gnome-session, while get_welcome_environment() and gdm_welcome_session_spawn() in gdm-welcome-session.c drop all non-i18n-related custom environment variables in spawned processes. As a result, short of recompiling gdm, there is no way for me to work around the video driver bug; gdm will ignore the environment in which it is launched, and will not load a custom /usr/local/bin/gnome-session wrapper script. The most direct and easiest way of fixing this situation is to not hardcode the path to the gnome-session executable. It would also be nice (although not strictly necessary, as long as the gnome-session path is not hardcoded) if there was a way to customize the list of environment variables that are passed to spawned session processes. [1] If you really wish to know, the variable is __GL_NO_DSO_FINALIZER=1, and the driver is nvidia proprietary.
Created attachment 193369 [details] [review] patch for current gdm master branch HEAD This patch removes the hardcoded location for gnome-session, and allows gnome-session to be loaded using normal PATH rules, making it possible to use custom wrappers for the gnome-session executable. In addition, it overhauls the logic for how environment variables in spawned session processes are set. Instead of inheriting i18n variables from the current process and then setting the needed ones, it: 1. sets needed environment variables; 2. inherits environment variables that had not been set in step 1 from the current process; 3. drops specific variables that may cause problems. This allows a system administrator to force gdm to spawn sessions with a particular custom environment variable set to e.g. work around hardware driver bugs.
Created attachment 193370 [details] [review] patch for gdm gnome-3-0 branch Same as above, but backported to the gnome-3-0 branch.
On second thought, pam_env can already be easily used to set particular environment variables for sessions launched by gdm. In fact, a pam_env solution is much better than my patch because unlike the patch, using pam_env would not break pam_mktemp etc. So marking this as not a bug.
Alright, thanks for the patch and effort, though.