This post will show how to upgrade from Debian 5.0.x “Lenny” to the latest stable Debian release 6.0 “Squeeze”. One of the reasons I’ve liked Debian in the first place was the advantage of being able to do a live, in place updates from one major release to another, usually in a safe way. As always, if you do this, please take some time to backup your system if you care of your data, as this is a major upgrade and things can go wrong. Squeeze brings in a few big changes and I will outline some of them, but I would recommend to read the release notes and look for any incompatibilities (hardware or software) or changed things that could affect your particular setup.
1. Update apt sources.list
The first thing we will do (after the backup of course) is to edit the /etc/apt/sources.list file and replace “lenny” with “squeeze“. Originally, this might look like this (for a system using the main US mirrors; your file might use a different local one):
1 2 3 4
after replacing lenny with squeeze the file will look like this:
1 2 3 4
2. Perform the system upgrade
After updating the sources file, you will have to refresh the indexes with:
Next let’s manually upgrade the core apt packages (this will pull in some extra dependencies, and this is perfectly fine):
And finally we will perform the bulk of package upgrades with:
this will take a while depending on what packages you have installed (that will need to be upgraded) and on your internet connection speed.
Here are some changes that you might want to pay special attention during the upgrade: - dash: squeeze uses dash instead of /bin/sh as the default system shell. This is the recommended way and it is supposed to be faster and improve the system overall performance. I recommend to use it and accept this change. - grub2: is the default in squeeze and the upgrade will recommend to upgrade from your existing grub. This is a major change and for this reason initially the boot loader will be chainloaded in the existing menu.lst to verify it works fine. If you want to upgrade I would recommend to do the chainload and test it with at least one reboot before removing grub legacy. - sysv-rc: to improve the boot process the upgrade will offer to move to dependency-based sequencing. This is irreversible but highly recommended. I had no problem with it and don’t see why anyone would not want this. - UUIDs: the installer will recommend to switch from regular disk devices (aka /dev/sda*) to disk IDs (aka UUID=c6ecae74-6754-4ad0-986d-98dd9cbfd293) in various configuration places like /etc/fstab, /boot/grub/menu.lst. I personally don’t like that, but didn’t want to take the risk for the device to change its name with the new kernel and went with the change. If you do the same pls. doublecheck the changed files before rebooting.
Now it is time to reboot your system for the first time into squeeze. Fingers crossed and in a few minutes you will be running squeeze (as always an out of band impi console is handy when doing such upgrades)
3. Complete the upgrade
If you upgraded to grub2 and want to remove the chainloaded grub-legacy you can remove it completely from the system with:
and the output will look like this:
1 2 3 4 5 6 7 8
You can now run:
and this will complete some extra packages that were not straitforward and not seen as safe by the normal upgrade process (there might be none, depending on the state of your existing system). Evaluate them before moving forward. And finally once you are done reboot once more (to see that grub2 is working fine by itself) and you will be running the latest uptodate squeeze system.
4. (Optional) Convert your ext3 filesystems to ext4
This step is optional and if you are happy with the ext3 filesystem then you can safely skip it. Myself, I’ve done this most of the time so I thought it might be useful to add it here for anyone else interested to do the same.
First doublecheck if you are running the 2.6.32 squeeze kernel:
Older than 2.6.28 kernels (like lenny 2.6.26 for example) don’t have native support for ext4, so this will fail for an older kernel. Because ext4 is backwards compatible with ext3, all we have to do is to change the mount definitions to ext4 in fstab:
and change the filesystem from ext3 to ext4 for any devices you might have. Make a note on the devices you change, and reboot the machine. After the reboot the machine will use the ext4 driver for the old filesystem even though it doesn’t take full advantage of the ext4 capabilities. To complete this and enable the extra ext4 features we will need to run for each filesystem:
like, for example for /dev/sda1:
this will only be activated when the filesystem is unmounted and we can achieve this with yet another reboot (especially for the root filesystem), and the system will auto fsck them (as the last command marked the filesystem as dirty) and perform the upgrade. I would highly recommend for this to have a remote console on the system as in most of the cases the auto fsck will fail and you will have to run it manually from the console.
Hopefully this howto will help you upgrade your debian system to squeeze with ext4. If you have encountered anything special during the upgrade feel free to share it with others using the comment box bellow.