Fixing firefox profiles - unlocking sqlites profile databases
tl;dr: firefox
find $HOME/.mozilla/firefox/$profile -name *lock -exec rm {} \;
find $HOME/.mozilla/firefox/$profile -name "*sqlite" -exec sh -c "sqlite3_analyzer '{}' | grep "locked" && mv '{}' '{}.tmp' && cp '{}.tmp' '{}'" \;
thunderbird
find $HOME/.thunderbird -name *lock -exec rm {} \;
My computer experienced a freeze, and I was forced to reset it
When I rebooted, I was greeted with a broken firefox
I had to delete the locks on both firefox and thunderbird:
find $HOME/.mozilla/firefox/$profile -name *lock -exec rm {} \;
find $HOME/.thunderbird -name *lock -exec rm {} \;
After that, it would run, but I had :
- no history
- no bookmarks
- some sites were fully broken
- extensions were non functionning
I traced the root cause to sqlite dbs locked inside the profile. I found that simply renaming the db and copying back was sufficient.
But the large number of sqlite db made it impractical to fix all by hand.
This one-liner fixes all dbs that are locked inside a mozilla profile :
find $HOME/.mozilla/firefox/$profile -name "*sqlite" -exec sh -c "sqlite3_analyzer {} | grep "locked" && mv '{}' '{}.tmp' && cp '{}.tmp' '{}'" \;
Using sqlite3_analyzer to see if the db is locked, then recopying the db to unlock it.
I think I also could have rebooted the NFS server where the profile resides, but you know, uptime…