Firefox crashes when opening a file dialog

Is anyone else experiencing the following?

  1. You’re using Pantheon as your desktop and Firefox as your browser.
  2. Opening a file chooser from Firefox (saving a web page, opening a file, etc.) results in a crash.
  3. Starting Firefox with env -u NIX_GSETTINGS_OVERRIDES_DIR firefox resolves the above crash.

I want to see if anyone else is running into something similar before filing a bug report (just to rule out the possibility that it’s a problem with my setup).

To give a bit more detail, the issue is superficially similar to the one described in #75851, in that Firefox crashes with the following error:

Settings schema 'org.gtk.Settings.FileChooser' does not contain a key named 'show-type-column'

On closer inspection, however, it turns out that on my system the org.grk.Settings.FileChooser schema specified via elementary-gsettings-schemas (by way of the NIX_GSETTINGS_OVERRIDES_DIR variable) is indeed missing the show-type-column key. Unsetting NIX_GSETTINGS_OVERRIDES_DIR allows Firefox to open a file chooser without any other apparent ill effects (and I don’t remember running into this problem when using vanilla GNOME), so I think the issue is related to Pantheon and/or the NixOS packaging thereof.

Hey :wave: nixpkgs Pantheon maintainer here.
This issue here is rather interesting, I cannot reproduce it. Which channel are you on?

I’d like to address the things in particular I cannot reproduce that you’ve mentioned (I’m on nixos-unstable).

Things I cannot reproduce

elementary-gsettings-schemas is missing a schema with key show-type-column
❯ echo $NIX_GSETTINGS_OVERRIDES_DIR                                                                                                                                         

❯ cd $NIX_GSETTINGS_OVERRIDES_DIR                                                                                                                                           

❯  rg "show-type-column" 
97:    <key name='show-type-column' type='b'>

The schema, as its namespace suggest, comes from gtk3.


Because you said unsetting this made the issue go away, perhaps the expression is broken.

firefox crashes with an error when opening the file chooser

This implicates that firefox could be wrapped incomplete, here’s what the wrapper looks like on my system

# this is the content of /run/current-system/sw/bin/firefox

#! /nix/store/xb062l4b76zyhq6grqf4iyfdikkpg8fl-bash-4.4-p23/bin/bash -e
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+':'}'/nix/store/m7s79nz19n92s0xb3y2h89rs992nmxgy-systemd-243.3-lib/lib:/nix/store/8wmdvm0vih1agy3pd3szj6qipl0rdas9-ffmpeg-3.4.6/lib:/nix/store/dzga394c4rdg0si8jh0rkczb8k7v3p37-libkrb5-1.17/lib:/nix/store/l3skbzsxxbvljd6jv61ibsbm8gmnps5l-libpulseaudio-13.0/lib:/nix/store/m7s79nz19n92s0xb3y2h89rs992nmxgy-systemd-243.3-lib/lib64:/nix/store/8wmdvm0vih1agy3pd3szj6qipl0rdas9-ffmpeg-3.4.6/lib64:/nix/store/dzga394c4rdg0si8jh0rkczb8k7v3p37-libkrb5-1.17/lib64:/nix/store/l3skbzsxxbvljd6jv61ibsbm8gmnps5l-libpulseaudio-13.0/lib64'
export GTK_PATH=$GTK_PATH${GTK_PATH:+:}'/nix/store/jf5bca11rf8xkxmbs7mqp11kj3q67rp4-libcanberra-0.30/lib/gtk-2.0/'
export PATH=$PATH${PATH:+':'}'/nix/store/swyqa6664rbnc5wn32sam72k3xgm3cnc-firefox-bin-71.0/bin'
export MOZ_APP_LAUNCHER='firefox'
export MOZ_SYSTEM_DIR='/nix/store/swyqa6664rbnc5wn32sam72k3xgm3cnc-firefox-bin-71.0/lib/mozilla'
export SNAP_NAME='firefox'
export XDG_DATA_DIRS='/nix/store/345mw6v7afi6r9j3wm0qp4m966rrpl6g-gsettings-desktop-schemas-3.34.0/share/gsettings-schemas/gsettings-desktop-schemas-3.34.0:/nix/store/b3gkg5hw5xrsammcnpvdqh9digzg6hy7-gtk+3-3.24.12/share/gsettings-schemas/gtk+3-3.24.12:/nix/store/345mw6v7afi6r9j3wm0qp4m966rrpl6g-gsettings-desktop-schemas-3.34.0/share/gsettings-schemas/gsettings-desktop-schemas-3.34.0:/nix/store/b3gkg5hw5xrsammcnpvdqh9digzg6hy7-gtk+3-3.24.12/share/gsettings-schemas/gtk+3-3.24.12'${XDG_DATA_DIRS:+':'}$XDG_DATA_DIRS
export XDG_DATA_DIRS=$XDG_DATA_DIRS${XDG_DATA_DIRS:+':'}'/nix/store/s0f87d74svmjwc84sx4s8vscs6kpys3l-adwaita-icon-theme-3.34.3/share'
exec "/nix/store/yxsjpfg8bk611qmrr4c2pbcvppjarfgz-firefox-release-bin-unwrapped-71.0/bin/firefox"  "$@"

we make gtk3 find the correct gsettings schemas by exporting them into XDG_DATA_DIRS

export XDG_DATA_DIRS='/nix/store/345mw6v7afi6r9j3wm0qp4m966rrpl6g-gsettings-desktop-schemas-3.34.0/share/gsettings-schemas/gsettings-desktop-schemas-3.34.0:/nix/store/b3gkg5hw5xrsammcnpvdqh9digzg6hy7-gtk+3-3.24.12/share/gsettings-schemas/gtk+3-3.24.12:/nix/store/345mw6v7afi6r9j3wm0qp4m966rrpl6g-gsettings-desktop-schemas-3.34.0/share/gsettings-schemas/gsettings-desktop-schemas-3.34.0:/nix/store/b3gkg5hw5xrsammcnpvdqh9digzg6hy7-gtk+3-3.24.12/share/gsettings-schemas/gtk+3-3.24.12'${XDG_DATA_DIRS:+':'}$XDG_DATA_DIRS

which has gtk3's schema directory.

Things you could try to humor me

Try unsetting the environment variables:


Does firefox can with any change?

This is interesting because in Pantheon we use a different filechooser module.
Before in Gnome3 you didn’t.

A Bit More About My Setup

I run the base of my system on nixos-19.09, but then selectively install most of my day-to-day packages as my local user via home-manager. A couple of these packages, including Firefox, are pulled from nixos-unstable (motivation for Firefox).

It’s kind of non-standard, which was one reason I wanted to see if anyone else was experiencing this issue.

Missing GSettings Key

Duplicating your commands, I get a very different result.



❯ rg "show-type-column" # Outputs nothing

If I check out my GTK installation, I find that it’s not elementary-gsettings-schemas that’s at fault here.

❯ cd /nix/store/v1172q7ilr3d5fjxkfn5vk8gn1kv6pz9-gtk+3-3.24.10/share/gsettings-schemas/gtk+3-3.24.10/glib-2.0/schemas/

❯ rg "show-type-column" # Also outputs nothing

Firefox Wrapper

Interestingly, my Firefox wrapper is very different from yours, completely lacking the XDG_DATA_DIRS lines.

❯ cat ~/.nix-profile/bin/firefox
#! /nix/store/rm1hz1lybxangc8sdl7xvzs5dcvigvf7-bash-4.4-p23/bin/bash -e
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+':'}'/nix/store/g4vw6iwchva8mfs3njgz6lxjivrxqlrq-systemd-243.3-lib/lib:/nix/store/mv0pflsj7slsjpxaxfabsd0albdxwy3h-libpulseaudio-12.2/lib:/nix/store/g4vw6iwchva8mfs3njgz6lxjivrxqlrq-systemd-243.3-lib/lib64:/nix/store/mv0pflsj7slsjpxaxfabsd0albdxwy3h-libpulseaudio-12.2/lib64'
export GTK_PATH=$GTK_PATH${GTK_PATH:+:}'/nix/store/8fw0izf75d24c9wl3a4wi01bqwihmb8a-libcanberra-0.30/lib/gtk-2.0/'
export PATH=$PATH${PATH:+':'}'/nix/store/3f56wixyly6mxi62gm2iwsgvwbzb2grm-firefox-71.0/bin'
export MOZ_APP_LAUNCHER='firefox'
export MOZ_SYSTEM_DIR='/nix/store/3f56wixyly6mxi62gm2iwsgvwbzb2grm-firefox-71.0/lib/mozilla'
export SNAP_NAME='firefox'
exec "/nix/store/av1722752dvq43cgkal3wj5vk6dl60b4-firefox-71.0/bin/firefox"  "${extraFlagsArray[@]}" "$@"


GTK_MODULES is set in my environment, but GTK3_MODULES isn’t.

❯ env | grep GTK_MODULES

❯ env | grep GTK3_MODULES # No output

Attempting to unset things in various ways doesn’t change the results.

❯ firefox # Crash
❯ env firefox # Crash
❯ env -u NIX_GSETTINGS_OVERRIDES_DIR firefox # Works
❯ env -u GTK_MODULES firefox # Crash
❯ env -u GTK3_MODULES firefox # Crash
❯ env -u GTK_MODULES -u GTK3_MODULES firefox # Crash

A Fix, But I Don’t Understand Why

The fact that my Firefox wrapper was missing the XDG_DATA_DIRS directives made me think that the problem might be with Firefox, and not Pantheon. So I switched over to Firefox from nixos-19.09 (which is currently the same version as the one in nixos-unstable), and…

It works!

No crash when opening up the file chooser, and I’m definitely getting the Pantheon chooser rather than the default GTK one. Except that my hypothesis about the missing XDG_DATA_DIRS export is wrong.

❯ cat ~/.nix-profile/bin/firefox
#! /nix/store/rm1hz1lybxangc8sdl7xvzs5dcvigvf7-bash-4.4-p23/bin/bash -e
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+':'}'/nix/store/g4vw6iwchva8mfs3njgz6lxjivrxqlrq-systemd-243.3-lib/lib:/nix/store/mv0pflsj7slsjpxaxfabsd0albdxwy3h-libpulseaudio-12.2/lib:/nix/store/g4vw6iwchva8mfs3njgz6lxjivrxqlrq-systemd-243.3-lib/lib64:/nix/store/mv0pflsj7slsjpxaxfabsd0albdxwy3h-libpulseaudio-12.2/lib64'
export GTK_PATH=$GTK_PATH${GTK_PATH:+:}'/nix/store/8fw0izf75d24c9wl3a4wi01bqwihmb8a-libcanberra-0.30/lib/gtk-2.0/'
export PATH=$PATH${PATH:+':'}'/nix/store/ay73153bvfffwly41d533w863xhxgsd6-firefox-71.0/bin'
export MOZ_APP_LAUNCHER='firefox'
export MOZ_SYSTEM_DIR='/nix/store/ay73153bvfffwly41d533w863xhxgsd6-firefox-71.0/lib/mozilla'
export SNAP_NAME='firefox'
exec "/nix/store/1gwjx0z9q939kd2c8bh5fablc7mzfhi8-firefox-71.0/bin/firefox"  "${extraFlagsArray[@]}" "$@"

So at this point I’m thinking it’s an issue with the version of Firefox in nixos-unstable, but I’m at a total loss as to what it could be (outside of unhelpfully flapping my arms and exclaiming, “but they’re different somehow!”).

Any suggestions about how I could try drilling down further?

The show-type-column setting was added in GTK 3.24.12. You discovered yet another issue with NIX_GSETTINGS_OVERRIDES_DIR mechanism.

Since GSettings overrides only allow to override default values as a part of binary gschemas description, we need to generate the file for a whole schema in order to change just a single default value. The mechanism is intentionally impure in order to avoid having to rebuild every package if user changes some GTK default value. This means the application will see a GSettings schemas from the system installation instead of the ones added by wrapGAppsHook wrapper, even if the system ones are outdated. And since GLib is designed to crash when missing a GSettings key (gschemas are basically part of code, even if loaded externally, and it expects consistent system), crash is what you get.

I am afraid there is no solution to this other than having consistent system or forbidding impurities (at the cost of rebuilds). Well, using some kind of runtime file system overrides instead of environment variables to make impurities would work but would also be messy and hard to implement.

The best option is to avoid the overrides by writing the settings to dconf database directly but that is not implemented yet. It might still cause issues when a type of some setting changes between versions but that would break even non-NixOS systems so hopefully people are smart enough to avoid doing that.

Ah. Looking at ~/.nix-profile/bin/firefox again, I realize that the exec line points to another wrapper, that does have the XDG_DATA_DIRS exports.

❯ cat /nix/store/av1722752dvq43cgkal3wj5vk6dl60b4-firefox-71.0/bin/firefox
#! /nix/store/86ap9r7vjvcy44kskgms1yc1wxdsiq2z-bash-4.4-p23/bin/bash -e
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+':'}'/nix/store/m9k5vs6bblv626zyf5ybnl25zgx1z300-systemd-243.
export GTK_PATH=$GTK_PATH${GTK_PATH:+:}'/nix/store/16gp8p2b43whi9v5pzxsm717kb5gr1dp-libcanberra-0.30/lib/gtk-2.0/'
export PATH=$PATH${PATH:+':'}'/nix/store/av1722752dvq43cgkal3wj5vk6dl60b4-firefox-71.0/bin'
export MOZ_APP_LAUNCHER='firefox'
export MOZ_SYSTEM_DIR='/nix/store/av1722752dvq43cgkal3wj5vk6dl60b4-firefox-71.0/lib/mozilla'
export SNAP_NAME='firefox'
export XDG_DATA_DIRS='/nix/store/6dp58w58hs7a6d3bq1i3va16834198wy-gsettings-desktop-schemas-3.34.0/share/gsettings-sche
export XDG_DATA_DIRS=$XDG_DATA_DIRS${XDG_DATA_DIRS:+':'}'/nix/store/54xhhzsh6a193bzas73v9fa6g2dkmmj3-adwaita-icon-theme
exec "/nix/store/d32zmysca61v5y3g79q4aahdajm13sp6-firefox-unwrapped-71.0/bin/firefox"  "$@"

So (if I understand @jtojnar right), Firefox in nixos-19.09 must be built against GTK 3.24.10, while the Firefox in nixos-unstable is built against GTK 3.24.12 (see the XDG_DATA_DIRS lines above). Unsetting NIX_GSETTINGS_OVERRIDES_DIR “fixes” the issue because Firefox then picks up the GSettings that are defined in its wrapper by XDG_DATA_DIRS, rather than the globals (which are out-of-date relative to Firefox in nixos-unstable.

The reason I thought it was related to Pantheon must be coincidental then: The last time I played with the file dialog on Firefox (which I don’t hit very often), I was running GNOME and nixos-unstable must not have moved to 3.24.12 yet, and when I ran into the problem I wrongly assumed that the DE change was at fault.

To add more detail, the issue is indeed triggered in Pantheon because it specifically overrides GTK settings. GNOME does not do that (compare packages overridden by gnome.nix and pantheon.nix) so its NIX_GSETTINGS_OVERRIDES_DIR does not include gtk3 schemas making Firefox use the correct ones from the wrapper.

Got it.

Just for someone taking a look at this thread in the future, the difference can be seen by comparing nixos-gsettings-desktop-schemas in desktop-managers/gnome3.nix with the elementary-gsettings-schemas package (which is pulled in by desktop-managers/pantheon.nix).

Thanks for helping me understand what’s happening here, @worldofpeace and @jtojnar!

This is also another reason why I don’t recommend mixing software distributions (like using unstable with stable) even though it should in theory be great. Nix makes the distribution of all this great, but software isn’t perfectly backwards compatible and there’s no real way to enforce that.

I believe that change has never landed, and it’s being supported pretty well on stable? Just maybe not the fastest.

Ahh, I actually had a similar thing happen in Pantheon because of NIX_GSETTINGS_OVERRIDES_DIR when I was testing a program when we updated to Gnome 3.34 and the host had 3.32.
Can’t wait when we stop using overrides in this way.

For others coming from searching for the problem of packing apps that error with (edit: better solution further down):

GLib-GIO-ERROR **: 15:24:37.738: Settings schema 'org.gtk.Settings.FileChooser' does not contain a key named 'show-type-column'

For me this was the solution in e.g. preFixup:

      wrapProgram "$out/bin/$program" \
        --prefix XDG_DATA_DIRS : ${gsettings-desktop-schemas}/share/gsettings-schemas/${} \
        --prefix XDG_DATA_DIRS : ${gtk3}/share/gsettings-schemas/${} \
        --prefix LC_ALL : C.UTF-8 \
        --prefix LD_LIBRARY_PATH : "$out:${lib.makeLibraryPath [ libpng12 zlib ocl-icd ]}"

(I found that from here).

It is unrelated to this issue but yeah, it has the same result.

See also for
the packaging problems.

I just want to note that we discourage people doing this, so if anyone wants to submit a PR please see the gnome documentation in the nixos manual. We have wrapGAppsHook which was made to do that easily.

1 Like

I see, indeed

  nativeBuildInputs = [

  buildInputs = [

also fixes the problem with packaging my proprietary app, and looks much better than my manual wrapper above.