Firefox restore a previous session before last from a jsonlz4 recovery file
Im In a difficult situation, I have updated firefox to the new version 2 weeks ago. This version disable my 'session manager' add ons, without my knowledge. Yesterday I closed my firefox with 150 tabs and shut it down, hoping that when I start firefox again today, and click on 'restore previous session' that my 150 tabs will appear before me like they normally do. Except what happened was that I opened firefox, the main page opened, and before I was able to click' restore previous session' and restore my 150 tabs, I accidentally closed the firefox window. I then reopened firefox again, and clicked 'restore previous session' and all it would do is open the main window, and all my 150 tabs are lost now. I thought i shouldnt worry, because I did see an article last year about how to restore the firefox session that existed before the previous session, and there was something in that article about a sessionstore,js file and a .bak file that needs to be renamed. I went to my Firefox Profile Folder, there I clicked on the 'Sessionstore-backups' folder, and found these files:
1.previous.jsonlz4 2.recovery.jsonlz4 3.recovery.baklz4 4. upgrade.jsonlz4-20171002220106 5. upgrade.jsonlz4-20171024165158 6. upgrade.jsonlz4-20171112125346
I saved a copy of these files in My documents, but I dont know what to do with these files, I tried to rename the .baklz4 file to sessionstore.js, but it didnt work, I tried renaming it to recovery.jsonlz4 but it still didnt work, It is 23rd november today and I have given up hope that I would be able to recover all 150 tabs from yesterday, but the file in point 6 which is called ' upgrade.jsonlz4-20171112125346' seems to be a backup file from 15th November, so I thought Id try and rename this file and recover my tabs from 15th November instead ( about 120 tabs in total). I have tried renaming this file to , recovery.jsonlz4, previous.jsonlz, session.jsonlz4, sessionstore.js, but everytime i restart firefox, it doesnt read this file, and gives me that one blank tab instead. Can anyone tell me how to restore the 15th November file and how to load the 120 tabs in that file please?
Thanks
Chosen solution
Backups! Excellent.
(1) Please use this tool to determine the best file to restore:
https://www.jeffersonscher.com/res/scrounger.html
You also can save the clickable list of links to a file if all else fails.
(2) To make the swap to an old session history file:
(A) Exit Firefox.
During a normal shutdown, Firefox should create a new file at the main level of the profile folder named sessionstore.jsonlz4 and remove both recovery.jsonlz4 and recovery.backlz4 from the sessionstore-backups folder.
(B) Right-click > Rename sessionstore.jsonlz4 to sessionstoreOLD.jsonlz4
(C) Copy the file you want Firefox to use into the profile folder and rename it sessionstore.jsonlz4 -- assuming your files are in alphabetical order, when you refresh (F5) your copied in and renamed file should be immediately adjacent to sessionstoreOLD.jsonlz4
Now you're ready to start Firefox and, if needed, use History > Restore Previous Session.
Success?
Read this answer in context 👍 26All Replies (13)
Chosen Solution
Backups! Excellent.
(1) Please use this tool to determine the best file to restore:
https://www.jeffersonscher.com/res/scrounger.html
You also can save the clickable list of links to a file if all else fails.
(2) To make the swap to an old session history file:
(A) Exit Firefox.
During a normal shutdown, Firefox should create a new file at the main level of the profile folder named sessionstore.jsonlz4 and remove both recovery.jsonlz4 and recovery.backlz4 from the sessionstore-backups folder.
(B) Right-click > Rename sessionstore.jsonlz4 to sessionstoreOLD.jsonlz4
(C) Copy the file you want Firefox to use into the profile folder and rename it sessionstore.jsonlz4 -- assuming your files are in alphabetical order, when you refresh (F5) your copied in and renamed file should be immediately adjacent to sessionstoreOLD.jsonlz4
Now you're ready to start Firefox and, if needed, use History > Restore Previous Session.
Success?
Test reply, I have been having some trouble with a reply. I got
"Access denied You do not have permission to access this page."
jscher2000, I tried your method and created a sessionstore.jsonlz4 file from a recovery.jsonlz4 file, but when I select History > Restore Previous Session, nothing happens. The menu is not grayed out, it is selectable, but my windows/tabs do not get reloaded.
I have spent a few hours today on various hacks such as uncompressing the jsonlz4 using the mozlz4a.py script , diddling with internal timestamps in the resulting plain json, and recompressing. Nothing seems to work. Is it a timestamp issue that causes my sessionstore.jsonlz4 not to be loaded? Any other ideas?
There is no need to re-compress sessionstore. What matters is only the file extension. A compressed file needs a .jsonlz4 file extension and an uncompressed file just a plain .js file extension. That is where you went wrong the first time.
Firefox can still restore uncompressed sessionstore files, but to make this work you need to remove (rename) compressed files and rename the sessionstore-backups folder to ensure that Firefox can't fallback to compressed .jsonlz4 files.
If you temporarily give the file a .json file extension then you can drag the file in a Firefox window to make the builtin JSON viewer work.
You can check "History -> Recently Closed Tabs/Windows" in case restore session doesn't work. It also helps to select "Show my windows and tabs from last time" as the startup setting.
Did you try the scrounger.html website to inspect the files?
cor-el,
I have now tried your suggestions. All I get is one window and one tab. Here is what I did, with all file operations performed in the PROFILEDIR top level directory
start firefox about:addons, disable addon sessionmanager settings: select "Show my windows and tabs from last time" exit firefox rm sessionstore.jsonlz4 mv sessionstore-backup sessionstore-backup-ASIDE mv sessions sessions-ASIDE # belongs to sessionmanager addon (disabled), move just in case create sessionstore.js from backed up recovery.jsonlz4 via scrounger, and copy to PROFILEDIR optional variation: mv sessionCheckpoints.json sessionCheckpoints.json.ASIDE
Still I get only 1 window and 1 tab. I have repeated the test multiple times, with variations. Is there an about:config I need to set? What on earth could be going wrong? I'm not averse to trying some debug console or MOZ_LOG setting if that helps,but I do not know very much about how to do it or what/where to look.
Perhaps I should mention that I never had any problem getting a session back from some backed up version of previous.js or recovery.js before. Something seems to have changed around the same time as the .jsonlz4 format was introduced.
reikred said
jscher2000, I tried your method and created a sessionstore.jsonlz4 file from a recovery.jsonlz4 file, but when I select History > Restore Previous Session, nothing happens.
Hmm, what do you mean by "created"? You can rename a recovery.jsonlz4 file to sessionstore.jsonlz4, then replace the latest sessionstore.jsonlz4 with that file so Firefox uses it at startup.
However, if you use the Scrounger to save a file, it is not in the compressed format. Either it's a sessionstore.js file (old format, you need to hide all the .jsonlz4/.baklz4 files from Firefox for it to be used) or an HTML file (which is only for your reference and can't be used by Firefox).
I found the cause of my session restore problem: The recovery.jsonlz4 that I was trying to restore had been written by ff-57.0.3, (which I had started by accident on the specific profile), while I subsequently tried to restore the session using ff-56.0.2, which is my production version of firefox.
On a hunch I dug into an offline backup and found another recovery.jsonlz4 that was 21 hours older, and that had not been contaminated by ff-57.0.2. And this file restored just fine when copied into PROFILEDIR/sessionstore.jsonlz4. It was just pure luck that this backup existed.
I'm not sure I can adequately express my dismay with that certain subset of Firefox developers that keep futzing around with the sessionstore format and making incompatible changes. In this case they caused a silent failure and not even a hint or warning what was wrong.
Last time sessionstore was broken (the infamous favicon bug, caused by clickjack/triggeringPrincipal_b64 "enhancements", as documented in bugzilla.mozilla.org/1345456 (and others)), it took several weeks and endless hours to recover partially from the sessionstore changes. This time it took "only" 36 hours, but this kind of blatant disregard for the user HAS TO STOP. The sessionstore is the most holy data of a browser. There is nothing more important to a user than the sessionstore. DO NOT BREAK SESSIONSTORE FILES and make them incompatible, either forward or backward. STOP PULLING THE RUG FROM UNDERNEATH THE USER. Whew, did I make myself clear?
Hi reikred, I'm glad you found a solution, but I don't think support volunteers can do anything about file format changes for session history.
When I compare the JSON of Fx56 and Fx57, I see one difference for a page entry:
- Fx57 does not have a charset property (screenshot attached)
Do you think that's the breaking issue, or something else? Not sure if there is any debugging info to determine that.
Or maybe since you have two files so close in time you can do a better comparison than I can with files several weeks apart.
Hi Jscher2000,
I hope it is clear that I was most definitely not criticizing you or anyone else on this thread :-) :-). I was ranting against the Firefox developers that are very cavalier about breaking sessionstore in horrible ways and without warning.
Cool that you looked into what the incompatibility difference might be, but I do not know whether the charset property is the issue. My relevant sessionstore files are about 9MB compressed and 25MB uncompressed, so comparing is difficult. I don't even know how to get a tool do to a hierarchical lexical sort of json, which I think is pretty much necessary to be able to compare differences efficiently in large files.
But I think the developers ought to know what they changed -- If I have the energy I will post my rant on bugzilla, although I'm almost certain, based on experience, that it will be derided and marked WONTFIX by the powers that be. But someone needs to speak up about this stuff. Firefox should not make existing user data files unusable. That's just wrong. Thanks again to all on this thread for their help and effort.
Modified
Hi reikred, I'm not sure there's much point posting on Bugzilla for backwards compatibility with a version that isn't being maintained, such as Firefox 56, but some might be receptive to updating the Extended Support Release of Firefox 52 to be able to handle files from Firefox 56+.
jscher2000 said:
However, if you use the Scrounger to save a file, it is not in the compressed format. Either it's a sessionstore.js file (old format, you need to hide all the .jsonlz4/.baklz4 files from Firefox for it to be used) or an HTML file (which is only for your reference and can't be used by Firefox).
Many thanks, jscher2000 – Scrounger was a magic rescue for me! I was able to restore the session by feeding it previous.jsonlz4. However I wonder why I just cannot copy previous.jsonlz4 over sessionstore.jsonlz4 in profile folder? What I did so, there was no effect (FF started with one default empty tab).
dma_k said
However I wonder why I just cannot copy previous.jsonlz4 over sessionstore.jsonlz4 in profile folder? What I did so, there was no effect (FF started with one default empty tab).
Normally Firefox will read sessionstore.jsonlz4 at startup. After that, it depends on your startup setting whether it will be restored automatically, or whether you need to use "Restore Previous Session" from the menu. (Then after restoration, you may need to use "Recently Closed Windows" and within each window "Recently Closed Tabs".)