Ubuntu – Firefox hangs because sort-directories-first setting missing


I recently upgraded from xubuntu 14.04 to xubuntu 16.04. The process finished but did not go smooth (I don't remember why).

Now in firefox when I open a file (File -> Open File) the process crashes with the following error:

... GLib-GIO-ERROR **: Settings schema 'org.gtk.Settings.FileChooser' does not contain a key named 'sort-directories-first'

I searched around the web and did not find anything relevant. Reinstalling firefox, gsettings-desktop-schemas and gsettings-ubuntu-schemas (with apt-get install --reinstall ...) did not change anything. I also tried rebuilding the schemas but the error is always the same:

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

The (not so) funny thing is that the key exists!

grep sort-directories-first /usr/share/glib-2.0/schemas/*
Binary file /usr/share/glib-2.0/schemas/gschemas.compiled matches
/usr/share/glib-2.0/schemas/org.gnome.nautilus.gschema.xml:    <key type="b" name="sort-directories-first">
/usr/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml:    <key type="b" name="sort-directories-first">

At the end I tried manually creating the key. With gsettings it complains the key does not exist:

gsettings set org.gtk.Settings.FileChooser sort-directories-first false
Not such key 'sort-directories-first'

With dconf I can create that key but nothing changes:

dconf write /org/gtk/settings/file-chooser/sort-directories-first false 

Best Answer

The file /usr/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml exists and contains the desired key sort-directories-first.

We know from the answer by WinEunuuchs2Unix that the system will look for the file in a location depending on the value of XDG_DATA_DIRS environment variable.

So what happen when the system looks for org.gtk.Settings.FileChooser.gschema.xml in a different location ?

The error-message doesn't tell us that the system can't find the file, the message tells us that the system can't find the key in the file. That makes me sure that you have a second file named org.gtk.Settings.FileChooser.gschema.xml somewhere in your system and this file doesn't contain the desired key.

As a workaround I would suggest that you search for files with the name org.gtk.Settings.FileChooser.gschema.xml, I am sure you will find more than only one. Check the content of that file in the different location if it contains the desired key, it will not.

Copy over from


You may check the value of XDG_DATA_DIRS with echo $XDG_DATA_DIRS in terminal, that may give you a clue where to search for files.

I couldn't find out how to set the value for XDG_DATA_DIRS, the value will be set during start-up by a bash-script, but information I found seemed to be outdated.

Your issue might be related with this bug, Google leads me to this link while searching the net about your issue.

Related Question