Upgrading Debian Lenny to Debian Squeeze

This document will help guide you through upgrading a Debian 5.0 (Lenny) server to a Debian 6.0 (Squeeze) server.

We highly recommend that you perform all of these steps on a test system before making changes to your production server -- that way, you can minimize downtime by knowing what all to expect.

These steps are a succinct version of the full Debian upgrade guide available here: http://www.debian.org/releases/stable/i386/release-notes/ch-upgrading.en...

You should plan for some downtime -- there are big differences between the two distributions, and things don't always go as smoothly as we'd hope. The Debian release notes suggest making sure you have console access during the upgrade process, as certain changes could potentially cause issues during the boot process.

You'll also want to check if the web applications that you use work with the new software you'll be using in Squeeze; in particular, note that Debian Squeeze uses PHP 5.3, which not all web applications support.

Upgrade Guide

** Make sure you have full backups of everything on your server that's important to you. At the very least, you'll want to generate full backups of all your Virtual Servers. You may also want to make a backup of everything in /etc.

** Make sure your system is fully up to date by running this command:

apt-get update && apt-get upgrade

Verify that it finishes completely and without errors.

** Edit /etc/init.d/lookup-domain, and add the following lines to the top of the file:

#!/bin/sh
# chkconfig: 235 99 10
# description: Start or stop the Virtualmin domain lookup server
#
### BEGIN INIT INFO
# Required-Start: $network $syslog
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: Start or stop the Virtualmin domain lookup server
### END INIT INFO

** Run this command to see if there are any packages in an incomplete state:

dpkg --audit

If there are, you'll need to fix those packages before continuing with the upgrade.

** Reset Dependency Flags

These packages are already installed, but the following command will tell apt not include them anytime "apt-get autoremove" is run:

apt-get install bind9 spamassassin spamc procmail libnet-ssleay-perl libpg-perl libdbd-pg-perl libdbd-mysql-perl quota iptables openssl python mailman subversion ruby irb rdoc ri mysql-server mysql-client mysql-common postgresql postgresql-client awstats webalizer dovecot-common dovecot-imapd dovecot-pop3d proftpd webmin usermin webmin-virtual-server libcrypt-ssleay-perl webmin-virtual-server-theme webmin-virtualmin-dav webmin-virtualmin-svn webmin-virtualmin-awstats webmin-virtualmin-mailman webmin-virtualmin-htpasswd clamav-base clamav-daemon clamav clamav-data clamav-freshclam clamav-docs clamav-testfiles libapache2-mod-fcgid scponly apache2 apache2-doc libapache2-svn libsasl2-2 libsasl2-modules sasl2-bin usermin-virtual-server-theme procmail-wrapper php-pear php5 php5-cgi webmin-security-updates libgd2-xpm

** Edit /etc/apt/sources.list, and change any reference of lenny to squeeze.

** Also in /etc/apt/sources.list, comment out the volatile repositories, as they are now deprecated.

If you happen to have any third party repositories enabled in your sources.list, such as DotDeb, you may want to comment those out as well for the time being.

** Update the package metadata by running:

apt-get update

** The next few steps will have you installing various packages. Some of those will ask you questions. The defaults to those questions are typically fine. That said -- be sure to fully read all the questions so that you understand what changes are being made.

** Before beginning the upgrade process, you'll want to install a new kernel. Using "uname -r", determine whether you're currently using an amd64 kernel (for 64 bit systems) or a i686 kernel (for 32 bit systems).

One you know whether you have an amd64 or i686 kernel, install the update for it with one of these two commands --

For amd64-based (64 bit) systems:

apt-get install linux-image-2.6-amd64

Or, for i686 (32 bit) systems:

apt-get install linux-image-2.6-686

Again, you only want to run one of the above -- which one depends on whether you're using a 32 bit or 64 bit kernel.

** Install udev by running the following:

apt-get install udev

** Now, begin the upgrade process with this command:

apt-get dist-upgrade

That will take some time to run, but it will ask you questions along the way, so you'll need to babysit the process.

** Edit the file '/etc/apache2/mods-available/php5.conf', and comment out the two lines that begin with 'SetHandler' by putting a '#' in front of them. Otherwise, mod_php will begin serving all requests, regardless of what the "PHP Execution Mode" is set to.

** Now reboot! If all went well, you should have a working Debian 6 server running Virtualmin.

** Log into Virtualmin, and you should see a notice at the top where it detects the change to Debian 6. Click the Update Detected Operating System button.

** You should now be finished. Now is the time to test everything and make sure it all works as expected!

Caveats (known problems with MySQL and Dovecot)

During our testing, we discovered that MySQL and Dovecot didn't always work properly, and needed a simple config file tweak.

** Dovecot

If, while starting Dovecot, it complains about invalid syntax in the Dovecot config -- you may need to comment out these two lines in the config file:

  sieve=~/.dovecot.sieve
  sieve_storage=~/sieve

** MySQL

If MySQL doesn't start, look in /etc/mysql/my.cnf to see if there is a line reading skip-bdb. If so, comment that line out, and then run this command:

apt-get install mysql-server

If that doesn't help, run "mysqld" from the command line. It should then tell you what error is preventing it from launching.

** Apache's userdir module

If you are using the Apache userdir module, using mod_php as your PHP Execution Mode won't work without some tweaks.

The Apache userdir module isn't enabled by default. To determine if you're using it, you can run this command:

ls -l /etc/apache2/mods-enabled/userdir.load

If that file exists, that means you are indeed using userdir.

Debian disables that by default for security reasons, as using mod_php to execute code on a shared hosting server is not configured a secure setup.

If you wish to override that Debian default, you can do so by editing /etc/apache2/mods-enabled/php5.conf, and comment out the line that reads:

'php_admin_value engine Off'

Then restart Apache:

/etc/init.d/apache2 restart