Disable User Switching on Ubuntu 14.04

Recently, one of our home computers running Ubuntu 14.04 has been experiencing what seems to be a bug that is triggered when multiple users log in concurrently using the “fast user switching” feature. The symptom of the bug is a black screen after trying to switch back to an existing user session. Searching the Web seems to indicate that this is a common problem but it is not clear to me where (what component) the bug lies. This Ubuntu bug seems to match the problem but it has been attributed to a bug in the Xorg Intel graphics driver: .

In any case, my goal with this post is not to look into the bug itself but into a simple way to try to prevent it — because the bug is apparently triggered by switching users I decided to look into what it takes to disable the fast user switching feature:

In modern Ubuntu/GNOME (GNOME >= 3.0), fast user switching is a system-wide option that is controlled by a pair of GSettings options (they used to be GConf options but moved to GSettings when the GNOME project deprecated GConf in favor of GSettings):

shell$ gsettings list-recursively | grep user-switch
org.gnome.desktop.lockdown disable-user-switching false
org.gnome.desktop.screensaver user-switch-enabled true

These options are part of XML schema files stored under the /usr/share/glib-2.0/schemas/ directory:

shell$ grep user-switch /usr/share/glib-2.0/schemas/*xml
/usr/share/glib-2.0/schemas/org.gnome.desktop.lockdown.gschema.xml:    <key type="b" name="disable-user-switching">
/usr/share/glib-2.0/schemas/org.gnome.desktop.screensaver.gschema.xml:    <key type="b" name="user-switch-enabled">

To change the default, which is user switching enabled, one has to use the correct method to override GSettings defaults, which is to create a .gschema.override file, and re-compile the schemas.

To override the above two GSettings options I created /usr/share/glib-2.0/schemas/org.gnome.desktop.lockdown.gschema.override and /usr/share/glib-2.0/schemas/org.gnome.desktop.screensaver.gschema.override with the following contents:

shell$ cat /usr/share/glib-2.0/schemas/org.gnome.desktop.lockdown.gschema.override


shell$ cat /usr/share/glib-2.0/schemas/org.gnome.desktop.screensaver.gschema.override

Then the schemas need to be re-compiled:

shell$ sudo glib-compile-schemas /usr/share/glib-2.0/schemas/

This refreshes the file /usr/share/glib-2.0/schemas/gschemas.compiled so the overridden GSettings that we configured are used. Logging out and restarting the lightdm service (sudo service lightdm restart) is required so the new configuration takes effect.

There is a wrinkle in all this, however — the session indicator (provided by the package indicator-session) in Ubuntu 14.04 (and probably some previous releases) does not take into consideration the above GSettings options so user switching is always available regardless of configuration. This is tracked in Ubuntu bug #1325353, which is fixed in Ubuntu 14.10. I did not want to upgrade my machine from 14.04 to 14.10 so I just downloaded the latest version of the indicator-session package (from what will become Ubuntu 15.04) and installed that (there were no package dependency problems).

I thought I would write about my experience disabling user switching because it requires overriding GSettings preferences via .gschema.override files and gschema recompiles, which is something I keep forgetting how to do.

As to whether disabling user switching fixes the black screen problem… only time will tell — users cannot use the computer while someone else is logged in. Instead, the user logged in must log out and then the new user has to log in via the LightDM greeter.

Note: The following  askubuntu.com question was very useful to figure out how to change GSettings defaults: