Why I Switched Firefox from Snap to Flatpak

This – this is the reason:

Snap update notification

Unlike other software packages (which includes, I believe, Flatpak) Snap packages will not update if the application is already running. Instead you get this annoying popup “Oh boy, you have 13 days to close your app otherwise nasty things will happen!” Which wouldn’t be such a bad idea in and by itself, except that if you close the application – it doesn’t update. Even the notification doesn’t go away.

I mean – I guess it will update eventually, but Firefox is one of the most (if not the most) important applications I have running – so if I close it for an update, I expect the update to happen immediately – and it doesn’t. Worse – it doesn’t appear as a possible update in the Discover application store (I mean, this could be a bug in Discover – I can update the Firefox snap manually from the command line).

BTW – if you close the notification (which is a permanent notification so it will never close automatically), it will pop back up within the hour – it doesn’t even wait for the next day. With the rate of Firefox releases in recent years (basically, monthly releases) I either have to live with this notification almost constantly in the background, handle it by closing Firefox and running a manual update, or stop using Firefox on Ubuntu!

I won’t drop Firefox – it is, after all, the best browser, so I did the next best thing – I uninstalled the Firefox snap (that comes with Ubuntu) and installed Firefox from Flatpak.

How To, or: Do Not Try This At Home!

I mean – please, do try this at home – but not in that order, or you’ll lose all of your Firefox settings and history.

Steps:

  1. Do not uninstall the Firefox snap yet!
  2. Make sure Flatpak support is installed1.
  3. Install Firefox from Flathub: your software center should be able to help you with that, or you can just go to the link above and follow the instructions from there.
  4. Run the Flatpak Firefox: while you have both the snap and flatpak versions, the application menu will show two Firefox options with no way to distinguish between them – just try both, though it will likely be the second one in a search (for reasons). When Firefox is running, if you click its main menu and choose “Help” -> “About”, it should say “Mozilla Firefox Flatpak” on the second line.
  5. Close all the Firefox instances you have running – both Flatpak and Snap. Use the “Quit” menu item (or CTRL+Q) if you want to keep your windows and tabs (and have set up Firefox to remember the windows and tabs – which you should definitely have done).
  6. Open a file browser window to .var/app/org.mozilla.firefox under your home directory, make sure that “show hidden files” is enabled (the ALT+. shortcut will probably work for that), so that you can see the .mozilla hidden folder. Carefully delete it.
  7. Open a file browser to snap/firefox/common under your home directory, show the hidden files and copy the .mozilla folder from there to the .var/app/org.mozilla.firefox folder.
  8. Now – don’t go launching the new Flatpak Firefox directly! Find the application menu entry for the Flatpak Firefox and right click it.
  9. In the menu that opens choose “Open the Profile Manager”. In the dialog that opens there should be at least two options (if you didn’t create additional profiles in your Snap Firefox): “default” and “default-release“. The “default-release” one should be pre-selected, instead select “default” one, make sure the checkbox labeled “Use the selected profile without asking at startup” is checked, and then click “Start Firefox”. You should now have Firefox open with all of your settings, windows, tabs and history.
  10. Uninstall the Firefox snap using the software center – this part is optional, but otherwise it would just be confusing to have two Firefox options every time you open the application menu.

Enjoy your new, less annoying, and possibly even slightly faster, Firefox (YMMV).

Now, I want to make it very clear – I don’t hate Snap as a software packaging format. It has many features that are useful, and some that are even better than Flatpak (for example, you can run snap packaged applications from the terminal without having to write flatpak run long.format.name every time). Unfortunately it also has many features that are annoying: such as the above mentioned update notification, or the fact that it creates a non-hidden home folder directory and tons of mount points that I see every time I look at these things, which is at best annoying noise and at worst actively prevents you from finding what you are looking for. It awfully feels like a product that was rushed to market without addressing serious criticisms that could have been resolved and now we are stuck with this.

  1. apparently, with new Ubuntu versions that is no longer guaranteed []

4 Responses to “Why I Switched Firefox from Snap to Flatpak”

  1. Amir:

    Here is how I switched to the mozillateam build (instead of Flatpak):

    YMMV, YOUR WARRANTY IS NOW VOID, etc. etc.

    If your profile had already been migrated to snap:

    mv ~/snap/firefox/common/.mozilla ~/

    Remove the snap:

    sudo snap remove firefox

    Pin the snapping deb to the lowest priority:

    printf '%s\n' 'Package: firefox*' 'Pin: release o=Ubuntu' 'Pin-Priority: -1' | sudo tee /etc/apt/preferences.d/99mozillateam

    Add the PPA:

    sudo apt-add-repository ppa:mozillateam/ppa

    Install firefox:

    apt policy firefox
    sudo apt install firefox

    • Oded:

      Generally, using an app from a deb package is preferred, I agree. But for Firefox, I find the limited sandboxing that Flatpak offers to provide some value.

      Another advantage that a deb package will have is that they tend to be smaller than a flatpak that needs to package all of its dependencies – which is where the mozillateam Firefox build does not excel: at 232MB (expanded) vs. 239MB of the flatpak, it is not a big difference (I’m not accounting for the org.freedesktop.Platform runtime it relies on, as I use that with other flatpaks that I don’t have debs for).

      Lastly, for some reason the mozillateam Firefox build always crashes for me when sharing screen from Wayland – I’m not sure why, but hunting that down is a bridge too far for me.

  2. Oded:

    Another disadvantage of using Firefox in a flatpak (compared with either a deb package or a snap) is that because of the file access confinement, Firefox will not be able to remember the save folders for downloaded files, even if you have set up browser.download.lastDir.savePerSite – and I quite like this functionality.

    To workaround the issue, open your Flatpak Permissions management application (on Plasma just search for “flatpak” and you’ll find it, or locate it in System Settings -> Applications) and add a “File System Access” entry – with “read/write” permission – to the top directory where you want Firefox to be able to remember folders – I just use /home/odeda/Documents: Firefox has access to write into all of my documents and projects and stuff (basically almost all of my files), but can’t access other applications’ configuration or security keys or stuff like that.

    Security is always a trade-off
    ¯\_(ツ)_/¯

  3. Oded:

    I’ve just listened to Late Night Linux Episode 203 (https://latenightlinux.com/late-night-linux-episode-203/), where they interviewed Ken VanDine from Ubuntu who addressed this issue. According to VanDine, its about users expecting stability – so a user doesn’t restart their browser and suddenly getting a new version – which I think is silly because if I didn’t have Firefox running 24/7, I wouldn’t even see a notification: Firefox would just update silently and one day I’d start Firefox to find a different version (which is actually how I’d want it to be).

    VanDine did say they are working on improving that experience and they’d like to have a UI where the user can get a notification, press a button, and have their Firefox restart with the new version. If that happens – I’ll switch back, as I think that generally speaking – aside from this “updating running applications” issue – Snaps have a better user experience than Flatpak.

Leave a Reply