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!


Duber wrote on 2010-08-12 01:56:
In my case command was: echo .dump | sqlite old.db | sqlite new.db ".dump" with quotes would report some sqlite error.
[...] Awesome Bar in Firefox under OS X Filed under: Uncategorized — azijn @ 23:47 Thanks to this guy, I was able to repair my “awesomebar”, after killing it, probably by a crash combined [...]
ericjung wrote on 2011-01-04 03:59:
I had the same exact error with the exact same line number (line 496 in nsPlacesAutoComplete.js), but on Windows 7. Interestingly enough, all I had to do was close firefox, rename places.sqlite to anything, then start firefox. A new places.sqlite is generated with all of the old history--I don't know from where, presumably another database file. The awesomebar works again. I subsequently just deleted the renamed file.
DrimuS wrote on 2011-04-02 06:27:
Hey man, I'm trying to do this on windows 7. How should I do the whole "echo .dump" step? Thanks in advance.
Landis wrote on 2013-04-02 22:44:
thank you. this 'dump' thing was helpful. didn't resolve my primary issue, but it did 'fix' my places db. my issue ended up being sync sucks. Landis.
JP wrote on 2015-03-28 05:09:
Dude I spent hours trying a lot of complicated stuff, your should be the first result in google. THANK YOU SO MUCH. For windows users, the same thing applies. make sure you have sqlite3.exe in your profile folder, open the DOS prompt (Start->execute, cmd, enter) and in yout profile folder type echo .dump | sqlite3 places.sqlite.bak | sqlite3 places.sqlite thanks again