Migrating to Vanilla Firefox on Ubuntu 22.04

The latest Ubuntu LTS release — 22.04 Jammy Jellyfish — is good and great and swell, but comes with one particularly controversial change: Firefox is now only available as a snap package.

For many users, this change probably won't matter or even be noticed, but there are a handful of reasons this could be a dealbreaker for others, including glacial startup times, broken system notifications, broken addons (like GNOME Shell Integration), and a lack of Wayland windowing support.

Thankfully it is pretty easy to manually download and install Firefox, and you only have to do it once; vanilla Firefox is "evergreen", meaning it will automatically check for an apply updates.

If you need to make the switch, read on!

Download and Extract

Mozilla provides pre-built Firefox binaries on their website. First things first, download the appropriate version for your system architecture (e.g. Linux 64-bit).

The download should come in the form of a tar archive named something like firefox-99.0.1.tar.bz2.

Once you have that, open a terminal, cd to that download location, and type the following:

# Extract the tar.
# Change the file name to match whatever you downloaded.
tar -xvjf firefox-99.0.1.tar.bz2

# Move the extracted "firefox" folder to /opt.
sudo mv firefox /opt/

# Make sure you own still it.
# Change "YOURUSER" to "jane" or whatever, but make sure you keep the
# trailing : shown below.
sudo chown -R YOURUSER: /opt/firefox

# Change the permissions to the root folder so that only you and God can
# play with it.
sudo chmod 700 /opt/firefox

Make it Official

To make the vanilla Firefox usable (in a meaningful way), you need to let your system know about it.

Back in terminal land, run the following two commands:

# Create a symlink to the binary in a $PATH-able place:
sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox

# Download Mozilla's default .desktop shortcut.
wget https://raw.githubusercontent.com/mozilla/sumo-kb/main/install-firefox-linux/firefox.desktop -P ~/.local/share/applications/

If you're running the default GNOME Wayland session, you should tell Firefox to launch in Wayland mode. Open ~/.local/share/applications/firefox.desktop in your text editor of choice, and add "env MOZ_ENABLE_WAYLAND=1" to the "Exec" line so that it reads:

Exec=env MOZ_ENABLE_WAYLAND=1 firefox %u

Intermission

This is a good place to make sure that the vanilla Firefox you just set up can actually run! Haha.

To minimize any ambiguity, do this from the terminal:

/usr/local/bin/firefox

If this pops up a fresh, virginal Firefox instance, it worked!

If not, you probably just need to install a system dependency or two. Ask Google about the error(s) you received, and come back here once everything is working as it should.

Out With the Old

If you haven't already done so, now's the time to remove all of the Ubuntu-supplied copies of Firefox on your system:

# Remove the dummy package.
sudo apt-get purge firefox

# Remove the snap package.
sudo snap remove firefox

You should also remove (or if you prefer, move) the ~/.mozilla profile folder to give your clean install a clean slate to work from:

# Remove the profile folder.
rm -rf ~/.mozilla

Profile Setup!

There are only two things left to do:

  1. Reboot (to clear the GNOME app cache)
  2. Import/(re)Configure your browser preferences

Both tasks should be straight-forward, particularly if you use Firefox Sync, so I won't drag them out, but there are a few differences between the old Ubuntu-provided copies of Firefox and the vanilla one that might not be immediately apparent:

  1. The file menu is disabled by default. To restore it, right-click any empty place on the toolbar and check the "Menu Bar" switch.
  2. The default fonts may not match what you had before. These can be changed by clicking the "Advanced" button in the "Fonts and Colors" settings section.
  3. Updates are handled automatically be default. If you don't like that, check out the "Firefox Updates" settings section.
  4. Website alert settings are likely not synced (even with Firefox Sync). If you have websites that need to beep at you, pull them up and re-allow their alerts.

If you applied the MOZ_ENABLE_WAYLAND trick earlier and want to verify that that is working correctly, type about:support in the location bar. There's a lot of output on this page, but if you CTRL + F for "Window Protocol", you should see its value set to "wayland".

Done!

You can now safely ignore all of the snap-related drama, at least until the next Ubuntu release. Haha.

Josh Stoik
28 April 2022
Previous How You Manage Debian Apt Sources Is Changing
Next Introducing Guff, a Combined SASS/SCSS Compiler and CSS Minifier