Firefox refuses to become default browser (Plasma, neon)

Updated: April 11, 2020

Remember my neon escapade with the Network Manager? Turns out, this wasn't the only bugbear I had to face that day. As part of my VPN testing procedure, I also copied a hardened browser profile from Kubuntu into neon, in order to save some time. I wasn't in the mood in having to reconfigure everything, from adblocking to user agent, popup blocking, WebRTC tweaks, and alike. Indeed, one of the elegant things about Firefox is that you can easily copy your profile between machines, and I've done this many many times in the past, with great success.

But then, Firefox started pestering me with the question whether to make it a default browser. Every launch. It would seem my selection wasn't being respected. Even worse, clicking on the Make default button in the browser preferences didn't do anything. A fix was needed.

Default browser, teaser

Other changes

So, I was facing an odd issue. And at first, I thought it was related to my profile import. I couldn't really do anything with the Make default button. Even when I changed file associations through the Plasma application settings, Firefox still kept popping the message, and wouldn't change its state.

Default component, Plasma settings

Make default button

I then decided to refresh Firefox - and this did not help. I then completely purged the browser and deleted all existing profiles, and still, the system wouldn't allow Firefox to be the default browser. So this seems to be an odd problem in Plasma. However, reading online, the issue seems to persist across various operating systems. Well, as Dr. Emil Shuffhausen in Dirty Rotten Scoundrels would say: we need something more stringent.

Under the hood & alternatives

Our goal is to have Firefox as the default browser and not have the annoying prompt. The latter can be solved easily. Just untick the box in the Preferences, and you won't be asked again. But we also need to make sure that Firefox does what we want. To that end, first station: ~/.config/mimeapps.list. This file contains the different file type and program associations (for each user), allowing the system to correctly launch the right application when you click on a file. Typically, the file should have something like:

[Added Associations]
video/mp4=vlc.desktop;

[Default Applications]
application/x-extension-htm=firefox.desktop
application/x-extension-html=firefox.desktop
application/x-extension-shtml=firefox.desktop

I discovered that my associations for where Firefox was supposed to be listed were different, like:

application/x-extension-html=user-firefox-XXXXX.desktop

Random string in the app name

Reading online, I found a bug, which focuses on multiple, parallel installs of Firefox, with a combined setup from the repo archive and a manually downloaded tarball. I manually changed this, and started the browser again, to no avail. In fact, it turns out, for some reason, clicking the Make default button would actually make this association in the mimeapps.list file. Weird.

I decided I must be a bit more stringent. The name of the game: update-alternatives. Ubuntu-based systems have a command-line tool that lets you change the default program for different activities. For instance, you can change the default program (browser) for anything www.

sudo update-alternatives --config x-www-browser

Alternatives prompt

The system reported Chrome being the default browser, which is odd, because I've never set it like that. Perhaps this is an odd KDE neon issue. Anyway, I changed from auto mode to manual (selection 2), and this meant Firefox should become the default browser now. Testable and verifiable by running:

xdg-open file.html

This command will launch whatever program is set to be the default handler for HTML files. After the manual change, it was Firefox. The browser preferences menu was still not listing it correctly, but as far as system functionality goes, everything was working as it should. Problem solved, then.

Conclusion

Maybe I'm just becoming older, wiser and naturally more cynical as time goes by, but I cannot escape the feeling that software quality is continuously going down down down. Less effort goes into making stable and robust products, more of it goes into shiny buzzwords and perceived speed of innovation. This is not strictly Firefox, but the entire industry as a whole. Which means people who expect sane, predictable behavior from their software now get to face random, crazy little bugs and buglets all over the place. Welcome to the future, where abstraction is interaction.

However, on topic, if you're a Firefox user (and you should be), then if you're having odd issues starting your browser in Ubuntu-based distros, and it refuses to set itself as the default browser, you can manually hard-fix the behavior using update-alternatives tool. We also covered a few other areas, all of which should hopefully help you restore expected functionality. Normally, this isn't a problem, and in the past decade, I've only seen Firefox refuse to remember settings a couple of times, with Linux Mint and KDE neon. But there we go. If there was a problem, yo I'll solve it, right? Done.

Cheers.

You may also like: