Fixing a broken Firefox profile via Sync
I've been using Firefox for something like 15 years, so it's no surprise that I eventually ended up with a corrupted profile (perhaps from a sudden shutdown). It was functional 99% of the time, but a few things would break in weird ways, like Local Storage getting cleared periodically for both web pages and extensions. It was subtle enough that by the time I noticed, it was too late to just restore from backup.
The way I eventually fixed it was to use Mozilla's "Firefox Sync" service to copy the data to a new profile. This post describes the steps I took, in case someone else wants to take the same approach.
Premise
I was able to establish that the profile was corrupted by disabling all extensions and seeing that even basic Local Storage functionality was still lost across restarts. New, blank profiles on the same computer did not have the same issue.
Sync looked like a good approach because I guessed that rather than copying the data files around, the data would be loaded and then reserialized according to some other protocol. A broken data file on disk would probably not be copied verbatim.
My goals were these:
- Copy over as much of the original profile as possible, including bookmarks, passwords, history, extensions, extension settings, etc.
- Preserve my privacy as much as possible.
The below was mostly written at the time, with annotations between the bulleted lists having been written much later (with more uncertainty).
Outcome
This was a pretty manual process. I ended up losing my browsing history, which was frustrating since I rely on autocomplete pretty heavily for both convenience and security, but I can still access it with some extra work. I also probably lost some preferences customizations. Other than that, it worked OK.
Steps
Initial setup:
- Existing setup: Already had a strong master password.
- Sign up for Firefox Accounts -- choose a very strong password.
- This will be the only protection against a sever-side attacker that gains access to my encrypted Sync data.
- Personally, I'm fond of using the command
cat /usr/share/dict/words | grep -vP "^[A-Z]|(ing|ly|s|ment|ed|ify|or|ion|er)$" | shuf | head | tr '\n' -
(aliased asdiceware
even though I'm not using real dice) so that I can easily get passphrases likeimmanence-bogeyman-scope-chambermaid
without too many highly-suffixed words.
- Enable Sync
- Set device name to "old"
At this point I believe the data starts getting copied to the server, encrypted. Now we need a target profile:
- Create a new profile and open it concurrently
- You can enter
about:profiles
in the URL bar to set this up. Just be aware that you may end up launching the wrong one sometimes—pay attention to the "default to this one" checkbox. - It's important to be able to tell the profiles apart, but this is difficult to arrange, because Sync will cause them to use the same theme! I ended up opening the second one on a different virtual desktop.
- You can enter
- Set a master password, otherwise the synced passwords will be written to disk without protection
- Sign in to Firefox Sync on that profile too
- Set device name to "new"
- Optional: Install
https://addons.mozilla.org/en-US/firefox/addon/about-sync/ on new
profile so I could later verify sync data is deleted; view
about:sync
to get a baseline for what the tool looks like when data is present.
At this point data should be synced, or in the process of syncing. Some things need manual copying:
- Open
about:preferences
in both profiles and flip back and forth to copy settings over that didn't get synced - Go through
about:addons
and copy over any settings that haven't synced (or use extension's own export/import tools). "Allowed to run in private window" is not synced, so I had to update that for each one as well. - Also check
about:addons
"Manage Extension Shortcuts" to see if any shortcuts need copying over.
The open tabs can also be synced, but they don't sync automatically:
- "Send tabs to device", if possible. Doesn't always work. If not,
they can be converted to bookmarks.
- Use "select all tabs", right-click, and save to new bookmark folder. (This is a fantastic feature in Firefox, and almost makes up for the loss of the Session Manager extension.)
- Next, you can either wait for the bookmark folder to sync and then use "open all in tabs" on that folder, or you can open the folder, select all, copy, and paste into a folder in the new profile, open a new window, and then use "open all in tabs".
- Set the new profile as default in
about:profiles
and quit Firefox entirely
The new profile should be ready now! But there's a problem: Mozilla has a copy of the encrypted data. I don't want to use Sync for its usual intended purpose, so that's bad.
The official way to delete your remote data is to use the "reset password" feature, which deletes your data as a precaution before letting you back in. This is weird, but it works.
Cleaning up:
- Go to https://accounts.firefox.com and sign all devices out
- You could also sign out from each device, but don't click the "delete data" button -- I believe this only deletes local data.
- Reset password at https://accounts.firefox.com to something new, then sign all sites/devices out again.
Optional followup:
- Uninstall about-sync extension
- Create a new profile, "temp"
- Set a master password, just in case
- Install About-Sync in that profile and log in from there to Sync
- You should be presented with the "I'm ready to sync" setup screen
(indicating the account is empty), and
about:sync
should confirm - Close and delete that profile
I ended up keeping the old profile around so I could still use the history, which was un-corrupted but didn't sync. I also set the history retention to infinite on that profile so that it wouldn't be deleted if I opened the profile a year later.
No comments yet.
Self-service commenting is not yet reimplemented after the Wordpress migration, sorry! For now, you can respond by email; please indicate whether you're OK with having your response posted publicly (and if so, under what name).