How To Upgrade Debian Etch To Lenny

November 11, 2010 by: jennyamy

Debian Etch is soon to be unsupported by the Debian team, therefore all Debian Linux Servers need to be upgraded to Debian Lenny. I work for Netzen (an IT Support company) and have upgraded many Linux servers to Debian Lenny over the past month, so I am providing this guide on how to upgrade Debian Etch to Debian Lenny to the HowtoForge community.

Backup

Backup! I took a full backup of the server which is stored off the server I am backing up of course! I also take an additional backup of  /etc which I store locally in /root this is just in case I make a mistake during the the upgrade process and over write a config file, or dpkg / aptitude makes a misstake some how and botches my configs. Worth pointing out that none of these two things have never happened, but “only the paranoid survive”.

SSH / Screen

When I upgrade my servers remotely over SSH I always run the upgrade in screen, that way if you lose connection to your server you will still be able to reconnect to the screen session.

To run screen type:

screen

To reconnect to a screen session:

screen -rd

Or if you don’t have screen installed:

aptitude install screen

Upgrade your existing Etch install

Before upgrading to Lenny, make sure your box is fully up to date using your existing apt sources for Etch, to do this:

aptitude update && aptitude dist-upgrade

If the updates you have applied include a kernel upgrade I would advise rebooting the server at this stage.

Check disk space for install

Make sure you have enough space for the upgrade.

Edit apt sources for Lenny

Edit your /etc/apt/sources.list file to use lenny instead of etch repositories, this is normally a case of replacing the word etch with lenny, however take a moment to make sure you don’t have any other entries in your sources.list file. If you have any backports or 3rd party repositories I would comment them out during the upgrade. FYI here are the mirrors I used during upgrades:
deb http://ftp.uk.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ lenny main contrib non-free
deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free

Upgrade Apt & Aptitude

The first things to upgrade are apt & aptitude, this will pull a few dependencies and will automatically upgrade libc6 and locales and will pull in SELinux support libraries (libselinux1). Some services may need restarting (you will get asked to restart various services several times during the upgrade process).

aptitude update && aptitude install apt && aptitude install aptitude

The first time the lenny version of aptitude is run, it will read in its list of automatically installed packages and convert it for use with the lenny version of apt. If you have aptitude installed, you should at least issue one aptitude command to do the conversion. So go ahead and enter:

aptitude search “?false”

Minimal System Upgrade

Ok now we have aptitude updated it’s time to do what Debian call a “minimal system upgrade” which basically upgrades all packages that do not require other packages to be removed or installed. To do this enter:

aptitude safe-upgrade

Quick note from Debian “The next step will vary depending on the set of packages that you have installed. These release notes give general advice about which method should be used, but if in doubt, it is recommended that you examine the package removals proposed by each method before proceeding.” However in my case it was fine and I proceeded, however you might want to check with the Debian Obsolete Packages.


This step is probably going to take a while and is going to pull down a lot of packages from the mirrors, but you will need to remain at the terminal as your going to have to tell aptitude what to do with various config files as your system upgrade progresses, the default is to use your existing configs. Which is what I did for the majority of my configs however if you want to make use of new features you will more than likely have to use the new configs or edit your existing configs to make use of the feature.

Upgrade the rest of the System

Ok, when that’s finished it is  now time to upgrade the rest of the system! Please enter:

aptitude dist-upgrade

Again, your going to need to hang around and tell aptitude what to do with your config files.

Upgrade the Kernel

Ok when that’s done you are almost finished, we need to check that aptitude upgraded your kernel during the update, in my case it didn’t. Enter the following to check:

dpkg -l “linux-image*” | grep ^ii

If you don’t see any output then you will have to install a new kernel image by hand, as I had to. Your best option is to find out what kernel you are currently running using:

uname -r

cartman:~# uname -r
2.6.26-2-686

Then do  a search using aptitude for a similar kernel using:

apt-cache search linux-image-2.6- | grep -v transition

cartman:~# apt-cache search linux-image-2.6- | grep -v transition
linux-image-2.6-486 – Linux 2.6 image on x86
linux-image-2.6-686 – Linux 2.6 image on PPro/Celeron/PII/PIII/P4
linux-image-2.6-686-bigmem – Linux 2.6 image on PPro/Celeron/PII/PIII/P4
linux-image-2.6-amd64 – Linux 2.6 image on AMD64
linux-image-2.6-openvz-686 – Linux 2.6 image on PPro/Celeron/PII/PIII/P4, OpenVZ support
linux-image-2.6-vserver-686 – Linux 2.6 image on PPro/Celeron/PII/PIII/P4, Linux-VServer support
linux-image-2.6-vserver-686-bigmem – Linux 2.6 image on PPro/Celeron/PII/PIII/P4, Linux-VServer support
linux-image-2.6-xen-686 – Linux 2.6 image on i686, oldstyle Xen support

So in this case I would install linux-image-2.6-686 using:

aptitude linux-image-2.6-686

I then rebooted my server and it booted fine, however I had remote access via KVMoIP standing by just in case there was a problem during boot. In the Official Debian notes they recommend re running “/sbin/lilo” and reviewing the contents of your /etc/kernel-img.conf to make sure that you have do_bootloader = Yes. That way the bootloader will always be rerun after a kernel upgrade.

Let me know how you get on, feel free to link back to this page and post in the comments if you experience problems during your upgrade and I will do my best to get back to you in a timely manor, however please remember I do already have a day job :) Of course you could always hire Netzen to upgrade your Debian Linux servers for your company.

Disclaimer

I take care to make sure the information I post on my blog is accurate, however there could be mistakes, if your break your server following guides found on this website, it is your fault this guide and others found here come with no guarantee. Please use at your own risk.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Have you found this script useful? Please support author by PayPal donation.

Leave a Reply