Articles May 17, 2005 at 9:28 am

Repairing Cyrus in 10.3.9

Many people are having sudden problems with Cyrus in 10.3.8, 10.3.9, and 10.4. A corruption of mailboxes.db leaves users unable to access any emails at all.

Read on for how to work around this. Following Apple’s steps leaves email that is in the mail spools, appears in SquirrelMail, yet refuses to appear in Mail.app, and throws an error in Entourage.

Fear not! This thread at the Apple discussion board detailes exactly what the problem is, and one fellow named James Goodlet even posted a utility to fix your emails.

It turns out that Apple changed a function in reconstruct that sets an internal timestamp. This timestamp is supposed to be the time the email arrived. However, Apple’s change makes the function set the timestamp to 0, a state that email clients cannot handle.

Here is how to fix it:

1) Follow Apple TIL Article 107996 by executing these commands in the Terminal.

su root
mv /var/imap /var/imap.old
mkdir /var/imap
/usr/bin/cyrus/tools/mkimap
chown -R cyrus:mail /var/imap
sudo -u cyrus /usr/bin/cyrus/bin/reconstruct -i

This will result in a fresh mailboxes.db for you to fix.

2) Fix the internal timestamps of the mail store:


curl -o http://www.sussex.ac.uk/~jamesg/reconstruct.zip
open reconstruct.zip
sudo mv reconstruct_for_10_3_9_only /usr/bin/cyrus/bin
sudo chmod ugo+x /usr/bin/cyrus/reconstruct_for_10_3_9_only
sudo -u cyrus /usr/bin/cyrus/bin/reconstruct_for_10_3_9_only -r -f user

These reconstruct commands will take quite a while as they parse through every email in your mailstore. While you wait, be sure to post a quick thank you to James.

No Comments

  • Hi Jon,

    Thanks for finding this, I have been one of those hitting my head against a
    wall getting nowhere for the last 3 weeks. There are just a few changes that
    should probably be mentioned.

    In the file that is downloaded from
    http://www.sussex.ac.uk/~jamesg/reconstruct.zip
    is now both a full replacement version of reconstruct for 10.3.9 as well as the
    ‘kludge’ version (I think these were added soon after you posted this article).
    For those on Tiger they have also included the 10.4 copy in
    there as well.

    To keep things simple you can now replace the apple reconstruct with the
    modified version and then just follow the original tech notes.

    su root
    mv /var/imap /var/imap.old
    mkdir /var/imap
    /usr/bin/cyrus/tools/mkimap
    chown -R cyrus:mail /var/imap
    sudo -u cyrus /usr/bin/cyrus/bin/reconstruct -i

    Before you do this (as is mentioned in the Apple Discussion thread mentioned
    above), it is a good idea to keep the old reconstruct in place. I did this with
    the following commands.

    su root
    cd /usr/bin/cyrus/bin
    mv reconstruct reconstruct.old
    mv /Users/{admin user}/reconstruct_versions/10.3.9/
    replacement_for_apple_version/reconstruct /usr/bin/cyrus/bin/
    chown root:wheel reconstruct

    I did this on a 10.3.9 server (with all current patches) and it has
    worked a treat. BIG thanks to James Goodlet (and also Robb Allan). I would
    also recommend reading the Discussion thread before doing this as it does
    give you a much better idea of what is going on.

    • I had the same problem an thanx to Jon I could fix it.

      I have one mailbox that I could not repair. I just have the local cached mailbox
      folder. If I try to rebuild it by setting up an new account in Mail. I just get the
      empty IMAP folders. The local mail have the same corrupt timestamp as Jon
      mentioned. Is there a way to rebuild the mailbox like with JonĀ“s recunstruct ?

      Any comment is really appreciated.

      The mailbox is very important.. 2.9 Gig

  • Thanks John – one small thing though, not sure if it’s do with the redirect at
    James’ university but I had problems with the link – I used:

    curl -O http://www.sussex.ac.uk/Users/jamesg/reconstruct.zip

    instead.

    PS. I’m using 10.4 so not sure if that’s the difference either, haven’t had chance
    to check!

    • Mr Goodlet’s reconstruct tool is no longer available.
      I contacted the author and got a very nice reply that Mr Goodlet allowed me to post here:

      …… I withdrew my hacked version of ‘reconstruct’ when I managed to get Apple to accept the problem and produce their own fix. The Apple software update called something like ‘Update for mail server 10.3.9’ is just a corrected version of ‘reconstruct’ which includes all the fixes I added. You should either apply this software update to your system and run ‘reconstruct’ as per the Apple instructions, or (if for some reason you cannot apply that update) you could download the update manually from Apple’s support web site, and extract the ‘reconstruct’ program for it — it is quite safe to use it with either server 10.3.9 or 10.3.8.

      Hope this helps.

Leave a reply

You must be logged in to post a comment.