Can't set default browser in mint

If I install the chromium snap in Linux Mint 18 and hit the “make default” button to make the browser my default, it fails. The following error appears in the console.

error org.freedesktop.dbus.error.failed: cannot set setting default-web-browser: exit status 2

And the new browser is not set default. I have seen this with Chromium and other browsers. It fails on Mint 18 under cinnamon, but works fine on Ubuntu 18.04 and Ubuntu MATE 18.04.

Where should this bug be reported?

Are there security policy denials? AFAIK, chromium used to use ‘xdg-settings’ and snapd these days ships an xdg-settings in the core snap that talks to userd.

Looking at this error string: error org.freedesktop.dbus.error.failed: cannot set setting default-web-browser: exit status 2, this seems to be coming from userd: https://github.com/snapcore/snapd/blob/master/userd/settings.go#L222

Based on this error string, it seems that the /usr/bin/xdg-settings script from the core snap is failing, specifically dbus-send --reply-timeout=300000 --print-reply=literal --session --dest=io.snapcraft.Settings /io/snapcraft/Settings io.snapcraft.Settings.Set string:"$2" string:"$3" | cut -b4-. Perhaps you can try this on the affected system:

$ snap run --shell chromium
<snap>$ /usr/bin/xdg-settings get default-web-browser # report what it says

<snap>$ /usr/bin/xdg-settings set default-web-browser chromium.desktop # this should prompt you

<snap>$ dbus-send --reply-timeout=300000 --print-reply=literal --session --dest=io.snapcraft.Settings /io/snapcraft/Settings io.snapcraft.Settings.Set string:"default-web-browser" string:"chromium.desktop" | cut -b4- # this should also prompt you

You might also try running snap run --strace chromium and seeing what it has to say about xdg-settings and the arguments it is being passed.

NOT-THIS-SNAP.desktop

Yes indeed.

Yup

I see no references to xdg in the strace output of chromium :frowning:

@oSoMoN - fyi, it seems that the chromium snap isn’t using xdg-settings to set chromium as the default browser. This might be Mint specific (perhaps chromium is conditionally using xdg-settings?).

This is a mint-specific issue indeed, I am able to reproduce in a VM. Chromium does call xdg-settings though, but mint fails to set the default browser. This can be observed outside of the snap’s confinement too:

me@mintvm:~$ xdg-settings set default-web-browser chromium_chromium.desktop
me@mintvm:~$ echo $?
2
me@mintvm:~$ xdg-settings get default-web-browser
firefox.desktop

This happens just after installing snapd and installing the chromium snap. If I reboot the machine, then everything starts working. I suppose this is because xdg-settings looks for the chromium_chromium.desktop file in the XDG_DATA_DIRS folders and doesn’t find it until the next restart when /var/lib/snapd/desktop has been added to it.

@popey can you confirm what I’m seeing? Can we consider this a non-issue? (I guess the same happens on other distributions that don’t ship snapd by default if you install the chromium snap without a session restart in between).

1 Like