Comment 21 for bug 185622

Revision history for this message
Chuck Renner (chuckrenner) wrote :

After installing a bunch of packages today (sorry, I cannot remember what), my default browser changed to Epiphany, and every time I tried to launch firefox, I would get an error, "Couldn't load XRE functions".

After seeing this, and similar issues, I decided to check the x-www-browser and gnome-www-browser files in /var/lib/dpkg/alternatives to see which browser gets automatic preference. I was shocked to see that Epiphany was set to 85, and firefox was only set to 40 for the default x browser and firefox wasn't listed at all for the gnome browser. Why? Why? Why?

Contents of /var/lib/dpkg/alternatives/gnome-www-browser:[Code]auto
/usr/bin/gnome-www-browser
gnome-www-browser.1.gz
/usr/share/man/man1/gnome-www-browser.1.gz

/usr/bin/epiphany-gecko
85
/usr/share/man/man1/epiphany-gecko.1.gz
[/Code]
Contents of /var/lib/dpkg/alternatives/x-www-browser:[Code]/usr/share/man/man1/x-www-browser.1.gz

/usr/bin/firefox-3.0
40

/usr/bin/epiphany-gecko
85
/usr/share/man/man1/epiphany-gecko.1.gz
[/Code]
I noticed that these values were the same on another computer where firefox is still working. These values make NO sense to me at all.
Here is my suggestion to at least fix the alternatives (adjust as needed - this is someone dynamic, but not perfect):
[Code]
# Use ALTADMINDIR to hold the name of the alternatives admin directory
ALTADMINDIR=/var/lib/dpkg/alternatives
echo ALTADMINDIR=$ALTADMINDIR
# Use ALTnNAME to hold the name of the nth alternative we are changing
ALT1NAME=gnome-www-browser
echo ALT1NAME=$ALT1NAME
ALT2NAME=x-www-browser
echo ALT2NAME=$ALT2NAME
# By using pushd, we can easily go back to our original directory
pushd $ALTADMINDIR
# This alias is uses sed to process an ISO-8601 date to remove the hyphens and colons for easier file name compatibility (but it's still ISO-8601 compliant)
alias bak_time="sed -e 's/\([0-9]\{4,\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\)T/\1\2\3T/' -e 's/\([0-9]\):/\1/' -e 's/\([0-9]\):/\1/'"
# Copy the original alternatives definitions to backups, each with an ISO-8601 compliant date and time on the end of their backup file names
sudo cp -a $ALT1NAME $ALT1NAME.`date -Iseconds | bak_time`
sudo cp -a $ALT2NAME $ALT2NAME.`date -Iseconds | bak_time`
# Set the paths of the executable links that will call the /etc/alternatives links
ALT1LINK=`which $ALT1NAME`
echo ALT1LINK=$ALT1LINK
ALT2LINK=`which $ALT2NAME`
echo ALT2LINK=$ALT2LINK
# Set the path of a symlink (that is not and does not resolve to an alternative) that calls the shell script that launches firefox.
LAUNCHFF=`which \`readlink \\\`which firefox\\\`\``
echo LAUNCHFF=$LAUNCHFF
# Set a priority for firefox in the alternative definition that is HIGHER than the one assigned to any other browser in the definition
ALTPRIORITY=100
echo ALTPRIORITY=$ALTPRIORITY
# Create/update the alternatives definitions, giving firefox highest priority
sudo update-alternatives --install $ALT1LINK $ALT1NAME $LAUNCHFF $ALTPRIORITY
sudo update-alternatives --install $ALT2LINK $ALT2NAME $LAUNCHFF $ALTPRIORITY
# Update the alternatives to automatically use the highest priority entries
sudo update-alternatives --auto $ALT1NAME
sudo update-alternatives --auto $ALT2NAME
# go back to our original directory
popd
[/Code]

Note that this fixes my default browser alternatives, but does not stop me from getting the error: "Couldn't load XRE functions"

The bottom line: Firefox 3.0 (final) still wasn't my default browser until I updated the alternative definitions.