Fixing a broken Firefox Awesomebar (places.sqlite repair)
I noticed this morning that the Firefox 'awesomebar' - the feature where it suggests pages you're probably looking for as you type in the location bar - just wasn't working any more. It didn't pop up any suggestions at all, no matter what I typed. I remember when this was first introduced I moaned about it quite publicly, but they made it lots better, and now losing it feels more or less like having my arms cut off - I don't have bookmarks any more, I just remember tiny snippets of URLs or page names and Awesomebar does the rest (to add this blog entry I just type 'happ' and the admin interface of my blog pops up as the first link).
A quick trip to the error console (" Error: Places AutoComplete: [xpconnect wrapped mozIStorageError] Source File: file:///usr/lib64/xulrunner-1.9.2/components/nsPlacesAutoComplete.js Line: 496") and a moan at Red Hat's Mozilla maintainer led me to suspect that the places.sqlite file in my Firefox profile - which stores the browsing history - was somehow problematic, though it clearly wasn't entirely broken as I could browse History / Show All History just fine, and sqlite3 didn't seem to have problems with it.
I confirmed that moving this file and letting Firefox generate a new one made the feature itself work again, but of course it didn't have my actual browsing history, so that was no good.
Finally, with a bit of GoogleHelp, I got it sorted. Back up the 'broken' places.sqlite to places.sqlite.bak, run Firefox to get a fresh places.sqlite generated, quit Firefox again, and do:
echo ".dump" | sqlite3 places.sqlite.bak | sqlite3 places.sqlite
re-run Firefox, and the feature's working and my actual browsing history is in it. Phew!