Firefox Snap issues on upgrade from Ubuntu 21.04 to 21.10

The initial migration from the deb of 21.04 to the Snap of 21.10 appeared to go smoothly, but once the dust had settled there appear to be a number of issues, which I will list here and add notes as I (hopefully) find solutions. Obviously suggestions welcome and the issues would be worth looking at for the 22.04 release.

The main issue of note is the default browser. The switch from the deb to the Snap does not change the default browser (or didn’t on my install). Instead I ended up with Chrome (also installed) as default. The option within Firefox to check and set itself as default does nothing (to be honest not entirely unexpected). Going into the Ubuntu/Gnome settings doesn’t offer Firefox as an option (although oddly it does offer Opera, which is also installed as a Snap and doesn’t offer Chrome - which is default and installed as a deb; choosing Opera also doesn’t actually change anything).

Secondary issue, that many may not notice, is that I had my download folder set to something other than the default ~/Downloads, and this setting was not migrated.

Third issue, the transition to the Snap broke my password manager. Arguably, again not unexpected as I use KeePassXC as a Snap and it doesn’t handle connection to a browser installed from a Snap. It would good if this was a handled somehow - ideally helping KeePassXC to work Snap to Snap, but at least a warning or choice not to switch to the Snap would be helpful.

Finally (for now?!), Firefox takes around 20 seconds to startup. Once again, not at all unexpected as all my Snaps have this issue - and my machine isn’t that old being a Ryzen 3600 with 64G RAM and running off an NVMe drive.

OK, an update already. I had already set Firefox to check that it was the default browser, but on several restarts it had not noticed it wasn’t / or just not asked me to change it. On an unrelated issue I logged out and switched from Wayland to X.org for my session and on starting Firefox it asked me whether to set it as the default, and choosing yes worked. I can also see it set in the Ubuntu / Gnome settings now, as well as Opera being an option. Odd.

Thank you very much for testing and for the feedback @aptanet!

Would you mind filing bugs on Mozilla’s bug tracker for each separate issue, making sure to specify in the title that they are snap-specific? This would be very helpful to make this feedback directly actionable.

There’s a meta-bug to track all snap-related issues, make sure to reference it in your bugs, this will help with tracking.

Thanks in advance!

That issue is concerning and we want to get to the bottom of it, because it doesn’t affect everyone (I’ve never observed it myself), but it obviously gives a very bad perception of snaps (and rightly so). Let’s use this thread to dig deeper into it, if you don’t mind giving us a hand in debugging.

Can you start by running snap run --trace-exec firefox and sharing the output here?

Also, if every single snap is affected, it would be helpful if you could run the same command for a bunch of them, including very simple ones like hello-world, and share the output for all your tests.

Thanks again.

1 Like

I am having the same problem. I even started a discussion about it here in snapcraft forums.

If we are using this thread for this issue, here are my trace outputs:

snap run --trace-exec firefox
[sudo] contraseña para nicolas: 
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!
Slowest 10 exec calls during snap run:
  0.475s snap-update-ns
  0.509s /usr/lib/snapd/snap-confine
  0.070s /snap/firefox/631/snap/command-chain/snapcraft-runner
  0.344s /snap/firefox/631/snap/command-chain/desktop-launch
  0.070s /usr/bin/dbus-send
  0.093s /usr/bin/xdg-settings
  0.061s /usr/bin/xdg-settings
  14.192s /snap/firefox/631/usr/lib/firefox/firefox
  10.890s /snap/firefox/631/usr/lib/firefox/firefox
  10.077s /snap/firefox/631/usr/lib/firefox/firefox
Total time: 28.494s
❯ etrace exec firefox --no-window-wait
[sudo] contraseña para nicolas: 
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Gtk-Message: 23:12:57.014: Failed to load module "canberra-gtk-module"
Gtk-Message: 23:12:57.164: Failed to load module "canberra-gtk-module"
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!

###!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

45 exec calls during snap run:
     Start     Stop      Elapsed        Exec
     0         1160408   1.16040802s    /snap/bin/firefox
     89149     99820     10.6709ms      /usr/lib/snapd/snap-seccomp
     139976    1138618   998.641967ms   snap-update-ns
     1145961   1155927   9.965896ms     snap-update-ns
     1160408   1246465   86.057901ms    /usr/lib/snapd/snap-exec
     1246465   1609097   362.632036ms   /snap/firefox/631/snap/command-chain/desktop-launch
     1300460   1308629   8.16822ms      /usr/bin/date
     1328831   1335477   6.645917ms     /usr/bin/chmod
     1338127   1342730   4.603147ms     /usr/bin/md5sum
     1344412   1348675   4.262208ms     /usr/bin/cat
     1350801   1354166   3.365039ms     /usr/bin/md5sum
     1357116   1359768   2.651929ms     /usr/bin/cat
     1360646   1398432   37.786006ms    /usr/bin/grep
     1399451   1421991   22.539854ms    /usr/bin/snapctl
     1428792   1461045   32.253026ms    /usr/bin/mkdir
     1463987   1494467   30.480146ms    /usr/bin/realpath
     1496048   1503150   7.102012ms     /usr/bin/realpath
     1507277   1515342   8.065938ms     /snap/firefox/631/gnome-platform/usr/bin/xdg-user-dirs-update
     1517654   1522541   4.887104ms     /usr/bin/realpath
     1525424   1532457   7.033824ms     /usr/bin/realpath
     1534472   1539393   4.920959ms     /usr/bin/realpath
     1541477   1544811   3.334045ms     /usr/bin/realpath
     1546633   1552613   5.980968ms     /usr/bin/realpath
     1555014   1561764   6.750106ms     /usr/bin/realpath
     1563305   1566795   3.489971ms     /usr/bin/realpath
     1568923   1575534   6.61087ms      /usr/bin/realpath
     1578877   1585140   6.263017ms     /usr/bin/mkdir
     1585966   1593083   7.117033ms     /usr/bin/ln
     1595592   1602618   7.02691ms      /usr/bin/rm
     1602921   1607728   4.806995ms     /usr/bin/ln
     1609097   1623026   13.92889ms     /snap/firefox/631/tmpdir
     1618188   1622757   4.569053ms     /snap/firefox/631/gnome-platform/usr/bin/xdg-user-dir
     1623026   1648378   25.352001ms    /snap/firefox/631/firefox.launcher
     1628077   1648000   19.922971ms    /usr/bin/cut
     1628854   1641893   13.038873ms    /usr/bin/id
     1641937   1647760   5.82385ms      /usr/bin/getent
     11187045  31544597  20.357552051s  /snap/firefox/631/usr/lib/firefox/firefox
     11635943  31144908  19.508965015s  /snap/firefox/631/usr/lib/firefox/firefox
     13681891  31222564  17.540673017s  /snap/firefox/631/usr/lib/firefox/firefox
     14725740  14858940  133.19993ms    /usr/bin/xdg-settings
     14753316  14858636  105.319976ms   /usr/bin/dbus-send
     15005095  31151355  16.146260023s  /snap/firefox/631/usr/lib/firefox/firefox
     15203976  15271495  67.518949ms    /usr/bin/xdg-settings
     15539816  15609341  69.525003ms    /usr/bin/dbus-send
     15753404  15833441  80.036163ms    /usr/bin/xdg-settings
Total time:  32.593804836s
Total startup time: 32.632490707
1 Like

Looking at this part of the log:

     1623026   1648378   25.352001ms    /snap/firefox/631/firefox.launcher
     1628077   1648000   19.922971ms    /usr/bin/cut
     1628854   1641893   13.038873ms    /usr/bin/id
     1641937   1647760   5.82385ms      /usr/bin/getent
     11187045  31544597  20.357552051s  /snap/firefox/631/usr/lib/firefox/firefox

it looks like there is a 9.5 second gap between when the firefox.launcher script is started, and when it launches the real firefox executable. We’ve only got the cut, id, and getent calls, so it doesn’t sound like this can be blamed on the profile migration code.

Could this be time taken by the runtime linker to load the Firefox executable and all its libraries?

This! I will not use the Firefox snap until this is resolved.