betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

27 July 2005

OS X Server 10.3 Cyrus Mailserver Trouble?

Rebuilding the mail database might help
 

The Cyrus mail server on some Mac OS X server machine acted up yesterday. It turned out the Cyrus DB file was damaged, something that happens sometimes it seems. I searched the web for the error message and after a while came up with something. This morning I rebuilt the database and service is back up. Read on for the description...


The error messages looked something like this:

Jul 27 10:02:34 localhost imap[2658]: DBERROR db4: fatal region error detected; run 
recovery
Jul 27 10:02:34 localhost imap[2658]: DBERROR: dbenv->open '/var/imap/db' failed: 
DB_RUNRECOVERY: Fatal error, run database recovery
Jul 27 10:02:34 localhost imap[2658]: DBERROR: init() on berkeley
Jul 27 10:02:34 localhost imap[2658]: DBERROR db4: environment not yet opened
Jul 27 10:02:34 localhost imap[2658]: DBERROR: opening /var/imap/mailboxes.db: Invalid 
argument
Jul 27 10:02:34 localhost imap[2658]: DBERROR: opening /var/imap/mailboxes.db: cyrusdb 
error
Jul 27 10:02:34 localhost imap[2658]: Fatal error: can't read mailboxes file
Jul 27 10:02:34 localhost master[499]: service imap pid 2658 in READY state: terminated 
abnormally
Jul 27 10:02:34 localhost imap[2666]: DBERROR db4: fatal region error detected; run 
recovery
Jul 27 10:02:34 localhost imap[2666]: DBERROR: dbenv->open '/var/imap/db' failed: 
DB_RUNRECOVERY: Fatal error, run database recovery
Jul 27 10:02:34 localhost imap[2666]: DBERROR: init() on berkeley
Jul 27 10:02:34 localhost imap[2666]: DBERROR db4: environment not yet opened
Jul 27 10:02:34 localhost imap[2666]: DBERROR: opening /var/imap/mailboxes.db: Invalid 
argument
Jul 27 10:02:34 localhost imap[2666]: DBERROR: opening /var/imap/mailboxes.db: cyrusdb 
error
Jul 27 10:02:34 localhost imap[2666]: Fatal error: can't read mailboxes file
Jul 27 10:02:34 localhost master[499]: service imap pid 2666 in READY state: terminated 
abnormally
The ugly thing was that since SMTP was still running, the server was accepting incoming mails, but returning them later. Not nice. Stopping the mail services all together is a better option in this situation.

Googling around found me some hints, and in the end the Apple Technote: Mac OS X Server 10.3: Reconstructing cyrus mailboxes. Apparently 10.4 Server has a nice and shiny button for this, but for 10.3 Server the procedure can be done in the shell (after stopping mail services):

$ 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
Read all the technote! Don't blame me if you mess it up, etc. etc.

Posted by betabug at 10:19 | Comments (5) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< helmug.gr down again | Main | Plone NavTreePortlet Sortorder Problem and Workaround >>
Comments
Re: OS X Server 10.3 Cyrus Mailserver Trouble?

Worked like a charm, thank you, and Google and Apple. :)

Posted by: matx at July 21,2006 20:45
Re: OS X Server 10.3 Cyrus Mailserver Trouble?

10.4's shiny button didn't work, but your procedure worked like a charm with the exception that the user name is now cyrusimap rather than cyrus for the sudo and chown commands

Posted by: Jerry at July 29,2007 00:44
Re: OS X Server 10.3 Cyrus Mailserver Trouble?

To stop mail services: serveradmin stop mail and in the end start it again with serveradmin start mail. Also man serveradmin.

Posted by: betabug at November 03,2007 19:47
Re: OS X Server 10.3 Cyrus Mailserver Trouble?

See also mailbfr, which is a script that does the rebuilding. Both with this script and the procedure above, the *big* problem is that users mail will revert to "unread" state. Cyrus just suxx IMHO.

Posted by: betabug at April 02,2008 08:00
Re: OS X Server 10.3 Cyrus Mailserver Trouble?

Thanks a lot! I am not a sysadmin but a programmer but my boss keeps getting himself into trouble with his server and doesn't have the money for a real sysadmin so...

Posted by: Peter Andrews at May 15,2008 18:57
Trackbacks
You can trackback to: http://betabug.ch/blogs/ch-athens/153/tbping
There are no trackbacks.
Leave a comment