Tuesday, August 13, 2013

Updating Firefox and Thunderbird in LMDE

A couple of weeks ago, as you may recall, I switched from ever-changing Ubuntu to nearly frozen Linux Mint Debian Edition (LMDE). So how is it?

Nice. Not only does it have the Gnome 2-like MATE desktop, but because it is based on Debian Testing (currently known as jessie), LMDE is relatively slow to change.

What's irritating about LMDE is that, because it is based on Debian Testing, it is relatively slow to change.

This really isn't too much of a bother, except for Firefox and Thunderbird, which change versions at the drop of a hat, not that anyone wears a hat they can drop anymore. So, for example, as of this moment (it could change by tonight), Firefox is on version 23, and Thunderbird is on version 17.0.8. LMDE's versions, OTOH, are at 21 and 17(.0.0).

OK, this is not one of life's big tragedies. Most updates of Fox&Bird do not involve major changes. But I like to keep a little more current.

Fortunately, there is a relatively easy fix for this which won't do too much damage to your installation even if it completely craps out. The details are all in this LMDE forum post and the one above it, but I've added a little twist of my own, based on a post even further up the topic than the ones I've already mentioned and linked to.

What makes this relatively easy is that LMDE stores Firefox & Thunderbird files in the /opt directory, since pure Debian doesn't support them under their default names because of trademark issues (see iceweasel and icedove). That means any mucking around you have to do is confined to /opt, rather than such touchy directories as /usr/lib and the like.

So what to do:

  1. Install Fox&Bird, if you haven't already:
    $ sudo apt-get install firefox thunderbird (N.B. If you haven't already installed Firefox or Thunderbird, and don't miss them, you might ask yourself just what you are doing reading this post.)

  2. Become the superuser and go to the /opt directory.
    sudo -i
    # cd /opt

  3. Back up the firefox and thunderbird directories. This lets you get back to the original versions if you frak everything up. If you are particularly paranoid, back up your $HOME/.mozilla and $HOME/.thunderbird directories in the same way.
    # cp -rp firefox firefox_21
    # cp -rp thunderbird thunderbird_17.0
    The -rp options recursively copy everything and preserve all permissions and time stamps.

  4. Optional step: Change the ownership of firefox and thunderbird. If you do this, then you will be able to update both programs without becoming superuser. Otherwise, you'll have to launch the apps using sudo to do the upgrades. Technically this a regression, as it allows someone to update a core component of the machine without root access, i.e., it behaves like Windows XP. On a single user machine this is probably not a big problem.

    Assuming your username is, say, capaldi,
    # chown -R capaldi:capaldi firefox thunderbird If you do this step you can now get out of su mode:
    # exit
    logout
    $

  5. Now for the trick. You need to put Fox&Bird into the release channel:
    $ vi /opt/firefox/defaults/pref/channel-prefs.js When you get here, look for a line that says
    pref("app.update.channel", "default"); and change default to release.

  6. Do the same thing for
    $ vi /opt/thunderbird/defaults/pref/channel-prefs.js In my copy, this was already set, which is why Thunderbird kept asking to update (and always failed, since it I wasn't root).

  7. Restart either app. In the Help menu click on About Firefox/Thunderbird. Updates should appear normally, though I had to go through the process a couple of times to get a successful update. In Thunderbird it took forever to do the update, but when I Xed out the update window and restarted Thunderbird it was properly updated. I'll let you know if this trend continues with the next update, which might occur as early as this week.

  8. Now if and when LMDE does push Fox&Bird updates, all of your lovely work will be overwritten. You can do that by locking the package. The easiest way to do this that I know is:

    1. Open synaptic. If you don't have it,
      $ sudo apt-get install synaptic
    2. Search for firefox and click on it.

    3. In the synaptic menu bar, click Package.

    4. Click Lock Version.

    5. Search again for Firefox and make sure it is locked. The whole Firefox line should be red.

    6. Repeat for Thunderbird.

And that should do it. Remember, if things get messed up, you can always use your backup directories to get back to the default distribution, or you can do complete remove/reinstall:
$ sudo apt-get purge firefox thunderbird
$ sudo apt-get install firefox thunderbird