7

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 
  • 1. What are the override files you have in /usr/share/glib-2.0/schemas/? 2. What is the full output of grep sort-directories-first /usr/share/glib-2.0/schemas/*? is it what you said in the question? – Anwar Sep 11 '16 at 14:10
3
+100

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

/usr/share/glib-2.0/schema/org.gtk.Settings.FileChooser.gschema.xml

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.

| improve this answer | |
  • OP already said they have org.gtk.Settings.FileChooser.gschema.xml – Anwar Sep 11 '16 at 13:30
  • @Anwar yes, this file exits in a specific location,and it doesn't seem to be the file accessed by the system, otherwise the system would have found the key. The location were the system looks up for the file are defined in XDG_DATA_DIRS. If XDG_DATA_DIRS contains wrong value the system will look up for the file in a different location and might find a file with the same name there but this file doesn't contain the key. This really could be the case here and is worth to be checked. – mook765 Sep 11 '16 at 13:58
  • OP created the key in the file. Now the system should find the key right? And I found that, Xubuntu (and Ubuntu) doesn't store .gschema files elsewhere. – Anwar Sep 11 '16 at 14:04
  • 2
    Really good catch. I compiled a custom GLib library some time ago and that library installed a /usr/local/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml schema. Uninstalling that library resolved the issue. In fact /usr/local/share precedes /usr/share on my XDG_DATA_DIRS. – ntd Sep 11 '16 at 14:33
  • congrats! Indeed a good one – Anwar Sep 13 '16 at 14:12
1

Just a little background:

glib-compile-schemas compiles all the GSettings XML schema files in DIRECTORY into a binary file with the name gschemas.compiled that can be used by GSettings. The XML schema files must have the filename extension .gschema.xml. For a detailed description of the XML file format, see the GSettings documentation.

At runtime, GSettings looks for schemas in the glib-2.0/schemas subdirectories of all directories specified in the XDG_DATA_DIRS environment variable. The usual location to install schema files is /usr/share/glib-2.0/schemas.

In addition to schema files, glib-compile-schemas reads 'vendor override' files, which are key files that can override default values for keys in the schemas. The group names in the key files are the schema id, and the values are written in serialized GVariant form. Vendor override files must have the filename extension .gschema.override.

By convention, vendor override files begin with nn_ where nn is a number from 00 to 99. Higher numbered files have higher priority (eg: if the same override is made in a file numbered 10 and then again in a file numbered 20, the override from 20 will take precedence).

If I'm reading your setup correctly you have your .xml files in:

/usr/share/glib/schemas

and not in:

/usr/share/glib-2.0/schemas

where they are expected to be.

If I read it wrong please let me know and I'll delete this answer. I don't use FireFox so could not test the answer like I usually to do.

| improve this answer | |
  • Sorry, the grep output was slightly wrong... I just updated the answer (it was not copy&paste). The /usr/share/glib/ directory doesn't even exist. – ntd Sep 7 '16 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.