ctl_cyrusdb Segmentation fault
May 2019
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
This site is an effort to share some of the base knowledge I have gathered through all this years working with Linux, FreeBSD, OpenBSD, Python or Zope, among others. So, take a look around and I hope you will find the contents useful.
Recent Entries
Recent Comments
Recent Trackbacks
OpenBSD (9 items)
BSD (0 items)
FreeBSD (19 items)
Linux (3 items)
Security (3 items)
Python (22 items)
Zope (13 items)
Daily (144 items)
e-shell (9 items)
Hacks (14 items)
PostgreSQL (3 items)
OSX (8 items)
Nintendo DS (0 items)
enlightenment (0 items)
Apache (3 items)
Nintendo Wii (1 items)
Django (24 items)
Music (12 items)
Plone (7 items)
Varnish (0 items)
Lugo (2 items)
Sendmail (0 items)
europython (7 items)
Cherokee (1 items)
self (1 items)
Nature (1 items)
Hiking (0 items)
uwsgi (0 items)
nginx (0 items)
cycling (10 items)
Networking (1 items)
DNS (0 items)

Syndicate this site (XML)

RSS/RDF 0.91

23 abril

ctl_cyrusdb Segmentation fault

upgrade cyrus imapd from 2.2.13 to 2.3.13

I would like to share this with everyone else out there using Cyrus imapd as their main pop3/imap server.

These week I'm involved in a mail server migration. This server runs Sendmail (MTA), Cyrus imapd (pop3/imap), OpenLDAP (as the authentication backend), Cyrus sasl (as the connector between sendmail, cyrus and openldap) and Bogofilter (as the anti-spam solution). It has been running smoothly for the last one-and-a-half year (about 5000 email accounts) but some weeks ago we decided to move the server from its current location to another provider.

As you can imagine, this is a dedicated server in a hosting company, so we couldn't move the server from one location to another. We just picked up a better one (this move means a big hardware upgrade) and we install FreeBSD 7 (what else?) on it.

First step in the migration was to install every package needed. As sendmail is in the default FreeBSD base, I installed:

  • openldap-client-2.4.13
  • openldap-server-2.4.13
  • cyrus-imapd-2.3.13
  • cyrus-sasl-2.1.22_2
  • cyrus-sasl-saslauthd-2.1.22_1
  • bogofilter-1.1.7_1
  • milter-bogom-1.9.2

I'll not go in detail through the process of setting up the whole thing, but the cyrus imapd part of it. This was my first migration between different servers, trying to mirror every piece of data from one server to another and, to add some more ingredients to the recipe, I switch cyrus from version 2.2.13 to 2.3.13.

Configuration files (cyrus.conf, imapd.conf) were easy to migrate, I just copied them using ssh from one server to another.

Then I had to migrate both /var/imap and /var/spool/imap (the first one is the place where cyrus saves mailbox information, metadata and so on, while the second one is the place where emails are really saved). As I've told you, this server holds near 5000 email accounts (no quota!!) so you can imagine the size of /var/spool/imap. That, and the fact that the server was running while I did the first copy, pointed me to rsync to perform the task. I activated temporaly root access through ssh to my old server and, from the new one, issued:

/usr/local/bin/rsync -vzaHe ssh --delete root@ /var/spool/imap/
/usr/local/bin/rsync -vzaHe ssh --delete root@ /var/imap/

Important: do not forget to add the H option, as it will force rsync to copy hard links too.

It took some time to sync the /var/spool/imap directory. Once it has finished, I checked the permissions on both directories (should be owned by cyrus:cyrus) and tried to start the imapd server:

/usr/local/etc/rc.d/imapd restart

just to notice this in /var/log/messages:

Apr 23 12:15:17 ns205739 kernel: pid 13988 (ctl_cyrusdb), uid 60: exited on signal 11

and this in /var/log/debug:

Apr 23 12:15:17 ns205739 master[13988]: about to exec /usr/local/cyrus/bin/ctl_cyrusdb

The imapd server was trying to check its databases before trying to run imap, pop and the rest of the services, and there was a problem about it. Then I did try to run ctl_cyrusdb directly on a shell, as root:

ns205739# /usr/local/cyrus/bin/ctl_cyrusdb -r
Segmentation fault

A really ugly message, isn't it?

At first I thought it could be a problem about a mismatch in the version of berkeley db used by cyrus to generate the needed .db files in /var/imap, but soon I realized myself both servers are running the same version of bdb 4.1, but you should check it at first, because it is usual to find such a problem when working with cyrus servers, just use ldd:

ns205739# ldd /usr/local/cyrus/bin/ctl_cyrusdb|grep libdb
        libdb41.so.1 => /usr/local/lib/libdb41.so.1 (0x800e9d000)

and check if there is the same version of the library in both servers:

prunus# ldd /usr/local/cyrus/bin/ctl_cyrusdb|grep libdb
        libdb41.so.1 => /usr/local/lib/libdb41.so.1 (0x281bb000)

Then I took a really loooong ride through the Internet, using google to search for this issue (or similar ones), just to find a lot of topics about:

  • using ctl_mboxlist to export/import the mailboxes between servers - DIDN'T WORK
  • using reconstruct to rebuild the mailboxes.db file - DIDN'T WORK
  • using some tools from berkeley db to update/rebuild the .db files within */var/imap** - DIDN'T WORK.

Luckily for me, I just found the solution: remove the db.backup* directories from /var/imap. After that, both ctl_cyrusdb and everything else began to work smoothly on this new server.

The db.backup directories are created by cyrus itself, from time to time, and contain copies of the mailboxes.db files, just in case something goes wrong and you need to get them back. But, for some reason, the copy of ctl_cyrusdb in the new server didn't like the backups from the old one.

Anyone with a nice easy-to-understand reason for that?

Posted by wu at 20:42 | Comments (1) | Trackbacks (0)
<< Que lio tiene la gente con los refranes... | Main | When one second seems one hour... >>
Re: ctl_cyrusdb Segmentation fault

I setup a fresh Cyrus 2.3.13 server a few months back, and had a hell of a time getting it to work properly with BDB. It puzzled me to no end why it was working fine on one server as another with [what I thought was] an identical setup. Turned out the server that was working had BDB 4.2 installed, while the new one used the default 4.1. Installing BDB 4.2 and then recompiling Cyrus against 4.2 did the trick! I submitted a patch to the port maintainer, as I was able to consistently reproduce the problem even on subsequent fresh installations, but it doesn't look like it's been accepted yet.

Posted by: Patrick Gibson at agosto 15,2009 22:51
Re: ctl_cyrusdb Segmentation fault

(I should mention this is with FreeBSD 7.2.)

Posted by: Patrick Gibson at agosto 15,2009 22:53
Re: ctl_cyrusdb Segmentation fault

delete mbox by hands and reconstruct after

Posted by: vit1967 at abril 14,2011 07:52
Please send trackback to:http://blog.e-shell.org/153/tbping
There are no trackbacks.
Post a comment