0

Whenever I start Amavisd, the reports starting OK, but a status check says it's dead.

$ service amavisd start
Starting amavisd:                                          [  OK  ]

$ service amavisd status
amavisd dead but subsys locked

But Amavisd is running just fine. Correct PID reported.

$ cat /var/run/amavisd/amavisd.pid 
13019

$ ps aux | grep amavisd
amavis    2764  1.6 31.3 1938024 1266376 ?     Ssl  May28  23:30 clamd.amavisd -c /etc/clamd.d/amavisd.conf --pid /var/run/clamd.amavisd/clamd.pid
amavis   13019  3.1  3.2 393740 132492 ?       Ss   18:00   0:00 /usr/sbin/amavisd (master)
amavis   13032  0.0  3.2 394964 129264 ?       S    18:00   0:00 /usr/sbin/amavisd (virgin child)
amavis   13033  0.0  3.2 394964 129264 ?       S    18:00   0:00 /usr/sbin/amavisd (virgin child)

Mail server is running fine, and can connect directly to Amavisd manually:

$ telnet localhost 10024
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 [127.0.0.1] ESMTP amavisd-new service ready

It is the only process running on port 10024

netstat -tulpn |grep 10024
tcp        0      0 127.0.0.1:10024             0.0.0.0:*                   LISTEN      13019/amavisd (mast 
tcp        0      0 ::1:10024                   :::*                        LISTEN      13019/amavisd (mast 

Stopping the service and clearing the PIDs, lock files, etc. doesn't do the trick. eg. following steps results in the same results as above. Same with clearing the run files and rebooting.

$ service amavisd stop
Shutting down amavisd: Daemon [3046] terminated by SIGTERM
                                                           [  OK  ]
$ service amavisd status
amavisd is stopped

$ rm /var/run/amavisd/*
$ rm /var/lock/subsys/amavisd

$ service amavisd start
Starting amavisd:                                          [  OK  ]

$ service amavisd status
amavisd dead but subsys locked

The init.d file for Amavis has the following for a status check

  status)
        status ${prog_base}
        RETVAL=$?
        ;;

Should I be looking at rewriting this? or may the problem lay elsewhere?

Why does it think it is dead when it is clearly running?

and I think it's not reporting the correct process name:

$ cat /var/run/amavisd/amavisd.pid 
24073
$ ps -p 24073 -o comm=
/usr/sbin/amavi

Whereas other processes are reports as:
$ ps -p 3145 -o comm=
php-fpm
$ ps -p 3202 -o comm=
httpd
dandan
  • 158
  • 7
  • 1
    Ah, one more "service amavisd start Starting amavisd: The amavisd daemon is already running, PID: [6309]" but status says it's dead – dandan May 30 '22 at 01:56
  • 1
    As I already mentioned this is somewhat problem with service manager, won't you manage to show your `amavisd.service` file? Also, please, show exact versions of software your are running (`amavis`, `systemd`, Linux release). Actually I suspect the bug in the serivce definition file, which doesn't account the actual process name is not just `amavisd` but `amavisd (master)`. – Nikita Kipriyanov May 30 '22 at 05:14
  • It is Amazon Linux AMI 2018.03, amavisd-new.noarch 2.9.1-3.el6, and upstart-0.6.5-13.3.13.amzn1.x86_64 for service manager. @NikitaKipriyanov do you require the full init.d script? – dandan May 31 '22 at 11:02
  • I don't know how to work with Upstart, sorry. You have "centos" tag, and CentOS uses systemd. Please, append your precise system release and version information to the question, for nobody to get confused again. – Nikita Kipriyanov May 31 '22 at 11:36
  • my apologies, I had believe Amazon Linux 1 was equivalent to Centos 6. Thanks for the solution anyways! – dandan May 31 '22 at 11:41
  • @NikitaKipriyanov Your comment seemed to have helped to solve the issue, as seen below, I would write it as an answer. (so it coud be upvoted/accepted) – yagmoth555 May 31 '22 at 13:55
  • 1
    I'm too lazy, there is already correct answer which could (and should) be accepted. – Nikita Kipriyanov May 31 '22 at 14:13

1 Answers1

1

nikita kipriyanov's comment pointed to solution.

Editing the init.d script to check for "amavisd (master)" process name.

eg. status "amavisd (master)" instead of ${prog_base} which resolves to amavisd

dandan
  • 158
  • 7