Posted on

Table of Contents

Intro

Today Firefox started with no tabs opened. I used to have a lot of them. It’s just simpler to find things. At least for me. And must admit, seeing browser window without numerous tabs, left for convenience or just for later is terrifying experience. I know, hoarding tabs is a problem, and I solve it eventually, but for now I have more urgent task to do. Browser history was intact, bookmarks too. Extension buttons - in place, but none worked. So, I need to extract all data possible from crashed profile and migrate it to a new one. But first…

What is Firefox profile

Any modern browser has this feature called profiles. Each profile is fully separated set of preferences, bookmarks, history, extensions and other personal data. To start working with Firefox profiles you need to access its Profile Manager. Start a browser with -p command line option:

firefox -p

This will cause Firefox to show you this window, where you can manage available profiles.

Firefox profile manager window

Firefox profile manager window

Take a note buttons on left of the window. They do exactly what they name say: Create, Rename and Delete a profile. Start Firefox button will start browser with selected profile. Use selected profile… checkbox, when set, will mark profile as defauilt. Browser will open it every time, when started without any options.

Where to find

By default, profiles located in your home directory. Under Windows path will be %APPDATA%\Mozilla\Firefox\Profiles, under Linux - ~/.mozilla/firefox. It’s possible to have profile elsewhere, though, but this requires messing with profiles.ini or a command line.
You can also check location of your active profile by typing about:support in URL bar and finding Profile Directory row. The Open Directory button will open current profile directory for you.

Firefox about:support tab

Firefox about:support tab

Before even doing something, create a copy of ~/.mozilla/firefox directory elsewhere. Just in case.

Useful files

Ok, profile directory found. It contains all variety of different files. Some contain valuable data like bookmarks, opened tabs and history. I need them rescued. Others can be ignored and face a digital oblivion. So, which is which?

History and Bookmarks

  • places.sqlite
    SQLite. Contains bookmarks, download lists, and browsing history.

  • favicons.sqlite
    SQLite. Contains favicons from visited sites.

  • formhistory.sqlite
    SQLite. Form auto-complete history.

  • bookmarkbackups/
    Directory. Contains backups of your bookmarks in jsonlz4 format.

Extensions

  • extensions/
    Directory. Contains all installed extensions.

  • storage/default/
    Directory. Contains local storage data for websites and some extensions.

Session

  • sessionstore.jsonlz4
    Open tabs are stored here. In order this file to exist Firefox needs to be shut down properly. It won’t be created if browser crashed or killed.
    If you not see this file - sessionstore-backups directory is your best bet. Copy the most recent backup file to the profiles root directory as sessionstore.jsonlz4 and try launching browser again.

  • sessionstore-backups
    This directory contains automatic backups of your session in jsonlz4 format.

Browser preferences

  • prefs.js
    Current Firefox settings. Any changes done both in browser options and about:config will be stored here.

  • user.js
    Your can store your custom preferences here. The catch is that any options added to this file will override defaults or options from prefs.js. This is a good way to keep custom configuration separated and apply it at once just by copy-pasting a file to a new profile. You can get more related info in this MozillaZine KB article.

Securty

  • key4.db and logins.json
    Responsible for storing your logins and passwords. Both are encrypted. Both must be copied to the new profile to be decrypted properly.

  • permissions.sqlite
    SQLite. Site-specific permissions. Disabled video autoplay, declined notification request and other. Copy it just to avoid being annoyed again.

  • cookies.sqlite
    SQLite. Your cookie jar.

  • cert9.db
    Imported certificate storage.

Other

  • search.json.mozlz4
    mozlz4. Search engine configuration.

  • persdict.dat
    Personal dictionary for a built-in spell checker.

New beginning

So... Create a new profile... Copy all necessary files there. Then, start a browser and... It started with all tabs, bookmarks and history in place! Yay! Recovery mission successful! Now I'll mark a new profile as default and call it a day.