2

I upgraded my 20.04 Ubuntu 22.04 recently. I opted out of the default "Snap" Firefox, and followed these instructions to replace it with the Firefox maintained in the Mozilla Team PPA repository.

However, I've just done an update & upgrade on my system (I use apt for this instead of the Software Updater), and Firefox looks like it may have reverted to the default "Snap" version. From the Help, About Firefox window I see the statement "Mozilla Firefox for Ubuntu canonical - 1.0" as shown in the screenshot:

Question: How can I tell if I've got the Snap version, or the PPA version?

Please note that I'm not asking how to install it as there are plenty of tutorials, and a Q&A here in SE addressing that. I simply want to know how to verify that I've got the PPA version (or the SNAP version).

enter image description here

Seamus
  • 636

2 Answers2

6

One option is to find Firefox process in System Monitor and open its properties. Snap version runs from /snap location with Security Context set. firefox process properties

R A
  • 551
3

Actually, symbolic links are located in /snap/bin the executable snaps are in /snap under a folder of it's name. The output of ls -l $(which firefox) will show you the file path that is launched for what is found first based on the definition of your $PATH environment variable:

This one is the apt version that can also be seen with apt list firefox --installed (if it is installed it will say [installed]):

$ apt list firefox --installed
Listing... Done
firefox/focal-updates,focal-security,now 104.0+build3-0ubuntu0.20.04.1 amd64 [installed]
$
$ ls -l $(which firefox)
lrwxrwxrwx 1 root root 25 Aug 18 22:25 /usr/bin/firefox -> ../lib/firefox/firefox.sh

The shell $PATH will determine which version is launched first. If you have both installed, it will find the first version based on looking through the file paths defined from left to right, which may vary. The defined $PATH can be changed (take care here!) to redefine which version is launched. This is not typically the way it is done. It's often easier to define an alias to do this and leave the variable alone:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$ PATH=/snap/bin:$PATH
$ echo $PATH
/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$ ls -l $(which firefox)
lrwxrwxrwx 1 root root 13 Sep 13 14:12 /snap/bin/firefox -> /usr/bin/snap

You could further launch Firefox and see which version is running:

$ firefox &
$ for i in $(pgrep firefox); do cat /proc/$i/cmdline ; echo ; done
/usr/lib/firefox/firefox-new-window
/snap/firefox/1810/usr/lib/firefox/firefox

That first version is the apt version and the second is the snap version and yes, both versions can run at the same time.

System Monitor output showing both snap and apt versions running

CG3
  • 306
  • Only your last paragraphs actually constitute the answer. If the transitional package firefox is installed, there will be a wrapper script "firefox" that runs the snap version, so which firefox does not give conclusive indication. – vanadium Sep 14 '22 at 11:49
  • If you want to dig into the variables and scripts, perhaps, there is a very slight chance of that occurring. In this default case, that is incorrect. There is no wrapper pointing from one to the other. There is already plenty of evidence to support snap and/or apt and how to view each. Need more? The Firefox browser GUI Help->About displays "Mozilla Firefox Snap for Ubuntu" or "Mozilla Firefox for Ubuntu" to represent the snap and apt versions, respectively. – CG3 Sep 14 '22 at 14:46
  • What is "the default case" for you? Many users upgrade, and will have a wrapper script installed. The chance of having that script is not so slight as you seem to assume, and it prevents the method of looking to what executable is called from being reliable. I deleted my answer when I found this out. – vanadium Sep 14 '22 at 14:53
  • FF via snap is 22.04 default. Install apt transitional pkg & it doesn't link to firefox.sh and has a different package name: firefox/jammy,now 1:1snap1-0ubuntu2 amd64 [installed]. All things that do indeed help. The wrapper installs the snap version if it doesn't exist then launches the snap version at the end. Works like it is supposed to. After installing "transitional", try running things listed above. They still show /snap, with the snap version. That was how you can tell the difference., ls -l $(which firefox) is a starting point and was a flaw in your initial post. – CG3 Sep 14 '22 at 19:11
  • To answer your question, I tried it on fresh desktop 20.04 (upgrade) and out of the box 22.04. – CG3 Sep 14 '22 at 19:12
  • 1
    I see, after carefully rereading. Small detail still, with the wrapper script installed, it is not immediately clear. The output then reads -rwxr-xr- 1 root root 2377 feb 22 2022 usr/bin/firefox, so there one would need to open that script to see it calls the snap version. – vanadium Sep 15 '22 at 08:19
  • I mentioned that above, /usr/bin/firefox with an apt install is a symbolic link (lrwxrwxrwx 1 root root 25 Aug 18 22:25 /usr/bin/firefox -> ../lib/firefox/firefox.sh) whereas with the snap transitional package it's an executable script with no link (I didn't mention the executable part - but I did mention the lack of a link). – CG3 Sep 15 '22 at 13:15