It look like that to upgrade from Debian 3.1 to 4.0 should be fairly easy; however, the truth is that you will somehow trap by "libc6" loop. Here is a note to solve the problem.
- Update 3.1 as best as possible. Modified the /etc/apt/sources.list
#OldStable
#deb http://security.debian.org/ lenny/updates main contrib non-free
#deb http://ftp.us.debian.org/debian/ oldstable main contrib non-free
sudo apt-get update
sudo apt-get upgrade
- Switch to the etch sources, and update the kernel.
#etch
deb http://security.debian.org/ etch/updates main contrib non-free
deb http://ftp.us.debian.org/debian/ etch main contrib non-free
sudo apt-get update
sudo apt-get install linux-image-2.6.18-6-686
- Pre-Processing
apt-get install locales
Make sure we handle all the dependency issue:
apt-get install -f
- Install the kernel.
sudo apt-get install linux-image...
- Update Grub by running:
update-grub
Edit /boot/grub/menu.lst, set the Default to correct kernel
- Edit the tow links to the right kernel:
/boot/initrd.img initrd.img -> initrd.img-2.6.8-3-686-smp
, and then Reboot
/boot/vmlinuz -> vmlinuz-2.6.8-3-686-smp