Installed Firefox to migrate from classic installation to snap

How to migrate installed Firefox (installed once from classic package) to snap. Latter one still not installed. Aimed goal: To have Firefox in snap app as well as unchanged user experience in Firefox after this migration is completed.
Will it suffice to understand Firefox generic user data usage/local configuration as well as how snaps are working in general?
In other words: Any specifics regarding Firefox machin-local/user configuration when Firefox is installed in snap (except snap framework specifics)?

Asked By: Fifi Cek

||

The user configuration data of snap applications reside under the "snap" folder in your home folder. You can move your existing profile to the appropriate location so the snap folder has access to it.

A way to do that without risking to break anything is the following. Keep your current firefox installation for the time being.

Install the snap version of firefox

snap install firefox

Or use any other method for installation if you prefer.

Run the snap version once.

You will now have two undistinguishable Firefox icons in your application overview. Run the snap version of firefox with the command:

snap run firefox

This will create a default user configuration in the folder "firefox" under "snap" in your home folder.

** Quit any of your running Firefox instances **

Open the respective profile folders.

Open following folders in two file manager windows side by side. Turn "Show hidden filed" on.

  • SNAP: /home/$USER/snap/firefox/common/.mozilla/firefox
  • NORMAL: /home/$USER/.mozilla/firefox

Here, $USER stands for your own login name.

Delete the newly created snap profile.

Under the SNAP folder, delete the profile folder you just created. It is named as <random string>.default, e.g. b0aix2sy.default: the first part are random characters that are different for each installation.

Transfer your profile to the snap version.

Copy your "normal" profile over from the NORMAL folder to the SNAP folder. It is named as <random string>.default-release. There will also be a folder with extension default. Leave that alone. It is the default-release folder that contains your user data.

Rename extension of copied profice

Rename the copied folder to change the extension from default-release to default. Copy the folder name to the clipboard.

Update profiles.ini

In the SNAP folder, open the file profiles.ini with text editor. On the line Path=<random number>.default, change the folder name to the name of the folder you copied. Save the file and exit the editor.

Now, when you start the snap installation of firefox, it will be configured as your current installation. If all is well, you can delete the folder .mozilla in your home folder and remove the regular version of firefox: sudo apt remove firefox.

Answered By: vanadium

For upgrade from 20.04 to 22.04

I found the accepted answer useful, but my experience on the LTS upgrade path was not quite the same.

This answer assumes that you gave the upgrader permission to migrate Firefox to snap. The upgrade had removed the deb version of Firefox and it had migrated (copied) all the profiles over but not included them in profiles.ini.

So my solution:

  • Run firefox once, then quit it. I’m not sure if this is totally necessary, and you’ve probably already run it, that’s why you’re here.
  • Check /home/$USER/snap/firefox/common/.mozilla/firefox it should contain your profiles which have been copied over from /home/$USER/.mozilla/firefox. Those are the randomly named directories. If not them copy them over, the old location won’t have been deleted.
  • In /home/$USER/snap/firefox/common/.mozilla/firefox/ rename profiles.ini to profiles.ini-bak
  • Copy profiles.ini from /home/$USER/.mozilla/firefox/ to /home/$USER/snap/firefox/common/.mozilla/firefox/
  • Launch Firefox and browse to about:profiles
  • Use the UI in there to launch profiles until you find the right one, then set that as the default

Unless you use multiple profiles, you’ll probably only find two profiles in the about:profiles window, one will be new and blank, and the other will be the one you’re looking for.

Answered By: Rodney
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.