Notes on upgrading Debian sarge amavisd-new 20030616p10 to Debian etch amavisd-new 2.4.2


Let me start by saying "absolutely no warranty" and "use entirely at your own risk". I encourage you to first inspect any files for malicious content prior to downloading them.

If you are planning on upgrading your sarge system to etch (I do not outline that procedure here) I suggest you upgrade amavisd-new prior to performing the dist-upgrade. Doing so will prevent a broken mail system. I also suggest upgrading the kernel and libc6 and installing the etch version of apt prior to running dist-upgrade (and prior to upgrading amavisd-new). I will assume you have a 'stable' or 'etch' source in /etc/apt/sources.list.

The new Debian version of amavisd-new no longer uses amavisd.conf. If amavisd.conf exists during the upgrade to Debian amavisd-new 2.4.2, dpkg will return an error:
dpkg: error processing amavisd-new (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 amavisd-new
E: Sub-process /usr/bin/dpkg returned an error code (1)
Steps to an easy upgrade:
1) pre-configure the new amavisd-new configuration files before the upgrade (in a staging area)
2) stop amavisd-new 20030616p10
3) mv /etc/amavis/amavisd.conf to help the new package install without error
4) install the new version and allow the new package to overwrite any files it finds
5) copy the pre-configured files over the top of the provided files
6) reload amavisd-new

First back up current files:
mkdir /etc/ambackup
cp -R /etc/amavis/ /etc/ambackup/amavis-backup
cp /etc/init.d/amavis /etc/ambackup/amavis-init-20030616
cp /usr/sbin/amavisd-new /usr/sbin/amavisd-new-20030616


Then create a staging area:
mkdir /etc/amstage
cd /etc/amstage
wget http://www200.pair.com/mecham/debian/2.4.1/01-debian
wget http://www200.pair.com/mecham/debian/2.4.1/05-domain_id
wget http://www200.pair.com/mecham/debian/2.4.1/05-node_id
wget http://www200.pair.com/mecham/debian/2.4.1/15-av_scanners
wget http://www200.pair.com/mecham/debian/2.4.1/15-content_filter_mode
wget http://www200.pair.com/mecham/debian/2.4.2/20-debian_defaults
wget http://www200.pair.com/mecham/debian/2.4.2/25-amavis_helpers
wget http://www200.pair.com/mecham/debian/2.4.1/30-template_localization
wget http://www200.pair.com/mecham/debian/2.4.1/50-user


Please note that spam and virus checks are disabled in the default 2.4.2 configuration. Enable them as required by reading and editing 15_content_filter_mode.

Now the task at hand is to read through all the files in this directory to familiarize yourself with the new format of some of the configuration variables and then do your best to convert your old settings (in /etc/amavis/amavisd.conf) to the newer style of settings in those files (without messing up some of the required settings). Note that the files are read in order so it is likely that settings placed in the 50_user file will override settings (of the same name) in previous files. Therefore, the idea is to leave most files alone as much as possible and place your settings in the 50_user file. Also note that if you have configured amavisd-new to use non English notification templates you will need to revert to using en_US templates as the English templates are the only ones provided with the package.

Some things should not be carried over, such as this section:
$file   = 'file';   # file(1) utility; use 3.41 or later to avoid vulnerability

$gzip   = 'gzip';
$bzip2  = 'bzip2';
$lzop   = 'lzop';
$uncompress = ['uncompress', 'gzip -d', 'zcat'];
$unfreeze   = ['unfreeze', 'freeze -d', 'melt', 'fcat'];
$arc        = ['nomarch', 'arc'];
$unarj      = ['arj', 'unarj'];  # both can extract, arj is recommended
$unrar      = ['rar', 'unrar'];  # both can extract, same options
$zoo    = 'zoo';
$lha    = 'lha';
$cpio   = 'cpio';   # comment out if cpio does not support GNU options
I suggest searching for " amavisd-new-20040701 " in the release notes and reading about the most important changes to the 2.x.x series of amavisd-new. Assuming you have carefully edited the new configuration files you can now perform the upgrade (remember to tell dpkg to replace files when prompted):
amavisd-new stop
mv /etc/amavis/amavisd.conf /etc/amavis/amavisd.conf-20030616
apt-get install amavisd-new

If you are using clamav-daemon (clamd), and it is running as the clamav user, you will probably want to add the clamav user to the amavis group:
gpasswd -a clamav amavis

Hopefully it installed without error. If it did, and it started up, be aware that at this point virus and spam scanning is disabled. Let's fix it by copying over our preconfigured configuration files:
amavisd-new stop
mv /etc/amavis/conf.d /etc/amavis/conf.d-original
cp -r /etc/amstage /etc/amavis/conf.d
amavisd-new start


If you customized notification templates or are using non English templates your changes have been lost. You get a new set of 2.4.2 compatible templates in the /etc/amavis/en_US directory. Your old templates should be in backup files in the /etc/amavis directory. You will probably want to visit the files in /usr/share/doc/amavisd-new for documentation.

Gary V
mr88talent at yahoo dot com
03 MAY 2007