Cyrus IMAP dies with “User defined signal 1” on Leopard Server

Code and wisdom in this article have not been kept up-to-date. Use them at your own peril.

If your are running Leopard and your cyrus IMAP server is unable to start up due to a “User defined signal 1”, you can use the following workaround:

  • Install developer tools on your server, if you haven’t already
  • Add a file in /etc/cyrus.gdb with the following contents:
handle SIGUSR1 nostop print nopass
run -l 256
  • Copy /System/Library/LaunchDaemons/edu.cmu.andrew.cyrus.master.plist to /Library/LaunchDaemons/edu.cmu.andrew.cyrus.master.plist
  • In /Library/LaunchDaemons/edu.cmu.andrew.cyrus.master.plist, find the following code
<code>
<key>Program</key>
<string>/usr/bin/cyrus/bin/master</string>
<key>ProgramArguments</key>
<array>
	<string>master</string>
	<string>-l</string>
	<string>256</string>
</array>
</code>
  • Change it to
<code>
<key>Program</key>
<string>/usr/bin/gdb</string>
<key>ProgramArguments</key>
<array>
	<string>gdb</string>
	<string>-x</string>
	<string>/etc/cyrus.gdb</string>
	<string>/usr/bin/cyrus/bin/master</string>
</array>
</code>
  • Unload the system launchd plist and load yours
sudo launchctl unload -w /System/Library/LaunchDaemons/edu.cmu.andrew.cyrus.master.plist
sudo launchctl load -w /Library/LaunchDaemons/edu.cmu.andrew.cyrus.master.plist

What’s going on here?

To query the status of your cyrus master, servermgrd sends it the USR1 signal. Unfortunately, cyrus master doesn’t install a handler for that signal until after it’s done starting up. Therefore, if the master takes a while to start up, servermgrd is very likely to send the signal before the master is ready to handle it, causing the master to fail to start up. If this happens enough times, launchd will eventually give up on trying to start your mail server.