Tuesday, March 20, 2007

Upgrade Debian Sarge to Etch

I have a Debian server that has been around for 6+ years. Oh sure, the hardware has changed, even failed and replaced, but the OS has been going this whole time. I have used the DEB packages almost exclusively, maybe even religiously on this box - using whichever flavour of package management application I felt like at the time (apt-get and aptitude are my preferences).

After a Debian machine has been running for a while, and especially one that is very eclectic and is used for various services and roles, it starts to get a little nuts. What I mean is, you install a deb file from the stable release, a host of deb's from testing and a random set of debs from various sources like Debian Backports. Hell, I like to roll my own debian packages as well - from the kernel-package to dh-make-perl, a crazy assortment of packages are installed to my system - Debian makes it easy. I just followed one rule - stay with deb packages.

Okay, I'm writing this before Etch, the current testing release, has gone to stable. The reason is because I'm starting to need more and more packages that are not available in the stable release but which are in testing. Sure, I can use backports, but I'm starting to get pissed at waiting (yet again) for the stable release to be upgraded. (this is not the first release I've done this and knowing the Debian release cycle as I do, I doubt it will be the last)

So its time to upgrade Debian Sarge to Etch! (or stable to testing)

Can you hear the drum roll... or is that just in my head?

Ensure you have backed up (off the box) any information or configuration that you are not willing to part with - just in case!

Head on over to your /etc/apt/ folder (I don't have X Window on my server, if you do, ensure you kill your xdm and drop to shell).

What you need to do is change any instance of stable (or sarge) with etch - while also using a little reasoning. Why not use the name testing? Because I've been hit one too many times, when an update caused havoc on my box when I had not expected a distribution upgrade. Managed upgrades are always a smart move.

Look in /etc/apt/apt.conf to start. (if you don't have one, no worries) I only have two lines in there that now look like this:

APT::Cache-Limit 10000000;
APT::Default-Release "etch";

Next is /etc/apt/preferences, which I had used to managed several sources coming from all three Debian releases. But since I'm starting from a fresh slate, so to speak, I'm going to remove this file altogether.

The last file I needed to edit was the /etc/apt/sources.list file, that you are
probably familiar with. My sources file just became easier - commenting out all
non-testing references, use etch in place of testing, stable or sarge. I even go so far to take out deb-src sources, adding these and other repositories as I need later. My greatly simplified sources now look like this:

# main package repository
deb http://mirror.peer1.net/debian/ etch main contrib non-free
# security updates
deb http://security.debian.org/ etch/updates main contrib non-free

Don't forget to use your favourite regional mirror!

Do a apt-get update.

Easy right? Well the interesting part is coming up.

First find some wood... and knock on it with your knuckles.

Do a apt-get dist-upgrade.

I have 599 upgraded, 114 newly install and 33 to remove packages. Good idea to review what is being removed, installed, etc.

At this point, its completely up to you if you want to hit that enter key! I make no promises. :-)

No comments: