I need a proper Firefox installation and not the snap version. The snap version does not work properly with Smart Cards. Although it seems to be possible to get it to work with smart cards it is extremely difficult and I don't care to try and make it work. This is not a tutorial on how to get your PIV or CAC to work. Also snaps suck. Canonical will heopfully abandon snaps in the future.
sudo snap disable firefox
sudo snap remove --purge firefox
error: cannot perform the following tasks:
- Remove data for snap "firefox" (1943) (unlinkat /var/snap/firefox/common/host-hunspell/en_ZA.dic: read-only file system)
If you get this error verify that /var/snap/firefox/common/host-hunspell is mounted as an ext4 file system using lsblk -fe7 -o+ro
sudo systemctl stop var-snap-firefox-common-host\\x2dhunspell.mount
sudo systemctl disable var-snap-firefox-common-host\\x2dhunspell.mount
Removed /etc/systemd/system/default.target.wants/var-snap-firefox-common-host\x2dhunspell.mount.
Removed /etc/systemd/system/multi-user.target.wants/var-snap-firefox-common-host\x2dhunspell.mount.
If this fails you might be able to do this...
sudo umount /var/snap/firefox/common/host-hunspell
sudo snap disable firefox
sudo snap remove --purge firefox
You will probably have leftover files in /var/lib/snapd/seed/snaps from the default Firefox install. You can manually remove them. I don't think there is a snap comand that will remove just the Firefox files. Be careful deleting stuff in this directory especially if you are still using other snaps besides Firefox. You've been warned.
This step is crucial. Without it, Ubuntu will ignore the Mozilla version and reinstall the Snap
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
Package: firefox*
Pin: release o=Ubuntu
Pin-Priority: -1
' | sudo tee /etc/apt/preferences.d/mozilla
To install the .deb package through the APT repository, do the following: Create a directory to store APT repository keys if it doesn't exist:
sudo install -d -m 0755 /etc/apt/keyrings
Import the Mozilla APT repository signing key:
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
If you do not have wget installed, you can install it with: sudo apt-get install wget
The fingerprint should be 35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3. You may check it with the following command:
gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}'
Next, add the Mozilla APT repository to your sources list:
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null
Update your package list and install the Firefox .deb package:
sudo apt-get update && sudo apt-get install firefox
Taken from https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-deb-package-for-debian-based-distributions On this page there are also instructions for installing Firefox from Mozilla builds.
Before migrating profiles, you need to run firefox from your favourite terminal emulator, then see if there's any errors. If you see something link this:
> firefox
[23387] Sandbox: CanCreateUserNamespace() unshare(CLONE_NEWPID): EPERM
[23385] Wayland Proxy [0x7ff5a5b54250] Error: StartProxyServer(): bind() error : Permission denied
Then you need to follow these steps, otherwise, skip:
- Create new AppArmor file for firefox
sudo nano /etc/apparmor.d/usr.lib.firefox.firefox
- Copy-Paste these lines:
abi <abi/4.0>,
include <tunables/global>
profile firefox /usr/lib/firefox/firefox flags=(unconfined) {
userns,
# Site-specific additions and overrides. See local/README for details.
include if exists <local/firefox>
}
- Then save it: Press
Ctrl+O, Enter, then Ctrl+X - Load the new AppArmor profile
sudo apparmor_parser -r /etc/apparmor.d/usr.lib.firefox.firefox
- Test open firefox
firefox
If you have been using Firefox snap version and would like to keep data in your user profile you can follow these steps. If you have never used snap Firefox on your install then you can skip this. You will need to have used the snap Firefox at least once for a Firefox user profile to have been created.
If you have not run the firefox, please run it first
Checks for new firefox directory in these possible places:
~/.mozilla/firefox/~/.config/mozilla/firefox/
Find profiles.ini inside one of those directory, and create a copy. e.g. copy_profiles.ini
Then copy-paste from your old snap firefox profiles, into the directory.
// Change the NEW_FIREFOX_DIR, based on your new firefox directory
mkdir cp -a ~/snap/firefox/common/.mozilla/firefox/* NEW_FIREFOX_DIR
If there is a installs.ini inside new firefox directory, you need to follow these steps, otherwise, skip:
- Inside
profiles.ini, search for your default profile, and copyPath=value. e.g.d446hytl.default - Edit
installs.inifile, and change theDefault=, with the one you just copied. e.g.Default=d446hytl.default - Inside the same file (
installs.ini), copy the value inside the bracket. e.g.4F96D1932A9F858E. - Edit
profiles.ini, and add these lines at the top:
// The 4F96D1932A9F858E should be the one you copied from `installs.ini` file
// And d446hytl.default should be the Path value from default profile
[Install4F96D1932A9F858E]
Default=d446hytl.default
Locked=1
- Optional: you might as well delete the "default" profile directory, to find one, just look at the
profiles.inibackup e.g.copy_profiles.ini - Save it and run firefox
To ensure Unattended Upgrades (Ubuntu's auto-updater) handles the Mozilla repository correctly, run this optional step:
echo 'Unattended-Upgrade::Origins-Pattern { "origin=packages.mozilla.org,archive=mozilla"; };' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
Note: untested
You may want to perform this step because this service might bring back the snap version of Firefox. Thanks Ubuntu.
sudo systemctl status unattended-upgrades
sudo systemctl disable --now unattended-upgrades
sudo systemctl status unattended-upgrades
In file /etc/apt/apt.conf.d/20auto-upgrades
Change from enabled APT fucntions to disabled:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
after it shoud look like this:
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";