What are the best ways to copy existing settings to a new profile?
Hi,
I've encountered my fair share of bugs. I'm also disabled, so I need a lot of safety and accessibility fixes to use any browser.
Debugging advice often involves ""safe" mode," which disables some safety and accessibility tools, or "refresh Firefox," or otherwise using new profiles, which require me to set up the safety and accessibility tools before I can do anything. (For example, by default Firefox uses blinking cursors, autoscroll, and smooth scrolling, all of which trigger my migraines.)
In the past I've sometimes copied specific items, or cleared out a new profile folder and copied everything from an already-set-up profile folder.
Are there better or worse ways to copy bookmarks, saved passwords, about:config settings, user css, add-ons, and add-on settings?
(The previous time I asked this, I somehow got diverted to the wrong forum.)
Wšykne wótegrona (14)
For pref settings you made directly on about:config or via Preferences (about:preferences) and stored in prefs.js you can consider to copy important prefs to a user.js file to initialize a new profile.
An alternative is to use an autoconfig.cfg file in the Firefox installation folder to initialize Firefox, this works for all profiles unlike a user.js file that only works in the profile where you place this file.
An autoconfig.cfg file also makes it possible to define new default values for prefs.
To use Autoconfig, place two files into the Firefox directory.
- on macOS, they go into the Contents/Resources directory of the Firefox.app
The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located.
// pref("general.config.filename", "autoconfig.cfg"); pref("general.config.obscure_value", 0);
The autoconfig.cfg file is placed at the top level of the Firefox directory.
These functions can be used in autoconfig.cfg:
defaultPref(); // set new default value pref(); // set pref, allow changes in current session lockPref(); // lock pref, disallow changes
Both these files are plain text files just like userChrome.css and userContent.css.
- autoconfig.cfg and autoconfig.js need to start with a comment line (//)
- autoconfig.js needs to use Unix line endings (LF instead of CR/LF)
See also:
I'd still need to copy Chrome, etc. Will copying everything work for debugging?
I suspect most of this is covered in: Recover important data from an old profile.
- bookmarks => places.sqlite stores bookmarks and history; bookmarkbackups directory has backups
- saved passwords => logins.json + key4.db (you need both)
- about:config settings => nearly all in prefs.js
- user css => chrome folder
- add-ons and add-on settings => this is somewhat difficult because the settings are tied to a specific uniquely generated local UUID, and the extensions.json file that stores them uses (unless this has changed) and profile-specific path; if you copy over extensions.json + the extensions folder + the store folder, you may or may not get all the extension data
Whoops...
"Profile Missing."
"Your Firefox profile cannot be loaded. It may be missing or inaccessible."
I hate that bug.
Generally speaking, that could occur if you copied over one or both of these files that specify a default profile folder that doesn't exist where Firefox is looking:
- %APPDATA%\Mozilla\Firefox\installs.ini
- %APPDATA%\Mozilla\Firefox\profiles.ini
%APPDATA%\Mozilla\Firefox\Profiles\some profile folder is not here where Firefox expects it
I don't think I copied either of those the first time.
The new profile was ignoring uBlock Origin, and possibly other safety add-ons. I returned to my old profile but it was now ignoring userContent.css. I ended up having to restore from backup, and then copy bookmarks and passwords back from the new profile.
See also this question (locked as I think it is better to continue here):
- /questions/1293056 Is there a way to repair an existing profile?
I've removed the solution for this thread for now, so you can continue to work in this thread.
You can look through your saved prefs.js in the old profile with a text editor and copy lines that relate to features that are important for you to another file like user.js.
Then you can test this out in a new profile to see what you are missing.
Prefs.js contains a lot of profile specific data and it might be better not to use this full file.
You will have to reinstall all extensions if you want to start with a fresh profile (a reset might still carry over possible corrupted files).
For userChrome.css and userContent.css you need prefs like theseo make these files work:
- layout.css.moz-document.content.enabled = true
- layout.css.moz-document.url-prefix-hack.enabled = true
- toolkit.legacyUserProfileCustomizations.stylesheets = true
See also this Number pref:
- ui.prefersReducedMotion = 1
Okay, so user.js is in addition to prefs.js?
I would also need some way to carry over extension settings. Or at least rebuild them if I start over. Maybe for uBlock I could replace some of the mess of rules with additional user css.
A user.js file can be used to initialize prefs each time you start Firefox.
This file needs to be in a profile folder, so it only works for this specific profile.
An autoconfig.cfg file works for all profiles, so any new profile you create will automatically have the settings as defined in the file.
Some of the prefs I use (using defaultPref() calls still allows to make profile dependent changes).
// autoconfig.cfg need to start with a comment line /* [ReducedMotion]-[animation] */ defaultPref("ui.prefersReducedMotion", 1); // [0,1] defaultPref("browser.download.animateNotifications", false); defaultPref("toolkit.cosmeticAnimations.enabled", false); /* [ZOOM][large values are useful to inspect details in screenshots] */ defaultPref("toolkit.zoomManager.zoomValues", ".1,.15,.2,.25,.3,.35,.4,.45,.5,.55,.6,.65,.7,.75,.8,.85,.9,.95,1,1.05,1.1,1.15,1.2,1.25,1.3,1.35,1.4,1.45,1.5,1.55,1.6,1.65,1.7,1.75,1.8,1.85,1.9,1.95,2,2.05,2.1,2.15,2.2,2.25,2.3,2.35,2.4,2.45,2.5,2.55,2.6,2.65,2.7,2.75,2.8,2.85,2.9,2.95,3,3.25,3.5,3.75,4,4.25,4.5,4.75,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10"); defaultPref("zoom.maxPercent", 1000); defaultPref("zoom.minPercent", 10); /* [TABS] */ defaultPref("browser.tabs.closeWindowWithLastTab", false); defaultPref("browser.tabs.selectOwnerOnClose", false); defaultPref("browser.tabs.maxOpenBeforeWarn", 1); /* [SESSIONSTORE] */ defaultPref("browser.sessionstore.max_resumed_crashes", 0); defaultPref("browser.sessionstore.restore_on_demand", true); defaultPref("browser.sessionstore.restore_pinned_tabs_on_demand", true); /* [CHROME:userChrome.css - userContent.css][bug 1541233][69] */ defaultPref("toolkit.legacyUserProfileCustomizations.stylesheets", true); /* [userContent.css][bug 1449753][61] */ defaultPref("layout.css.moz-document.content.enabled", true); // [61]:userContent.css defaultPref("layout.css.moz-document.url-prefix-hack.enabled", true); // [61]:userContent.css /* [LOGINS] */ defaultPref("signon.autofillForms", false); defaultPref("signon.autofillForms.http", false); defaultPref("signon.rememberSignons", false); /* [SPELLCHECK] */ defaultPref("layout.spellcheckDefault", 2); // multi-line defaultPref("ui.SpellCheckerUnderlineStyle", 4); // double underline /* GET ADDONS */ defaultPref("extensions.getAddons.showPane", false);
Thank you, just setting up autoconfig.cfg
Skipping the zoom settings since zooming causes scrolling-related bugs. Going to need to block autoplay, gifs, smooth scrolling, autoscroll, etc.
The inability to search for edited preferences is a problem here...
MarjaE said
The inability to search for edited preferences is a problem here...
Do you mean here on the forum? If you mean in your Firefox, check the prefs.js file in your profile to see whether it now reflects changes you applied using the Autoconfig file.
I am using about:config to try to find all the necessary fixes, to try to create autoconfig.cfg
I can't always be sure which changes are necessary, but disabling the blinking cursors, disabling autoplay, and so on are important.
So far, I'm up to my font settings.
Your previous manual changes also should be listed in the prefs.js file.
If you use defaultPref() then you do not see the pref as bold on about:config unless you modify the pref (you keep changes). If you use pref() then you set a new value that is used for each new session (i.e. you lose changes). There is usually no need to use lockPref() unless this is about prefs that only work when locked (i.e. there is code that (re)sets the pref).
For blocking media you also need in addition of pref used previously.
- media.autoplay.blocking_policy = 2
- media.autoplay.default = 5
- media.autoplay.allow-extension-background-pages = false
- media.autoplay.block-event.enabled = true
Note that if you make changes to prefs that make them getting added to prefs.js that these prefs will always stay in prefs.js even if they aren't supported by Firefox. Such a pref has a Trash button instead of a Reset button on about:config.