How to upgrade Debian from Etch to Lenny

Okay, if you've tried upgrading from etch to lenny, you've probably seen an error message, to the following effect:
1. You can't upgrade libc6 until you first install a 2.6 kernel.
2. You can't install the lenny 2.6 kernel until you upgrade libc6.
3. This is NOT (in big tall capital letters) a bug.
4. You should add the etch sources and install an etch 2.6 kernel before trying to upgrade to lenny.

I suppose if you do step 4 first, before attempting to upgrade to lenny, that may be all you need to do. However, once you see the error message, you will discover that you are stuck in an in-between state that can be difficult to resolve.

1. If you follow the instructions and ADD the etch sources, then apt-get update will whine that it can't do that because it runs out of memory. The solution is to REMOVE the lenny or stable sources from sources.list, listing ONLY the etch ones (for now).

2. apt-get update should work now, but apt-get still won't do squat else, and the error message it gives you is vague. Upon closer examination, this is caused by the fact that you have a broken package, which was caused by trying to upgrade to Lenny without installing a 2.6 kernel first. You can fix this by using the fix broken packages option. (This option is in the menus in both synaptic and aptitude, though you still have to apply to make it actually happen.)

3. If you're a forgetful sort of person, chances are by the time you get your broken packages fixed, you've forgotten the exact incantation that the first error message gave you for installing the 2.6 kernel. Here it is:
apt-get install -t etch linux-image-2.6

4. Of course, linux-image-2.6 is a virtual package, so you have a choice of which kernel you actually want to install. I picked the 2.6.18 686 kernel, and that worked for me, YMMV. Don't forget to make sure /boot is remounted rw, if you normally mount it ro. (If you don't know how /boot is mounted, it's probably rw already, and may even be part of the / filesystem.)

5. Since you've just upgraded the kernel, you probably want to reboot. Yes, that means you have to close Firefox (or Iceweasel, or whatever they're calling it these days).

6. While you're still on the etch sources, go ahead and do apt-get dist-upgrade, to make sure you're at least fully up to the latest and greatest etch.

7. NOW it should be safe to change sources.list to refer to stable (or lenny) instead of etch, do your apt-get update, and proceed as usual from there.


Jim said...

A few notes from someone who had to go through this today.

First, you can avoid the apt out-of-memory error by increasing the size of apt's cache. Depending on who you ask, this is the recommended workaround for the "MMap out of room" issue.

Unfortunately in Step 3, when I ran into the broken packages issue, invoking `apt-get -f install` didn't fix anything.

The only way I could get around the libc6/2.6 kernel circular dependency issue was by (after much fruitless experimentation), removing everything from sources.list except for the etch ones.

My old sources.list entry for etch didn't work, since it's no longer the 'oldstable' version. Hence having to switch to in order to get the 2.6 kernel.