Can't restore bookmarks from backups
I accidentally deleted some bookmarks and decided to restore from the last automatic backup made by firefox in the bookmarksbackup directory.
I went to Bookmarks / Show All Bookmarks, selected Import and Backup / Restore and it listed about 10 backups. I selected the latest one (2 days old), firefox gave a warning that current bookmarks would be replaced, then it wiped everything and nothing was restored. I tried all the backups available and nothing worked. No error messages were give.
The files are not large, about 130k (compressed jsonlz4). I found an article explaining how to decompress these using Firefox Web Console and can see the bookmarks in the json file, but for some reason firefox won't read them. I also looked in the places.sqlite file and can see the bookmarks there, but they are not shown in the bookmarks menu or the bookmarks library.
Now I have a serious problem, I didn't make a backup before trying to restore (I assumed I had backups already) and all my bookmarks were deleted when restoring, the only export I have is 6 months old. Is there anything you can do to help?
I'm running Firefox 40.0.2 on 64bit Netrunner Linux (a derivative of ArchLinux).
You can check for problems with the places.sqlite database file (bookmarks, history) in the Firefox profile folder.
- Places Maintenance: https://addons.mozilla.org/firefox/addon/places-maintenance/
I've tried all these options, deleting places.sqlite and restoring, using the Places Maintenance addon. I've also tried restoring to a Windows 7 installation with various versions of Firefox, nothing works.
Even if I run a straight backup and try to restore it doesn't work. The only way I can recover my bookmarks is if I copy the original places.sqlite files. Backup/Restore doesn't seem to work at all. I've tried exporting to HTML but that doesn't work either, it doesn't create the file.
I've checked file ownerships and they are fine, my user owns all the files and directories under .mozilla.
The bookmarks themselves work fine, I can bookmark pages and use the Bookmark Manager. The problem is just with the backup/restore process.
Type about:support<Enter> in the address bar.
Under the page logo on the left side you will see Application Basics. Under this find Profile Folder. To it’s right press the button Show Folder. This will open your file browser to the current Firefox profile. Now Close Firefox.
Enter the bookmarkbackups folder. This is where Firefox makes backups of your bookmarks. Look for the jsonlz4 file you want to restore (check the time / date / size). Right click on that file and select Copy. Now go back to the profile folder where you started. Rename the file places.sqlite by adding .old to it. Now right click in the folder and select Paste. The file you just pasted here, rename it to places.sqlite. After you are done, restart Firefox.
Nope, this doesn't work. After renaming places.sqlite and copying/renaming the jsonlz4 file Firefox shows no bookmarks at all, the Bookmark Library is empty, just shows the default menus (History, Downloads, Tags, All Bookmarks) but no bookmarks in them. It also creates a places.sqlite.corrupt file, I guess because the jsonlz4 file is not a sqlite database.
You can't rename a compressed .jsonlz4 to places.sqlite. You need to restore such a file in the Bookmarks Manager (Library).
You can try to decompress the file with this code variation from jscher2000:
I'm aware of that, I was just trying out what Fred suggested. I mentioned in the original post that I did uncompress the .jsonlz4 file and can see the bookmarks in there, so the file itself is not empty. Firefox just has problems restoring it.
I've also tried restoring from the uncompressed JSON file but it doesn't work. I can trawl through the extracted JSON to get the links, but it's time consuming and I lose the tags that I associated with them. I would prefer to simply restore the file.
Did you try to delete all places.sqlite files including the -shm and -wal versions before restoring the JSON backup?
If the file got decompressed then it sounds that the file is OK, so you could try to restore the .json version as well. Bookmark backups are quite complicated because of all the tables in the SQLite database and extracting links would require a lot of work to restore the folder structure.
Did you try to restore an older backup in case one of them would work?
Yes, I deleted all places.sqlite files before restoring. There are about 14 backup files going back to beginning of August. I've tried all of them. They were created with different versions of Firefox, 39.0, 39.0.3, 40.0.2 and 40.0.3.
I've also tried restoring these on Windows with various versions of Firefox, nothing worked.
There seems to be a bug in Firefox. Perhaps there something in the text or URLs causing it to fail. I don't get any error messages, is there a way to debug what's going on?
Even if I do a backup now, then try to restore it, it doesn't work. That's why I suspect something in the data (descriptions or URLs).