Conversion Debian Cyrus 2.1 to 2.2, experiences

Paul van der Vlis paul at vandervlis.nl
Thu Aug 7 04:51:21 EDT 2008


Hello.

I did an upgrade from Cyrus 2.1 tot 2.2, both packages in Debian Etch.
The documentation is a bit poor, that's why I wrote about my
experiences. Maybe somebody else likes it.

And I would like to hear critics, because I have to upgrade another 8
machines...  But I have no problems with the 2 machines I did this way.


First I stopped the services:
/etc/init.d/postfix stop
/etc/init.d/cyrus21 stop

check if it worked:
ps ax|grep cyr; ps ax|grep imapd; ps ax|grep pop3d
kill open processes.

close the firewall for pop3 and IMAP.
close local mailprogramms
close webmail

make backups:
cp -a /var/lib/cyrus /var/lib/cyrus-backup
cp -a /var/spool/sieve /var/spool/sieve-backup
cp -a /usr/lib/cyrus/ /usr/lib/cyrus-backup
cp -a /var/spool/cyrus /var/spool/cyrus-backup
The last one takes long...

remove packages:
apt-get remove cyrus21-common cyrus21-admin cyrus21-clients
libcyrus-imap-perl21
dpkg --get-selections | grep cyrus

backup config-files:
mv /etc/imapd.conf /etc/imapd.conf.backup
mv /etc/cyrus.conf /etc/cyrus.conf.backup

install packages:
apt-get install cyrus-imapd-2.2 cyrus-admin-2.2 cyrus-clients-2.2
libcyrus-imap-perl22 db4.2-util cyrus-pop3d-2.2

choose to overwrite cyrus.conf and imapd.conf (I wonder why this files
are still there).

You will see this and Cyrus will not start.
---------
Database backends have changed!

Comparison between /usr/lib/cyrus/cyrus-db-types.txt and
/usr/lib/cyrus/cyrus-db-types.active shows that database backends for
Cyrus IMAPd have been changed.


This means that those databases for which the database backends changed
might need to be converted manually to the new format, using the
cvt_cyrusdb(8) utility.
Please refer to /usr/share/doc/cyrus-common-2.2/README.Debian.database
for more information.  Do not start cyrmaster until you have converted
the databases to the new format.
---------

edit /etc/imapd.conf, in my case I had to do this:
admins: cyrus
sasl_mech_list: PLAIN
sasl_minimum_layer: 0
sasl_pwcheck_method: saslauthd

then convert the databases (on one line):
find /var/lib/cyrus/ -name \*.db -print -exec /usr/bin/db4.2_upgrade {} \;

this was my output:
----------
/var/lib/cyrus/mailboxes.db
db_upgrade: /var/lib/cyrus/mailboxes.db: unrecognized file type
db_upgrade: DB->upgrade: /var/lib/cyrus/mailboxes.db: Invalid argument
/var/lib/cyrus/tls_sessions.db
/var/lib/cyrus/deliver.db
/var/lib/cyrus/db.backup1/mailboxes.db
db_upgrade: /var/lib/cyrus/db.backup1/mailboxes.db: unrecognized file type
db_upgrade: DB->upgrade: /var/lib/cyrus/db.backup1/mailboxes.db: Invalid
argument
/var/lib/cyrus/db.backup2/mailboxes.db
db_upgrade: /var/lib/cyrus/db.backup2/mailboxes.db: unrecognized file type
db_upgrade: DB->upgrade: /var/lib/cyrus/db.backup2/mailboxes.db: Invalid
argument
----------

So "mailboxes.db" did not work, but the other databases did.

Because I use sieve, I also had to convert this to bytecode:
su cyrus
/usr/lib/cyrus/upgrade/masssievec /usr/lib/cyrus/bin/sievec /etc/imapd.conf
exit

this was the output:
--------
you are using /var/spool/sieve as your sieve directory.
processing user ....
processing user ....
processing user ....
(...)
----------

Then I studied the texts in UPGRADE.Debian and README.Debian.database
and "upgrading from previous versions" from Cyrus, and I even wrote a
little script to convert mailboxes.db and seen.db, but in practice every
mailbox says: "Warning: apparently empty database converted.". So in
pratice I did nothing to convert the seen.db and the mailboxes.db (I
used the backup to go-back).

I will add the script on the end of this message, maybe it can be good
to mass-convert databases in another situation.

Then copy the cyrus-db-types.active out of the way (one line):
mv /usr/lib/cyrus/cyrus-db-types.active
/usr/lib/cyrus/cyrus-db-types.active.old

Reconfigure the package:
dpkg-reconfigure cyrus-common-2.2
It says:
-------
Stopping Cyrus IMAPd: .
Creating/updating cyrus user account...
The user `cyrus' is already a member of `sasl'.
Creating cyrus control directories in /var/lib/cyrus...
Creating partition spool /var/spool/cyrus/mail...
Creating partition spool /var/spool/cyrus/news...
Trying to optimize Cyrus partitions, edit /etc/default/cyrus2.2 to
disable...
Starting Cyrus IMAPd: cyrmaster.
---------

After this, Cyrus is running again.

I did a reconstruct (but it takes time, you can also do it when
everything is ready).
su cyrus
cd /var/spool/cyrus
/usr/sbin/cyrreconstruct -r user.*
exit

Then I tested the IMAP, without Postfix. Maybe you will need to open the
firewall for your IP. I did this, because I can go back to the backup
situation now. Once I start Postfix or open IMAP or POP3 for the public,
I cannot go back.

In first instance I found Cyrus 2.2 not so fast as 2.1, but after some
time testing it became better.

After the tests, start postfix, webmail, change your firewall.

and remove backups:
rm -r/var/lib/cyrus-backup
rm -r /var/spool/sieve-backup
rm -r /usr/lib/cyrus-backup
rm -r /var/spool/cyrus-backup
rm /etc/imapd.conf.backup
rm /etc/cyrus.conf.backup

With regards,
Paul van der Vlis.


the script I did not use, at the end. But maybe useable in another
situation:
---------
su cyrus
cd /
mv /var/lib/cyrus/mailboxes.db /var/lib/cyrus/mailboxes.db.old \
  /usr/sbin/cvt_cyrusdb /var/lib/cyrus/mailboxes.db.old flat \
  /var/lib/cyrus/mailboxes.db skiplist
chown cyrus:mail /var/lib/cyrus/mailboxes.db
rm -f /var/lib/cyrus/mailboxes.db.old

find /var/lib/cyrus/ -name \*.seen -print -exec mv {} {}.old \; \
  -exec /usr/sbin/cvt_cyrusdb {}.old flat {} skiplist \; \
  -exec chown cyrus:mail {} \;
find /var/lib/cyrus/ -name \*.seen.old -print -exec rm {} \;
--------

-- 
http://www.vandervlis.nl/



More information about the Info-cyrus mailing list