reconstruct and seen db on 2.3.1

Simon Matter simon.matter at ch.sauter-bc.com
Fri Apr 7 12:13:45 EDT 2006


> Greets.
>
> I'm using cyrus-imapd-2.3.1-2.1and we had a major server crash recently
> which forced us to recover all mailboxes from tape. We had no problems
> restoring /var/spool/imap/ and /var/lib/imap and afterwards ran
> reconstruct -rf on all mailboxes to get them into a sane state. We did
> all this before allowing new mail or users on the system.
>
> Today one account reported that all incoming mail was marked as \Seen by
> default. I checked out his account and there were no sieve scripts.
> Because the user was using fetchmail the simple fix was to remove the
> account.seen skiplist db and have cyrus recreate it.
>
> I really wondering though why the reconstruct command didn't fix up the
> seen db to start with. I have a copy of the account.seen db around if
> anyone can suggest some tests to do.

That's really a weak point. It has also happened several times to me that
a mailbox had corrupt seen db and the only way I found out was to wait
until the mailbox was in use and I found a DBERROR in maillog. Once
recognized, I have usually been able to easily fix the seen db which the
script below (which is really an ugly hack).
I really whish there was a tool to detect and fix inconsistencies in
skiplist dbs.

Simon

[root at xxl ~]# cat /usr/share/doc/cyrus-imapd-2.3.3/contrib/skipfix.sh
#!/bin/sh

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# This script can safely be run as root, it will reexec itself as user
# cyrus if needed.

if [ "$#" -ne 2 ]; then
  echo "usage: $0 [hex errorcode] [filename]"
  exit 1
fi

# fallback to su if runuser not available
if [ -x /sbin/runuser ]; then
  RUNUSER=runuser
else
  RUNUSER=su
fi

# force cyrus user for security reasons
if [ ! $(whoami) = "cyrus" ]; then
  exec $RUNUSER - cyrus -c "cd $PWD < /dev/null ; sh $0 $*"
fi

HEXVAL=$1
INFILE=$2

# files get mode 0600
umask 166

DECVAL=$(echo "ibase=16; $HEXVAL" | bc)

dd if=$INFILE of=${INFILE}.fixed bs=1 count=$DECVAL 2> /dev/null
mv -vf ${INFILE}.fixed $INFILE


More information about the Info-cyrus mailing list