Upgrading Cyrus IMAPd from version 2.1 to 2.2
Upgrading Cyrus IMAPd on a sarge box can be little delightful. In
this case the installed version is 2.1.18-1+sarge2, i.e. the last one
distributed in sarge. The plan is to upgrade to version 2.2 that is
distributed via sarge-backports.
The Debian maintainer thankfully documented most steps required to upgrade form version 2.1 to
version 2.2 which includes a move from Berkeley DB 3.2 to Berkeley DB
4.3. The plan includes to convert deliver.db and
mailboxes.db with the inhouse utility
cvt_cyrusdb. However, the proposed command
/usr/sbin/cvt_cyrusdb /var/lib/cyrus/mailboxes.db db3 /var/lib/cyrus/temp.db flat fatal error: unknown old backend
only results in the error message above. This way no upgrade to
the new version is possible. Upgrading the DB file with the command
db4.3_upgrade doesn't work either. As mentioned the file
tls_sessions.db is not important and thus can be removed
and reconstructed automatically.
The other file deliver.db can be treated the same as
it only contains message ids of received mails. Thus, a removed
database will only result in potentially duplicated mail for the
users. In many cases this is acceptable if that's the price for the
upgrade.
The third file, however, mailboxes.db must not be
deleted. It contains the names of all mailboxes Cyrus maintains
including new folders the users have created. Quite important
information, it seems.
Since converting the DB files to the new format doesn't seem to be
possible in an easy way the file has to be regenerated from scratch.
Trashing it and re-creating all mailboxes by hand with the
cyradm utility may work for systems with only very few
mailboxes, but is not possible for large sites.
Fortunately, cyrus comes with a utility that can dump and restore
the mailbox file. The ctl_mboxlist command must be run
from the Cyrus user and dumps the database with the switch
-d. The resulting text file is used as input for the
program after the upgrade using the -u switch.
/usr/sbin/ctl_mboxlist -d > /tmp/mailboxes.txt [upgrade from 2.1 to 2.2] /usr/sbin/ctl_mboxlist -u < /tmp/mailboxes.txt
Afterwards Cyrus starts again and the IMAP daemon is up and running again.
