Oliver Smith
on 17 April 2023
The Firefox snap: Updates and Upgrades
The official Firefox snap offers a number of benefits to daily users of Ubuntu, as well as a range of other Linux distributions. It improves security, delivers cross-release compatibility and shortens the time for improvements from Mozilla to get into the hands of end-users.
Since the user experience of our default browser is imperative to our work, we’ve made significant improvements to snap startup times and identified a number of additional issues to resolve along the way.
It’s been a while since our last update, but both Mozilla and the Canonical team have continued to make further improvements to the Firefox snap experience over the last few months.
With some key features recently landed, we thought it was time to give the community a roundup of fresh news and fixes as we ramp up to the release of Ubuntu 23.04! Let’s start with our most… highly requested feature.
The pending update problem
While it’s good to know when a new update to Firefox is available, our previous messaging was generally regarded as heavy handed and hard to action. Users received a daily pop-up counting down to the automatic refresh of the snap. To dismiss this notification, users would need to run
from the command line or visit Ubuntu Software to apply the update.snap refresh firefox
Snap users will be happy to know that we have implemented new functionality in snapd to streamline the refresh experience for *all* desktop snaps. With this change, snaps will now download and pre-initialise an update (when available) in the background then wait for the app to close- or the system to reboot- before switching to the new version. This means users can apply updates immediately by closing the application, and those updates will be applied more quickly than before, minimising disruption.
This change landed as part of snapd 2.59, and is currently rolling out to all users with additional UI feedback on refresh status following shortly after. You can read more about the history behind our refresh implementation in our November blog post.
Take control of your snap updates
If you’re someone who wants more fine-grained control of the update frequency for snap applications, or wish to hold a snap on a particular version, we have implemented a new hold
feature for snaps. Read our blog about this functionality for more details.
Software Rendering on the Raspberry Pi
The outstanding performance impact on the Raspberry Pi has been an issue whereby Firefox would fail to detect the GPU (or fail to utilise hardware acceleration). As a result, the browser would fall back to software rendering, which significantly impacts performance.
After continued investigation, we identified that the problem was caused by an upstream issue with Mesa, an open source implementation of common graphics APIs. This was resolved in Mesa 22.2, which is now included in the latest Firefox snap build.
With this change, Firefox can now effectively leverage the GPU on the Raspberry Pi and users will notice significant improvements in graphically intensive pages (including video playback) in particular. The screenshots below compare the classic WebGL Aquarium sample on stock Firefox under Ubuntu 22.10 (in which it achieves 8fps), and Ubuntu 23.04 (in which it achieves 12fps).
However, it is worth noting that Firefox is currently running under “xwayland” rather than “wayland” directly; launching Firefox with “MOZ_ENABLE_WAYLAND=1” in the environment causes the browser to launch directly under Wayland which results in further performance improvements:
In this configuration, the aquarium sample achieves 16fps (exceeding Chromium’s performance, which has had WebGL acceleration on the Pi for some time now). Please note, there may still be some rough edges when running directly under Wayland.
There is more that can be done in this area and some Rasperry Pi specific optimisations to Vulkan are currently in progress that should deliver additional improvements over time.
Whilst these fixes are not specific to the fact that Firefox is packaged as a snap, one of the benefits of snap packages is that when these improvements are available they will be accessible to all users of Firefox on the Pi, regardless of the Ubuntu release they are running.
Feel the need, the need for more speed?
Ubuntu 22.10 introduced a new kernel configuration that enables the use of multi-threaded CPU decompression for squashfs. This should add further reductions to Firefox start up times. The benefits of this change will vary depending on the specs of your machine, with newer CPU generations seeing the biggest gains. This change was also recently backported to Ubuntu 22.04.2 LTS. Please let us know if you experience a significant improvement in our Firefox snap performance discourse thread.
Summary of earlier fixes
We’ve been collaborating closely with Mozilla to introduce a number of other improvements, prioritised based on community reports. We’d like to acknowledge Alexandre Lissy from Mozilla for their involvement in debugging and resolving these problems.
Native messaging support
This important feature enables support of WebExtensions such as GNOME Shell integration and KeePassXC, and was the most commonly requested fix after startup performance. The two-part solution involved a new WebExtensions XDG desktop portal coupled with Firefox integration.
Debug symbols
In situations when a browser crash occurs, debug symbols now enable more helpful and actionable crash reporting for the Firefox snap.
Host system spellcheck dictionary integration
Firefox is now able to leverage spell check dictionaries already installed on the host machine.
Text to speech support
Snapd now supports access to the speech-dispatcher service to enable text-to-speech.
Firefox PDF font rendering
The snap package of Firefox now uses the fonts available on the host system when viewing PDF files.
Looking ahead
If you’ve been following this series closely, you may notice that there are still two outstanding performance improvements that we’re investigating. Let’s quickly check in on their progress.
Pre-caching
This term typically refers to the process by which software anticipates future user actions and preemptively downloads, installs, or unpacks the necessary files so that they’re ready to go as soon as they are called upon. It can also refer to the process of loading application data and libraries into memory ahead of their actual use by the application.
We are continuing to look at the possibility of pre-caching the GNOME and KDE content snaps on system startup to further reduce the launch time of desktop snaps that depend on these frameworks. This should deliver a general benefit to snap users regardless of their choice of daily browser.
Network mounts
The Firefox snap is currently unable to interact with network shares. This has to do with the XDG Desktop Portal working in local mode. The fix for this is still in progress but is next on our list after the release of Ubuntu 23.04.
Thank you for your feedback
Over the last few months, we’ve made significant progress in the user experience of the Firefox snap, often in ways that benefit the broader desktop app ecosystem with the addition of new desktop portals as well as changes to squashfs compression and snapd behaviour.
We’d like to take this opportunity to thank all of the community members who have shared their benchmarks, tested fixes and reported issues to help us improve. Your continued engagement has allowed us to prioritise and identify the most important areas of investigation and move quickly to address them. We appreciate your continued support!
See you on the other side of Ubuntu 23.04.