Firefox profile on NFS
Firefox has switched to sqlite3 for some files in the profile. this happened some time ago (AFAIKT it was with FF3). This is quiet bad if you happen to mount your home via NFS, because sqlite is not designed to work well over NFS (locking problems). The sqlite FAQ(5) has this to say about sqlite databases on NFS:
SQLite uses reader/writer locks to control access to the database. (Under Win95/98/ME which lacks support for reader/writer locks, a probabilistic simulation is used instead.) But use caution: this locking mechanism might not work correctly if the database file is kept on an NFS filesystem. ...And indeed, it does not work for me (debian/ubuntu). The problem is, that bookmarks, history and other things will be corrupt after a network outage or a firefox crash (hello flash, i am looking at you!). I have not found a solution yet, therefore before starting firefow, I will backup all sqlite Databases:
First, you need to install the sqlite3 utility:
$ sudo apt-get install -y sqlite3
in your .profile, declare the following variables:
export PROFILE="myprofilename"
export FIREFOX_PROFILE_DIR=~/.mozilla/firefox
#export FIREFOX_PROFILE_DIR=~/.mozilla/firefox-3.5
Then use the following script to launch firefox:
#!/bin/bash
if [[ -z "$PROFILE" ]]; then
export PROFILE="default"
fi
if [[ -z "$FIREFOX_PROFILE_DIR" ]]; then
export FIREFOX_PROFILE_DIR=~/.mozilla/firefox
fi
# install sqlite 3: sudo apt-get install -y sqlite3
find=$(which find);
sqlite3=$(which sqlite3);
msg="missing or not in \$PATH, aborting";
if [[ -z "$find" ]]; then echo "find $msg"; exit 1; fi
if [[ -z "$sqlite3" ]]; then echo "sqlite3 $msg"; exit 1; fi
for d in $($find $FIREFOX_PROFILE_DIR/ -maxdepth 1 -type d); do
profile=$(echo "$d" | sed -e 's|.*/[^\.]\+\.||')
# remove this conditional statement, if you want all FF profiles backed up.
# sqlite databases in use are locked.
if [[ "$profile" != "$PROFILE" ]]; then
continue;
fi
echo "$profile | $d";
for f in $(find "$d" -iname "*.sqlite"); do
f=$(echo "$f" | sed -e 's/\.sqlite$//; s|.*/||')
if [[ -f "$d/$f.bak.sql" ]]; then rm "$d/$f.bak.sql"; fi
$sqlite3 $d/$f.sqlite .dump > $d/$f.bak.sql
done
done
firefox-3.5 -P $PROFILE
exit 0;