Friday, March 30, 2007

cyrus imapd crash

WARNING, EXTREMELY BORING TECHNICAL STUFF BELOW. READ ON YOUR OWN PERIL.

This post is mainly for system administrators out there needing information on how to fix a cyrus imapd index/header corruption. I think my MS Outlook messed up the cyrus index headers for my e-mail account when I accidentally clicked 'Undo Delete' on a message that was already deleted and purged from the INBOX.

Since then, on my Outlook, it would give me this error: "Failed to update headers." I wasn't able to delete or purge messages from my INBOX. I was able to do normal functions on my TRASH folder.

LOG ERRORS FROM /var/log/maillog

Mar 29 19:29:20 c2000 imap[21893]: open: user email@email.com opened INBOX
Mar 29 19:29:21 c2000 master[25621]: process 21893 exited, signaled to death by 11
Mar 29 19:29:21 c2000 master[25621]: service imap pid 21893 in BUSY state: terminated abnormally

Also got these...

Mar 29 19:57:54 c2000 last message repeated 2 times
Mar 29 19:57:55 c2000 imap[22490]: SQUAT failed to open index file
Mar 30 19:57:55 c000 imap[22490]: SQUAT failed


HOW I FIXED IT WITH WEBMAIL
1. I went to my webmail and I was able to access all of my messages. I use SquirrelMail. I moved all of my messages and moved it into the TRASH folder, which I knew was not corrupted.

2. I accessed it with my MS Outlook and all my INBOX messages were gone (as expected). I sent two test messages to myself and it showed up. I then deleted those two messages and purged it and the action was successful. That means I didn't get the error messages anymore.

3. I went ahead and moved back my messages from my TRASH folder into the INBOX. Mission success!

HOW I FIXED IT WITHOUT WEBMAIL
1. If you don't have webmail/SquirrelMail, you could also manually do this by going to your mail folder and manually moving messages. My mail folder was: /var/spool/imap/domain/e/email.com/d/user/don

2. I created a /backup folder.

3. I moved all of my messages to the /backup folder. The messages are usually named as 5 digit numbers. I saw most of my messages numbered as 4xxxx so I just 'mv 4* /backup'.

4. I went back to MS Outlook and accessed my INBOX and I was able to without any errors.

ADDITIONAL NOTES
This solution worked for me and I'm blogging about it just in case it happens again -- at least I know what to do. If it still gives you problem, please refer to the manual or go to online discussion boards and ask some admins.

No comments: