Home

Absolutely no warranty. Use entirely at your own risk. Read the disclaimer. This document is specific to servers configured per documents at http://verchick.com/mecham/public_html/spam/. At this time I have not tried this on a system using RAID so I would not attempt it on a production server using RAID. At some point I will try it on a RAID1 system and see how it goes but in the mean time I would make the assumption your system will not boot up after the upgrade if using RAID. This document is meant to give you ideas of some of the issues involved. It is not necessarily a direct 'copy and paste' document - at least not fully, so please read through it before performing the steps. I suggest you develop your own plan to upgrade using this document to give you ideas. You may wish to Google around for other documents that show others performing the upgrade (some links are at the bottom of this page). Before starting the migration from sarge to etch it is advised you have a full backup of your system. The biggest issue with the upgrade is you will be migrating from devfs to udev as you upgrade to the etch kernel. See http://verchick.com/mecham/public_html/spam/kernel.html.

It's been a couple weeks now that etch became stable (well, Ok, it was when I wrote this) and now it's time to think about upgrading my Debian gateway spamfilter to etch. I'm going to try and control the process in order to avoid potential surprises rather than simply run 'apt-get dist-upgrade' and hope for the best. I am going to follow this plan:

  • Remove the Debian sarge amavisd-new package (otherwise the etch version will install)
  • Make sure our startflop script is up to date
  • Edit sources.list and preferences
  • Migrate the system to udev by upgrading the kernel and libc6
  • Upgrade apt and install gpg keys
  • Review packages that are on hold and possibly release them
  • Move programs I installed from sarge-backports to etch
  • Move clamav from sarge volatile to etch
  • Simulate an upgrade and check packages that will get held back and try to repair them
  • Perform the dist-upgrade
  • Clean up, reconfigure sources.list, install clamav from volatile and check for errors

    If you were using an older HOWTO, the Debian amavisd-new 20030616p10 package may have been put on hold. Let's check and see.
    apt-cache policy amavisd-new

    If this says we have amavisd-new 20030616p10 installed, then we need to remove it (but we still need amavisd-new to work of course). Do not do this if you have 2.4.2 installed! First test that the only thing that will be removed is amavisd-new:
    apt-get -s remove amavisd-new

    If it says amavisd-new will be the only thing that will be removed, remove it and then fix it so it still functions:
    mkdir /etc/ambackup
    cp -R /etc/amavis/ /etc/ambackup/amavis-backup
    cp /usr/sbin/amavisd-new /usr/sbin/amavisd-new-temp
    amavisd-new stop
    apt-get remove amavisd-new

    cp /usr/sbin/amavisd-new-temp /usr/sbin/amavisd-new
    chmod +x /etc/init.d/amavis
    /etc/init.d/amavis start

    We created a startup script called /etc/init.d/startflop that is used with AIDE. If you have this script, it may need to be updated to work with udev:
    vi /etc/init.d/startflop

    If you have this file, edit it to look like this (it may already look this way):
    #! /bin/sh
    #
    # very simple startup script
    
    case "$1" in
        start)
        /usr/bin/test -e /dev/fd0u1722 || /bin/mknod /dev/fd0u1722 b 2 60
        /bin/chmod 660 /dev/fd0u1722
        /bin/chown root:floppy /dev/fd0u1722
        /bin/mount /dev/fd0u1722 /floppy
            ;;
        stop)  /bin/umount /floppy
            ;;
    esac
    
    exit 0
    

    If you have entries in /etc/apt/preferences, at this point make sure stable has the highest priority.
    vi /etc/apt/preferences

    For example:
    Package: *
    Pin: release a=stable
    Pin-Priority: 500
    
    Package: *
    Pin: release a=testing
    Pin-Priority: 450
    
    Package: *
    Pin: release a=unstable
    Pin-Priority: 400

    For the time being, we are going to comment out everything in /etc/apt/sources.list except for stable and sarge. Both regular and security. Then change 'stable' to 'etch' for the regular sources and change 'sarge' to 'etch' for the security updates and volatile. I also added 'contrib non-free' to the etch security updates source. I have also added etch volatile (which I will use in the future for clamav). However I have temporarily commented out everything except the etch sources (your mirror may vary):
    vi /etc/apt/sources.list
    #deb http://volatile.debian.net/debian-volatile etch/volatile main
    
    deb http://mirrors.kernel.org/debian/ etch main non-free contrib
    deb-src http://mirrors.kernel.org/debian/ etch main
    
    deb http://security.debian.org/ etch/updates main contrib non-free
    
    #deb http://mirrors.kernel.org/debian/ testing main non-free contrib
    #deb-src http://mirrors.kernel.org/debian/ testing main
    
    #deb http://mirrors.kernel.org/debian/ unstable main non-free contrib
    #deb-src http://mirrors.kernel.org/debian/ unstable main
    
    #deb http://www.backports.org/debian/ sarge-backports main contrib non-free
    
    Save and exit the file, then:
    apt-get update

    Now we will upgrade the kernel and libc6. I cannot recommend this if you are using RAID.First see if initrd-tools is installed:
    dpkg -l initrd-tools

    If this program is installed, it should report something like "ii initrd-tools 0.1.81.1 tools to create initrd image for prepackaged". If it is not installed, you may already be running a newer kernel that does not use initrd-tools (test with 'uname -r'). If that is the case, there is no need to continue. If you are running a kernel older than 2.4.1, I have no advice for you. Otherwise, upgrade initrd-tools:
    cd /usr/local/src
    wget http://verchick.com/mecham/public_html/initrd-tools_0.1.84.1_all.deb
    dpkg -i initrd-tools_0.1.84.1_all.deb


    If you are currently running a 2.4 kernel (2.4.1 or greater - use 'uname -r' to find out) then you should run these next commands regardless whether you upgraded initrd-tools or not. This may possibly solve a problem where an initrd-img cannot be created for the 2.4 kernel when libc6 is upgraded:
    cd
    wget http://verchick.com/mecham/public_html/fix.mkinitrd
    chmod +x fix.mkinitrd
    ./fix.mkinitrd


    Now get a list of potential kernels to install. The 486 image will work with Intel or AMD. Here are the most common 32bit kernels:
    linux-image-486 - Linux kernel image on 486-class machines
    linux-image-686 - Linux kernel image on PPro/Celeron/PII/PIII/P4 machines
    linux-image-k7 - Linux kernel image on AMD K7 machines

    There are other x86 kernels available (including smp kernels), get a list of them and choose the correct one:
    apt-cache search linux-image | grep linux-image

    Make a note of how your disks are mounted (make a copy of this):
    df

    We install yaird (Yet Another Mkinitrd) to hopefully prevent this problem:
    http://verchick.com/mecham/public_html/spam/waiting_for_root_file_system.html

    Always first simulate installations to make sure there are no surprises (edit to suit your CPU if you like):
    apt-get -s -t stable install linux-image-686 yaird udev libc6-dev gcc-3.3

    If everything looks OK, perform the install:
    apt-get -t stable install linux-image-686 yaird udev libc6-dev gcc-3.3

    You may be asked to (re)Configure Locales. Once the new kernel is installed, cross your fingers and reboot:
    reboot

    What kernel are we using?
    uname -r

    This should show you are running kernel 2.6.18 or higher.

    Download a file as a (not very good) test to see whether you may have an issue with tcp window scaling or not. This test is not very good because it only tests routers between you and debian.org:
    wget http://ftp.debian.org/debian/pool/main/m/mysql-dfsg-5.0/mysql-dfsg-5.0_5.0.32.orig.tar.gz

    If the download hangs, there could be problem with tcp window scaling and buggy routers. Please read http://marc.info/?l=postfix-users&apm;m=117457942431349. You might also try these numbers in /etc/sysctl.conf (run sysctl -p after making changes to this file). In fact, it may be a good idea to add these whether the test failed or not:
    net.ipv4.tcp_wmem = 4096 65536 65536
    net.ipv4.tcp_rmem = 4096 65536 65536


    You can:
    rm mysql-dfsg-5.0_5.0.32.orig.tar.gz

    When finished testing.

    Now let's upgrade apt:
    apt-get install apt

    and import some gpg keys:
    gpg --keyserver subkeys.pgp.net --recv-key EC61E0B0BBE55AB3
    gpg --armor --export EC61E0B0BBE55AB3 | apt-key add -
    gpg --keyserver subkeys.pgp.net --recv-key A70DAF536070D3A1
    gpg --armor --export A70DAF536070D3A1 | apt-key add -
    gpg --keyserver subkeys.pgp.net --recv-key EA8E8B2116BA136C
    gpg --armor --export EA8E8B2116BA136C | apt-key add -
    gpg --keyserver subkeys.pgp.net --recv-key 7EF7FFF4276981F4
    gpg --armor --export 7EF7FFF4276981F4 | apt-key add -


    and:
    apt-get update


    I want to review packages I have on hold and possibly release them from hold. I will have to think back as to whether I placed them on hold or not and if I did, why I did it:
    dpkg --get-selections | grep hold

    One system I have shows:
    initrd-tools                                    hold
    libimage-exiftool-perl                          hold
    libmime-perl                                    hold
    
    I placed initrd-tools on hold because I did not want it to upgrade (because the newer version would have upgraded libc6 too) but now that I have upgraded libc6, I can let it install again:
    echo "initrd-tools install" | dpkg --set-selections

    I placed libimage-exiftool-perl on hold because I manually patched it when I installed FuzzyOcr 2.3b. I have since upgraded to FuzzyOcr 3.5.1 which no longer uses libimage-exiftool-perl, so I can let it install:
    echo "libimage-exiftool-perl install" | dpkg --set-selections

    I remember installing libmime-perl from 'testing' because I wanted a newer version. I put it on hold just in case a newer version upgraded libc6 along with it. I didn't want to chance it. Now that libc6 is upgraded, we can let it install newer versions:
    echo "libmime-perl install" | dpkg --set-selections


    I want to see if I have packages installed from backports (this assumes I have not cleaned out my cache of downloaded packages). If you have cleaned out your cache, maybe you can remember what packages you installed from sarge-backports:
    ls -l /var/cache/apt/archives/*bpo*

    my system shows:
    /var/cache/apt/archives/gifsicle_1.44-0bpo1_i386.deb
    /var/cache/apt/archives/libcompress-zlib-perl_1.42-1~bpo.1_i386.deb
    /var/cache/apt/archives/ocrad_0.16-1~bpo.1_i386.deb
    /var/cache/apt/archives/postgrey_1.27-3~bpo.1_all.deb

    These were install from backports because I wanted to keep my system stable. Installing newer versions would have upgraded libc6 but since libc6 is now upgraded, I can reinstall these packages from etch stable:
    apt-get install gifsicle libcompress-zlib-perl ocrad postgrey

    Gifsicle and ocrad were installed to support FuzzyOcr 3.5.1 which reminds me: sarge used xfree86-common and etch uses x11-common and the two conflict with each other so I will install x11-common. Note: I don't run a GUI; if you do, I have no idea if this will mess things up for you, but it very well might:
    apt-get -s install x11-common

    This may be an issue if you are running a GUI:
     +---------------------------------------¦ Configuring x11-common +------------+
     ¦                                                                             ¦
     ¦ Major possible upgrade issues                                               ¦
     ¦                                                                             ¦
     ¦ Some users have reported that upon upgrade to the current package set,      |
     |  their xserver package was no longer installed. Because there is no easy    | 
     |  way around this problem, you should be sure to check that the xserver-xorg | 
     |  package is installed after upgrade. If it is not installed and you require |
     |  it, it is recommended that you install the xorg package to make sure you   |
     |   have a fully functional X setup.                                          ¦
     ¦                                                                             ¦
     ¦                                                 <Ok>                        ¦
     ¦                                                                             ¦
     +-----------------------------------------------------------------------------+
    Not a problem for me since I don't use a GUI. I only need this stuff to run FuzzyOcr. If it looks like nothing bad will happen:
    apt-get install x11-common

    I am also going to see if I have stuff installed from sarge volatile:
    ls -l /var/cache/apt/archives/*volatile*

    Looks like I have been using clamav from volatile:
    /var/cache/apt/archives/clamav-base_0.90.1-0volatile1_all.deb
    /var/cache/apt/archives/clamav-daemon_0.90.1-0volatile1_i386.deb
    /var/cache/apt/archives/clamav-freshclam_0.90.1-0volatile1_i386.deb
    /var/cache/apt/archives/libclamav1_0.88.7-0volatile2_i386.deb
    /var/cache/apt/archives/libclamav2_0.90.1-0volatile1_i386.deb

    So, I will also (re)install clamav from etch stable (we will upgrade it to volatile later). If you are upgrading from 0.88.x or earlier, make sure you let it replace files as needed:
    apt-get install clamav clamav-daemon clamav-freshclam

    The new version of Postfix will want you to explicitly configure 'mydomain' in main.cf. Please:
    vi /etc/postfix/main.cf

    and configure mydomain (if you have not already done so):
    mydomain = example.com

    postfix reload
    postfix check


    If it complains that files differ, run our LINUX2 script (it comes with the postfix source code if you need it):
    LINUX2

    It never hurts to make sure we are still processing mail:
    tail -f /var/log/mail.log


    During the upgrade you will be asked some questions. If you don't know the answer you may have to accept the default. If it wants to replace configuration files, I often have made changes that I don't want to loose so I typically do not replace configuration files unless I'm sure the file is so different that I really must. Sometimes keeping old config files works to my advantage but I admit this may not always be the best option. You might want to take notes on how you reply to questions.

    We may have made changes to the logcheck database during our travels but the postfix logcheck (and possibly other) files will want to update during the upgrade (and we should let the logcheck files get replaced when prompted). So, lets just make a backup copy in case we need it:

    cp -r /etc/logcheck /etc/logcheck-old

    If you installed bind9 using my doc, we made changes to /etc/init.d/sysklogd. With the new version of bind9 we do not need to keep those changes, so when prompted, replace the file.

    You might consider opening a second PuTTY window during the upgrade so if you want to replace a configuration file, but keep the old one, you can make a backup copy if needed. Let's see what will happen:
    apt-get update
    apt-get -s dist-upgrade >ugte
    less ugte


    As you read this file, see what files have been kept back (if any) and try to determine why. Maybe you can install them individually. See http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html#s-dist-upgrade for hints. I would try to install them before you do a dist-upgrade. Then run the last two commands above again, repeating the process. When everything looks reasonably Ok, you may choose to do the upgrade. As debconf asks you questions during the upgrade, if you are not sure what the answer should be, you should probably choose the default answer. If you want more control over the upgrade process you may choose to install programs manually, but even so, at some point you should run:
    apt-get dist-upgrade

    After all is done, I would reboot (but that's just me - it should not be required):
    reboot

    See if the Postfix chroot is happy:
    postfix check

    If it complains that files differ, run our LINUX2 script:
    LINUX2

    The next thing I would check is whether we are sending and receiving mail:
    tail -f /var/log/mail.log

    You will have to work through it if there is a problem. If you used my doc on installing policyd-weight, then you will want to edit:
    vi /etc/logcheck/ignore.d.server/postfix

    and near the bottom, change policyd-weight to policydweight.

    You will also want to go through the process of running /floppy/report and copying /root/aide/aide.db.new over to /floppy/aide.db as usual.

    If you are using an unpatched pflogsumm.pl version 1.1.0, you will need to patch it. (note that my really old docs placed pflogsumm.pl in /usr/bin):
    cd /usr/sbin
    wget http://verchick.com/mecham/public_html/spam/pflogsumm-conn-delays-dsn-patch
    patch pflogsumm.pl <pflogsumm-conn-delays-dsn-patch
    rm pflogsumm-conn-delays-dsn-patch
    cd



    Now you should set up /etc/apt/sources.list again:
    vi /etc/apt/sources.list

    Assuming you have configured /etc/apt/preferences as shown above (make sure stable has highest priority), here is what your file may look like (we probably won't need backports for a while so I removed it):
    deb http://volatile.debian.net/debian-volatile etch/volatile main
    
    deb http://mirrors.kernel.org/debian/ etch main non-free contrib
    deb-src http://mirrors.kernel.org/debian/ etch main
    
    deb http://security.debian.org/ etch/updates main contrib
    
    deb http://mirrors.kernel.org/debian/ testing main non-free contrib
    deb-src http://mirrors.kernel.org/debian/ testing main
    
    deb http://mirrors.kernel.org/debian/ unstable main non-free contrib
    deb-src http://mirrors.kernel.org/debian/ unstable main
    Now of course:
    apt-get update

    Now you can upgrade clamav from volatile:
    apt-get -t etch install clamav clamav-daemon clamav-freshclam

    If you upgraded SpamAssassin from sarge 3.0.3 to etch 3.1.7 and you are using the DCC client, at the very least you need to enable the DCC plugin and then restart amavisd-new (the next line may wrap - so be sure to copy the entire line):

    sed -i 's/#loadplugin Mail::SpamAssassin::Plugin::DCC/loadplugin Mail::SpamAssassin::Plugin::DCC/g' /etc/spamassassin/v310.pre

    amavisd-new reload


    The default system editor will now be nano. If you want to keep vim as the default:
    vi /root/.profile

    and just below the line "fi" insert this entry:
    export EDITOR=/usr/bin/vim.basic

    Save and exit the file, then logout of PuTTY ([Ctrl]+d), then connect back in.

    Additional Notes:
    I use Mailgraph. After upgrading mailgraph, my old mailgraph data was lost (and I had to reapply a patch to /usr/sbin/mailgraph and then restart mailgraph):
    -		if(   $text =~ /^\([0-9-]+\) (Passed|Blocked) SPAM\b/) {
    +		if(   $text =~ /^\([0-9-]+\) (Passed|Blocked) (SPAM|SPAMMY)\b/) {
    Other sources of information:
    http://wiki.debian.org/Sarge2EtchUpgrade
    http://www.debianadmin.com/upgrade-sarge-to-etch.html
    http://www.debian.org/releases/stable/i386/release-notes/ch-upgrading.en.html
    http://www.debian.org/releases/stable/i386/release-notes/ch-information.en.html
    http://www.go2linux.org/node/66
    http://www.cyberciti.biz/tips/upgrading-debian-sarga-3-to-etch-4.html

    mr88talent at yahoo dot com
    02 MAY 2007