1 (edited by copart 2011-08-19 10:20:09)

Topic: amavisd

==== Provide basic information to help troubleshoot ====
- iRedMail version: 0.6.1
- Centos 5
====

Every so often after a reboot of my mail server, amavisd goes into a weird state. 

/var/log/maillog

Aug 18 15:28:07 SERVERNAME postfix/error[21539]: 569CA8C231: to=<user@example.com>, relay=none, delay=1104, delays=1104/0.04/0/0, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)

=====
So, check on amavisd

[root@server ~]# service amavisd status
amavisd dead but subsys locked

#So I restart it
[root@server ~]# service amavisd restart
Shutting down Mail Virus Scanner (amavisd):                [FAILED]
Starting Mail Virus Scanner (amavisd):                     [  OK  ]
[root@server ~]# service amavisd status
amavisd dead but subsys locked

For some reason I cannot get it to restart... However, if I reboot, it usually works.

#also tried to delete the subsys lock:
[root@server ~]# service amavisd status
amavisd dead but subsys locked
[root@server ~]# service amavisd restart
Shutting down Mail Virus Scanner (amavisd):                [FAILED]
Starting Mail Virus Scanner (amavisd):                     [  OK  ]
[root@server ~]# service amavisd status
amavisd dead but subsys locked

Any ideas?

2

Re: amavisd

Make sure Amavisd is not running, then remove /var/amavis/amavis.lock and /var/amavis/amavis.pid, restarting Amavisd again. It should work now.

It's considered as a bug in Amavisd startup script /etc/init.d/amavisd.

3 (edited by copart 2011-08-20 10:23:13)

Re: amavisd

Thanks Zhang.  I am going to edit the init and see how it goes.  Since I already rebooted to fix the issue for now, time will tell.  Also, I believe you meant /var/amavis/amavisd.lock and /var/amavis/amavisd.pid above.

For those interested, I modified the start section in /etc/init.d/amavisd to the following:
start() {
    if [ "$MILTER_SOCKET" -a -x "/usr/sbin/$prog2" ]; then
        echo -n $"Starting $desc ($prog2): "
        daemon --user "$AMAVIS_USER" /usr/sbin/$prog2 -p "$MILTER_SOCKET" $MILTER_FLAGS
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog2
    fi
    echo -n $"Starting $desc ($prog): "
    #http://www.iredmail.org/forum/topic2359-amavisd.html
    #begin edit, hopefully makes it so that amavis ALWAYS starts up
    #Confirm that no version of amavisd is actually running, just to be safe
    if [ $(ps aux | grep -Pc 'amavisd \(master\)') -eq 0 ]; then
        rm /var/amavis/amavisd.lock
        rm /var/amavis/amavisd.pid
    fi
    #end of edit
    daemon --user "$AMAVIS_USER" /usr/sbin/$prog -c "$CONFIG_FILE"
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    return $RETVAL
}

----
I know I could of just easily checked for the pid from /var/amavis/amavisd.pid, but I wanted to confirm that no process was running outside of a service.

4

Re: amavisd

copart wrote:

For those interested, I modified the start section in /etc/init.d/amavisd to the following:

Pasting a patch is more readable. smile

Also, contribute to Amavisd project directly to fix this issue in init script would be great.