Score:0

Why does status says it's dead and subsys locked, but it still running without issue?

in flag

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 avatar
in flag
Ah, one more "service amavisd start Starting amavisd: The amavisd daemon is already running, PID: [6309]" but status says it's dead
Nikita Kipriyanov avatar
za flag
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)`.
dandan avatar
in flag
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?
Nikita Kipriyanov avatar
za flag
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.
dandan avatar
in flag
my apologies, I had believe Amazon Linux 1 was equivalent to Centos 6. Thanks for the solution anyways!
yagmoth555 avatar
cn flag
@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)
Nikita Kipriyanov avatar
za flag
I'm too lazy, there is already correct answer which could (and should) be accepted.
Score:0
in flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.