10

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)?

2 Answers 2

14

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.

5
  • Awesome! I ran into trouble migrating to 22.04 LTS. One minor aspect was to ensure that the old profile is listed under [Profile0] in the profiles.ini folder.
    – Colin
    Apr 26, 2022 at 3:05
  • Note that this works only if the firefox .deb is still installed. In 22.04 I had to reinstall the firefox .deb using these instructions: omgubuntu.co.uk/2022/04/… . I also had to use the --allow-downgrade flag according to here: shkspr.mobi/blog/2021/10/how-to-fix-an-upgraded-firefox-profile May 2, 2022 at 11:49
  • @krumpelstiltskin It works as long as your user profile is there. That is not removed when you uninstall firefox. It is, however, automatically migrated to snap as part of an Ubuntu system upgrade.
    – vanadium
    May 2, 2022 at 18:41
  • Did anyone who has done this, notice this problem emerged: askubuntu.com/questions/1409346/… ?
    – Colin
    May 21, 2022 at 14:34
  • Thanks, this worked. I changed from 21.10 to 22.04, and got forcibly migrated to the snap – only today I noticed that my bookmarks and saved passwords are gone. I guess the snap was originally already installed in December, but I've never used it, so it didn't automatically migrate the profile when the non-snap Firefox was gone. Jul 30, 2022 at 20:14
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.