Upgrading Debian Squeeze to Debian Wheezy

This document will help guide you through upgrading a Debian 6 (Squeeze) server to a Debian 7 (Wheezy) 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.

Upgrade Guide

Backups

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.

Update Packages

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.

dpkg audit

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 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-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

Remove Dovecot

There is a problem with the Dovecot package during the upgrade process which frequently causes the upgrade to fail. The simplest fix is to temporarily remove it, and then reinstall it again after the upgrade completes.

First, backup your configuration:

cp -ra /etc/dovecot /root

And then remove (purge) Dovecot:

apt-get remove --purge dovecot-common

Edit sources.list

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

Third party repositories

Also in /etc/apt/sources.list, if you happen to have any third party repositories enabled, such as DotDeb, you may want to comment those out as well for the time being.

Update Package Metadata

Update the package metadata by running:

apt-get update

Note Regarding Prompts

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.

Kernel Upgrade

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 New Udev

Now that you've updated the kernel, you'll want to install the new udev by running the following:

apt-get install udev

Reboot

Before continuing the upgrade process, reboot your server.

Begin distupgrade

You can 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.

Reinstall Dovecot

apt-get install dovecot-common dovecot-imapd dovecot-pop3d

Configure Dovecot

Edit /etc/dovecot/conf.d/10-mail.conf, and make sure this parameter is set:

mail_location = maildir:~/Maildir

Edit /etc/dovecot/conf.d/10-auth.conf, and make sure this parameter is set:

disable_plaintext_auth = no

Reboot

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

Log into Virtualmin

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

Next, go into System Settings, and run the Re-Check Config, and verify that it doesn't detect any problems.

Also, if you had previously copied an SSL certificate into Dovecot, you'll need to copy that back in.

You can do that in Server Configuration -> Manage SSL Certificates, and in there you can use the "Copy to Dovecot" button.

Complete

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