Hi,

after a few tests I can reproduce error on test environment.

mailboxes.db are broken only if I make connections to cyrus during upgrade. I think, that some postinst restarts cyrus without all needed packages upgraded or some other coincidence.

But repair is simple - copy mailboxes.db from backup and restart cyrus :-). This will run "ctl_cyrusdb -r" and repair mailboxes.db.

Folders, that was badly created during upgrade, will be still empty and you must run recover on them. All mails will be flagged as unseen. If you use "delete_mode: delayed", users will have "delayed deleted" mails in folders.

If you can repair mailboxes.db on different server (without physical mailboxes in /var/lib/cyrus),  cyrus will include only folders, that have uid included in mailboxes.db. Folders without uid you can see: /usr/lib/cyrus/bin/cvt_cyrusdb /var/lib/cyrus/mailboxes.db twoskip /tmp/aaa.txt flat; cat /tmp/aaa.txt | egrep -a -v '( I |\%\(I)'
But you can add uid before upgrade with:
/usr/lib/cyrus/bin/reconstruct -I
and this mailboxes.db will include all folders if you run it on test machine without physical mailboxes in /var/lib/cyrus.

Prevention is block imap/pop3 in firewall during upgrade.

Regards,
Petr Jurasek

Dne 26. 08. 23 v 5:13 Yadd napsal(a):
On 8/25/23 16:13, Petr Jurášek wrote:
Hi,

we had the same problem. After upgrade was created only mailboxes, which had uniqueid in database. We can check it in dump: /usr/lib/cyrus/bin/cvt_cyrusdb /var/lib/cyrus/mailboxes.db twoskip /tmp/aaa.txt flat;
folder without uniqueid doesn't have "I" in dump /tmp/aaa.txt.

It can be repaired _before_ upgrade with:
/usr/lib/cyrus/bin/reconstruct -I
...
pokus.cz!test: update uniqueid from header (null) => 7f54216e52e02e7c
...

I hope, that this repaired mailboxes.db can be upgraded without problem and will check it in few days.

I copy mailboxes.db without "reconstruct -I" to test bookworm system and run "/usr/lib/cyrus/bin/ctl_cyrusdb -r". After that:
/usr/lib/cyrus/bin/ctl_mboxlist -d | wc -l
458
I run  "reconstruct -I" on test source system and copy to test bookworm system, and run "/usr/lib/cyrus/bin/ctl_cyrusdb -r". After that:
/usr/lib/cyrus/bin/ctl_mboxlist -d | wc -l
2280



And there is typo in postinst in cyrus-common package (you must test zero size and compare version in variable $2, not $1):
===
case "$1" in
     configure)
         # Refuse to update if previous version is lower than 3.2.6-2+deb11u2~          if [ -z "$1" ] || $(dpkg --compare-versions $1 lt '3.2.6-2+deb11u2~'); then              echo "You must update cyrus-imapd to at least version 3.2.6-2+deb11u2~" >&2              echo "before updating it to version 3.6.x and run it, else your mailboxes" >&2
             echo "may be corrupted" >&2
             exit 1
         fi
===

Regards,
Petr Jurasek

Hi,

thanks for the fix. Did you get this issue when upgrading from 3.2.6-2+deb11u2 or upgrading from 3.2.6-2 ?



Reply via email to