Urgent: Cyrus troube after upgrade

Matthias Wulkow matthias.wulkow at webpluseins.de
Tue Feb 16 11:03:52 EST 2010


Hello Patrick,

I didn't try yet to remove the deliver file (and stop/start cyrus) as 
users are using it and I would like to test as few as possible...

Regaring these errors, isn't maybe better to use lmtp instead of 
lmtpunix which requires this socket?

 From the cyrus.conf:
# at least one LMTP is required for delivery
# lmtp		cmd="lmtpd" listen="lmtp" prefork=0
lmtpunix	cmd="lmtpd" listen="/var/lib/imap/socket/lmtp" prefork=1

The socket file is there (I checked).

Here is the cyrus-imapd file:

#!/bin/bash
#
# chkconfig: - 65 35
# description: The Cyrus IMAPD master serves as a master process for the 
Cyrus \
#              IMAP and POP servers.
# config: /etc/cyrus.conf
# config: /etc/imapd.conf
# pidfile: /var/run/cyrus-master.pid

# author: (c) 2002,2009 - Simon Matter <simon.matter at invoca.ch>
# version: 2009052700

# Source function library
if [ -f /etc/init.d/functions ]; then
   . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
   . /etc/rc.d/init.d/functions
else
   exit 0
fi

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Detect our basename and instance name
# $INSTANCE is '2' if $BASENAME is 'cyrus-imapd2'
TMP_NAME=$0
TMP_PWD=$PWD
while [ -L $TMP_NAME ]; do
   if [ ${TMP_NAME/\/} != $TMP_NAME ]; then
     cd ${TMP_NAME%/*}
   fi
   INSTANCE=${TMP_NAME##*/}
   INSTANCE=${INSTANCE/*cyrus-imapd}
   TMP_NAME=$(readlink ${TMP_NAME##*/})
done
cd $TMP_PWD
declare -r BASENAME=${TMP_NAME##*/}${INSTANCE}
unset TMP_NAME
unset TMP_PWD

# instance config
CYRUSCONF=/etc/cyrus${INSTANCE}.conf
IMAPDCONF=/etc/imapd${INSTANCE}.conf
PIDFILE=/var/run/cyrus-master${INSTANCE}.pid
LOCKFILE=/var/lock/subsys/${BASENAME}

# make sure what we have is a valid instance
# and that config files are present
if [ -n "$INSTANCE" ]; then
   [ -L /etc/rc.d/init.d/${BASENAME} ] || exit 0
fi
[ -f $CYRUSCONF ] || exit 0
[ -f $IMAPDCONF ] || exit 0

# expand_config [path]
# handle "@include" sections from imapd style config file
expand_config() {
   while read line; do
     if printf "%s\n" "${line}" | grep -q '^@include:'; then
       expand_config "$( printf "%s\n" "${line}" | cut -d : -f 2- | sed 
-e 's/^ *//' )"
     else
       printf "%s\n" "${line}"
     fi
   done < $1
}

# get_config [config default]
# extracts config option from config file
get_config() {
   searchstr=$1
   if config=$(expand_config $IMAPDCONF | egrep "^$searchstr:"); then
     printf "%s\n" "$config" | cut -d : -f 2- | sed -e 's/^ *//'
   else
     echo $2
   fi
}

# default values
CONFIGDIRECTORY=$(get_config configdirectory /var/lib/imap${INSTANCE})
CYRUSMASTER=/usr/lib/cyrus-imapd/cyrus-master
QUIT_TIMEOUT=10

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

QUICK=0

# Source service configuration.
if [ -f /etc/sysconfig/${BASENAME} ]; then
   . /etc/sysconfig/${BASENAME}
else
   echo "${BASENAME}: configfile /etc/sysconfig/${BASENAME} does NOT 
exist !"
   exit 1
fi

RETVAL=0
RETVAL2=0

is_running() {
   RUNNING=1
   if [ -f $PIDFILE ]; then
     read CYRUS_PID < $PIDFILE
     if [ -n "$CYRUS_PID" ]; then
       ps -p $CYRUS_PID > /dev/null 2>&1
       RUNNING=$?
     fi
   fi
   return $RUNNING
}

start() {
   if is_running; then
     echo -n $"$BASENAME already running."
     false
     echo
   else
     if [ $QUICK -eq 0 ]; then
       echo -n $"Importing $BASENAME databases: "
       cd $CONFIGDIRECTORY
       $RUNUSER - cyrus -c "umask 166 ; INSTANCE=$INSTANCE 
/usr/lib/cyrus-imapd/cvt_cyrusdb_all > 
${CONFIGDIRECTORY}/rpm/db_import.log 2>&1" < /dev/null
       RETVAL=$?
       if [ $RETVAL -eq 0 ]; then
         success $"$BASENAME importing databases"
       else
         failure $"$BASENAME error importing databases, check 
${CONFIGDIRECTORY}/rpm/db_import.log"
       fi
       echo
     fi
     if [ $RETVAL -eq 0 ]; then
       echo -n $"Starting ${BASENAME}: "
       $CYRUSMASTER -C $IMAPDCONF -M $CYRUSCONF -p $PIDFILE -d 
$CYRUSOPTIONS 2>/dev/null 1>&2
       RETVAL=$?
       [ $RETVAL -eq 0 ] && success $"$BASENAME startup" || failure 
$"$BASENAME startup"
       echo
     fi
   fi
   [ $RETVAL -eq 0 ] && touch $LOCKFILE
   return $RETVAL
}

stop() {
   echo -n $"Shutting down ${BASENAME}: "
   if ! is_running; then
     echo -n $"$BASENAME not running."
     echo_failure
   else
     read CYRUS_PID < $PIDFILE
     kill -QUIT $CYRUS_PID > /dev/null 2>&1
     for ((QUIT=0; QUIT < $QUIT_TIMEOUT; QUIT++)); do
       if is_running; then
         sleep 1
       else
         break
       fi
     done
     if is_running; then
       kill -TERM $CYRUS_PID > /dev/null 2>&1
     else
       echo_success
     fi
     rm -f $PIDFILE
   fi
   RETVAL=$?
   if [ $QUICK -eq 0 ]; then
     if ! is_running; then
       echo
       echo -n $"Exporting $BASENAME databases: "
       cd $CONFIGDIRECTORY
       $RUNUSER - cyrus -c "umask 166 ; INSTANCE=$INSTANCE 
/usr/lib/cyrus-imapd/cvt_cyrusdb_all export > 
${CONFIGDIRECTORY}/rpm/db_export.log 2>&1" < /dev/null
       RETVAL2=$?
       if [ $RETVAL2 -eq 0 ]; then
         success $"$BASENAME exporting databases"
       else
         failure $"$BASENAME error exporting databases, check 
${CONFIGDIRECTORY}/rpm/db_export.log"
       fi
     fi
   fi
   echo
   [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
   return $RETVAL
}

restart() {
   stop
   start
}

reload() {
   if ! is_running; then
     echo -n $"$BASENAME not running."
     false
     echo
   else
     echo -n $"Reloading $BASENAME configuration: "
     read CYRUS_PID < $PIDFILE
     kill -HUP $CYRUS_PID > /dev/null 2>&1
     RETVAL=$?
     echo
   fi
   return $RETVAL
}

condrestart() {
   if [ -f $LOCKFILE ]; then
     restart
   fi
}

svcstatus() {
   if [ -f $PIDFILE ]; then
     read CYRUS_PID < $PIDFILE
     if ps -p $CYRUS_PID > /dev/null 2>&1; then
       echo $"$BASENAME (pid $CYRUS_PID) is running..."
       RETVAL=0
     else
       echo $"$BASENAME dead but pid file exists"
       RETVAL=1
     fi
   else
     if [ -f $LOCKFILE ]; then
       echo $"$BASENAME dead but subsys locked"
       RETVAL=2
     else
       echo $"$BASENAME is stopped"
       RETVAL=3
     fi
   fi
   return $RETVAL
}

case "$1" in
   start)
     start
     ;;
   stop)
     stop
     ;;
   restart)
     restart
     ;;
   reload)
     reload
     ;;
   condrestart)
     condrestart
     ;;
   status)
     svcstatus
     ;;
   quickstart)
     QUICK=1
     start
     ;;
   quickstop)
     QUICK=1
     stop
     ;;
   quickrestart)
     QUICK=1
     restart
     ;;
   *)
     echo $"Usage: $BASENAME 
{start|stop|restart|reload|condrestart|status|quickstart|quickstop|quickrestart}"
     RETVAL=1
esac

exit $RETVAL


Best regards,

MW

Am 16.02.10 16:53, schrieb Patrick Boutilier:
> On 02/16/2010 11:48 AM, Matthias Wulkow wrote:
>> Hello Adam,
>>
>> > If you just try to run "/usr/lib/cyrus-imapd/cyrus-master
>> > -C /etc/imapd.conf -M /etc/cyrus.conf -p /var/run/cyrus-master.pid">
>> > does the master daemon start?
>>
>> This works but I have to append& to make run in the background.
>> Probably I should run it with NOHUP or so..
>
>
> Can you post your /etc/init.d/cyrus-imapd start file?
>
>>
>> The users can now access to the mailboxes.
>>
>> I still get quite few errors in the logs.
>> Mails which are downloaded via fetchmail do not reach the mailbox
>> anymore. I guess that this is the deliver.db part from the error log.
>>
>
>
> Stop Cyrus and move/remove /var/lib/imap/deliver.db . Then start Cyrus
> again.
>
>
>
>
>
>> tail /var/log/maillog
>>
>> Feb 16 16:40:27 linux lmtpunix[3535]: DBERROR: opening
>> /var/lib/imap/deliver.db: cyrusdb error
>> Feb 16 16:40:27 linux lmtpunix[3535]: FATAL: lmtpd: unable to init
>> duplicate delivery database
>> Feb 16 16:40:37 linux master[3096]: process 3535 exited, status 75
>> Feb 16 16:40:37 linux master[3096]: service lmtpunix pid 3535 in READY
>> state: terminated abnormally
>> Feb 16 16:40:37 linux master[3538]: about to exec
>> /usr/lib/cyrus-imapd/lmtpd
>> Feb 16 16:40:37 linux lmtpunix[3538]: executed
>> Feb 16 16:40:37 linux lmtpunix[3538]: skiplist: invalid magic header:
>> /var/lib/imap/deliver.db
>> Feb 16 16:40:37 linux lmtpunix[3538]: skiplist: closed while still locked
>> Feb 16 16:40:37 linux lmtpunix[3538]: DBERROR: opening
>> /var/lib/imap/deliver.db: cyrusdb error
>> Feb 16 16:40:37 linux lmtpunix[3538]: FATAL: lmtpd: unable to init
>> duplicate delivery database
>>
>> I use postfix as MTA and I do not use lmtp but the cyrus transport
>> mailbox_transport = cyrus
>>
>> And yes, I have /sbin/runuser "installed".
>>
>> Thank you for your help.
>>
>> MW
>>
>>> On Tue, 2010-02-16 at 15:59 +0100, Matthias Wulkow wrote:
>>>> Hello Adam,
>>>> > (a) disable selinux
>>>> SELinux is disabled already.
>>>> > (b) make sure the cyrus user account is not disabled.
>>>> How can I enable/disable a cyrus accounts?
>>>> The user(s) are set as system users and identified by sasl. No mysql
>>>> configuation.
>>>> The system was fully working BEFORE the upgrade. Didn't do anything
>>>> except the upgrade (which seems to have broken something).
>>>>> On Tue, 2010-02-16 at 15:49 +0100, Matthias Wulkow wrote:
>>>>>> Hello,
>>>>>> I manually upgraded cyrus 2.3.7 (CentOS 5.4) to cyrus 2.3.16.
>>>>>> Note: I created the cyrus 2.3.16 rpm myself with the rpm src from
>>>>>> here:
>>>>>> http://www.invoca.ch/pub/packages/cyrus-imapd/
>>>>>> doing just rpmbuild --rebuild xxx.rpm
>>>>>> Now when I want to start cyrus:
>>>>>> /etc/init.d/cyrus-imapd start
>>>>>> or
>>>>>> service cyrus-imapd start
>>>>>> I get following error:
>>>>>> cyrus-imapd Datenbanken importieren: This account is currently not
>>>>>> available.
>>>>>> Can somebody tell me what I now can do?
>>>
>>> "service cyrus-imapd start" and "/etc/init.d/cyrus-imapd start" are the
>>> exact same thing; as "/etc/init.d/cyrus-imapd start" is what "service
>>> cyrus-imapd start" does. The init script does a "$RUNUSER - cyrus
>>> -c ...." I believe this error indicates that $RUNUSER is failing.
>>> RUNUSER is "/sbin/runuser" (if that file exists) or else it is "su".
>>> [Assuming your run scripts are the same as mine, I've using the Invoca
>>> packages]. If you just try to run "/usr/lib/cyrus-imapd/cyrus-master
>>> -C /etc/imapd.conf -M /etc/cyrus.conf -p /var/run/cyrus-master.pid" does
>>> the master daemon start?
>>
>> ----
>> Cyrus Home Page: http://cyrusimap.web.cmu.edu/
>> Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
>> List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
>
>
>
> ----
> Cyrus Home Page: http://cyrusimap.web.cmu.edu/
> Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
> List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html



More information about the Info-cyrus mailing list