The Blog is Back!

Well, I’ve been out of commission for a while, but I’m back! The main problem was that my crappy old server (an old desktop machine) finally had a disk failure, and I decided the time was ripe to upgrade to a real machine. I’m now on a Rackable 2U unit, and I switched from Linux to FreeBSD to boot.

I was fortunate that I could bring up the old machine enough to copy off most of the data, and I do remote backups to my home machine via DSL, so I had a reasonably good copy of everything. Over a weekend, I was pretty much able to get everything back up and running. Of course, there are always a few gotchas!

The one that killed Movable Type for me was not that I needed to install Perl (I did) and not that I needed to change the config a bit for the new version (I did that too), but a basic problem with Berkeley DB hell.

Read on if you want the gory details. Suffice to say, after a few hours of struggle, I beat it into submission. Please also note that I posted a couple entries that I wrote while it was down, and backdated.

The first problem was that Movable Type and/or Perl DB_File gave me no error message. I just got an Invalid Login message. The files seemed fine, everything executed, but the login would just fail. Several Googles later, I figured out that it was probably the database version, based on a MT FAQ. I tried to dump the data to text files, but by this time the old machine was pretty toasted, and that didn’t work.

Then I spent quite a while just trying to figure out what version of Berkeley DB I needed. I ran “file” and got this: “Berkeley DB (Btree, version 8, native byte-order)”. But what version of Berkeley DB is that? I found this very useful Usenet article from Matthew Wilcox (willy@debian.org):

Oh boy. Welcome to the world of pain that is Berkeley DB.

We have the API changes (1.85, 2, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, …)
Then there are the on-disc database format versions

4.1 changed:
Btree/Recno: version 8 to version 9
Hash: version 7 to version 8
Queue: version 3 to version 4
4.0 changed the on-disc log format
3.3 did not change any on-disc formats.
3.2 changed:
Queue: version 2 to version 3
3.1 changed:
Btree/Recno: version 7 to version 8
Hash: version 6 to version 7.
3.0 changed:
Btree/Recno: version 6 to version 7
Hash: version 5 to version 6.

(fwiw, Debian’s db3 is db3.2. other distributions vary.)

So far, all versions of Berkeley DB support the 1.85 interface.
However none, that I’m aware of, support the previous version’s interfaces.
There’s some hope since db4.1’s on-disc formats are backwards-compatible with
4.0’s, and do not require upgrades.

There’s no tool to _downgrade_ a db to an older version so going backwards
is kind of hard.

Changing what version of DB you use is a major pain.

I went to /usr/ports and found several versions of Berkeley DB, so I installed versions 3 and 4, just in case. Then I tried a few things to see if that just worked. Nope.

I went into the Perl directory, and tried recompiling DB_File. No dice. I tried just ‘make clean’ and ‘make’ in the Perl directory. Nope, that didn’t do it either. Now I’m into looking into Makefiles and tweaking Configure to get it to find the new DB libs. I was worried about side effects if I just renamed the libdb3 to libdb, so I thought this would be easier.

I tried a bunch of options, because while I know Makefiles, I don’t really know how to push the buttons on Configure to make it do what I want. Finally, after much experiementation, I ended up adding the following to the Makefile in the /usr/ports/lang/perl5.8 directory. In the CONFIGURE_ARGS variable, I added “-Dccflags=-I/usr/local/include/db3″ and also “-Alibswanted=db3″. I then did make clean, make, and make install.

I tried the login, and Hallelujah! It worked! I write all this in the hope that nobody else ever has to take 4 hours to figure this out. Good luck!

Share and Enjoy:
  • co.mments
  • del.icio.us
  • digg
  • Fark
  • Furl
  • Ma.gnolia
  • NewsVine
  • RawSugar
  • Reddit
  • Shadows
  • YahooMyWeb
blog comments powered by Disqus