Link to home
Start Free TrialLog in
Avatar of teka2112
teka2112

asked on

sendmail problem: sendmail dead but subsys locked

Ive got a small server running on a linux box. Im using Apache2 to serve HT docs. Ive also got some perl 5 scripts with which im using sendmail to send various emails. Ive got a problem which surfaced recently - possibly coinsiding with rebooting the server (complete power down).

The problem is that now its not sending any mail at all.
Im still learning linux, so not knowing exactly how to troubleshoot - im having problems fixing this.

I did notice that there was no init script for sendmail in the /etc/rc.d/init.d folder. So, I added one:

#!/bin/sh
#
# sendmail This shell script takes care of starting and stopping
# sendmail.
#
# chkconfig: 2345 80 30
# description: Sendmail is a Mail Transport Agent, which is the program \
# that moves mail from one machine to another.
# processname: sendmail
# config: /etc/sendmail.cf
# pidfile: /var/run/sendmail.pid

# Source function library.
. /etc/rc.d/init.d/functions

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

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/sbin/sendmail ] || exit 0

# See how we were called.
case "$1" in
 start)
   # Start daemons.
   echo -n "Starting sendmail: "
   daemon /usr/sbin/sendmail -bd -q1h
   echo
   touch /var/lock/subsys/sendmail
   ;;
 stop)
   # Stop daemons.
   echo -n "Shutting down sendmail: "
   killproc sendmail
   echo
   rm -f /var/lock/subsys/sendmail
   ;;
 restart)
   $0 stop
   $0 start
   ;;
 status)
   status sendmail
   ;;
 *)
   echo "Usage: sendmail {start|stop|restart|status}"
   exit 1
 esac

exit 0

I then used this to start sendmail (but how was it running prior to this script?) it started - at least it said [   OK   ]...

I then checked the sendmail service status using:

[root@a500 root]# service sendmail status
sendmail dead but subsys locked

and thats what I got...

I then did a netstat:

[root@a500 root]# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:32768                 *:*                     LISTEN
tcp        0      0 localhost:32769         *:*                     LISTEN
tcp        0      0 *:32770                 *:*                     LISTEN
tcp        0      0 *:mysql                 *:*                     LISTEN
tcp        0      0 *:netbios-ssn           *:*                     LISTEN
tcp        0      0 *:sunrpc                *:*                     LISTEN
tcp        0      0 *:http                  *:*                     LISTEN
tcp        0      0 *:10000                 *:*                     LISTEN
tcp        0      0 *:ftp                   *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:squid                 *:*                     LISTEN
tcp        0      0 localhost.localdom:smtp *:*                     LISTEN
tcp        0      0 *:894                   *:*                     LISTEN
udp        0      0 *:32768                 *:*
udp        0      0 *:nfs                   *:*
udp        0      0 *:32770                 *:*
udp        0      0 *:32771                 *:*
udp        0      0 IP:netbios-ns *:*
udp        0      0 localhost.lo:netbios-ns *:*
udp        0      0 *:netbios-ns            *:*
udp        0      0 IP:netbios-dgm *:*
udp        0      0 localhost.l:netbios-dgm *:*
udp        0      0 *:netbios-dgm           *:*
udp        0      0 *:10000                 *:*
udp        0      0 *:icpv2                 *:*
udp    63936      0 *:bootpc                *:*
udp        0      0 *:3401                  *:*
udp        0      0 *:4827                  *:*
udp        0      0 *:sunrpc                *:*
udp        0      0 *:891                   *:*
udp        0      0 localhost.localdoma:ntp *:*
udp        0      0 IP.client:ntp *:*
udp        0      0 localhost:ntp           *:*
udp        0      0 *:ntp                   *:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING     3567   public/showq
unix  2      [ ACC ]     STREAM     LISTENING     5053   /tmp/.s.PGSQL.5432
unix  2      [ ACC ]     STREAM     LISTENING     7833   /tmp/mysql.sock
unix  2      [ ACC ]     STREAM     LISTENING     3547   private/rewrite
unix  2      [ ACC ]     STREAM     LISTENING     3551   private/bounce
unix  2      [ ACC ]     STREAM     LISTENING     3555   private/defer
unix  2      [ ACC ]     STREAM     LISTENING     3563   private/smtp
unix  2      [ ACC ]     STREAM     LISTENING     3571   private/error
unix  2      [ ACC ]     STREAM     LISTENING     3575   private/local
unix  2      [ ACC ]     STREAM     LISTENING     3579   private/virtual
unix  2      [ ACC ]     STREAM     LISTENING     3583   private/lmtp
unix  2      [ ACC ]     STREAM     LISTENING     3587   private/cyrus
unix  2      [ ACC ]     STREAM     LISTENING     3591   private/uucp
unix  2      [ ACC ]     STREAM     LISTENING     3595   private/ifmail
unix  2      [ ACC ]     STREAM     LISTENING     3599   private/bsmtp
unix  2      [ ACC ]     STREAM     LISTENING     3659   /var/prelude/socket
unix  2      [ ACC ]     STREAM     LISTENING     2988   /dev/gpmctl
unix  2      [ ACC ]     STREAM     LISTENING     3069   /tmp/.font-unix/fs-1
unix  2      [ ACC ]     STREAM     LISTENING     3161   /var/lib/sasl/mux
unix  2      [ ACC ]     STREAM     LISTENING     3540   public/cleanup
unix  2      [ ACC ]     STREAM     LISTENING     3559   public/flush

I see nothing on port 25, so im assuming that sendmail is still not running. Any help here would be wonderful...

also if I try to stop sendmail with this script - it fails...

sendmail WAS working at one point. Ive made no changes in code. I have only rebooted. perhaps sendmail is just not restarting during bootup???

The script was just a try - it worked before I installed that...

Im not sure where to go exactly which log files to look at to get clues for this. Ill be happy to post the logs that pertain here if someone is interested in helping - or perhaps has heard of something like this...

Thanks
Avatar of teka2112
teka2112

ASKER

perhaps my problem is with postfix (which is running) ??
here is a small chunk of my /var/log/mail/warnings file:
incase this helps...


Feb 25 17:16:30 a500 postfix/nqmgr[1327]: warning: private/smtp socket: malformed response
Feb 25 17:16:30 a500 postfix/nqmgr[1327]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
Feb 25 14:16:30 a500 postfix/master[1312]: warning: process /usr/lib/postfix/smtp pid 4904 killed by signal 15
Feb 25 17:16:30 a500 postfix/nqmgr[1327]: warning: premature end-of-input from private/smtp socket while reading input attribute name
Feb 25 17:16:30 a500 postfix/nqmgr[1327]: warning: private/smtp socket: malformed response
Feb 25 17:16:30 a500 postfix/nqmgr[1327]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
Feb 25 14:16:30 a500 postfix/master[1312]: warning: process /usr/lib/postfix/smtp pid 4943 killed by signal 15
Feb 25 17:16:30 a500 postfix/nqmgr[1327]: warning: premature end-of-input from private/smtp socket while reading input attribute name
Feb 25 17:16:30 a500 postfix/nqmgr[1327]: warning: private/smtp socket: malformed response
Feb 25 17:16:30 a500 postfix/nqmgr[1327]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
Feb 25 14:18:06 a500 postfix/postfix-script: warning: /var/spool/postfix/etc/localtime and /etc/localtime differ
Feb 25 14:18:06 a500 postfix/postfix-script: warning: /var/spool/postfix/etc/hosts and /etc/hosts differ
Feb 25 14:18:23 a500 postfix/postfix-script: warning: /var/spool/postfix/etc/localtime and /etc/localtime differ
Feb 25 14:18:23 a500 postfix/postfix-script: warning: /var/spool/postfix/etc/hosts and /etc/hosts differ
ok.. you have something running on port 25
from your netstat output:

tcp        0      0 localhost.localdom:smtp *:*                     LISTEN

why do u have both postfix and sendmail running?
is that a special situation where one of them is acting as
a proxy to the other or something?

to find out which one is running, try the lsof utility
if its not installed, get the rpm and install it

lsof -i tcp

should give you what binary is hooked to which port and
running under which username, great helper.

as to finding out how sendmail was running before, take
a second look in the init.d directory, the file does not
have to be named sendmail, it may not even be in init.d
at all, check your rcX.d directory, where X is your
runlevel (type runlevel to find out which runlevel u are
in right now), sendmail could also have been started
from within another script, go to the rcX.d directory
and grep -i sendmail *, should find it.

as to why the sendmail init script is giving that error,
it could be because sendmail tries to use port 25, but
finds it being used by something else (postfix?) or that
the paths in the initscript are not the same as the ones
for the running sendmail, if sendmail is running.

hope that helps
tc
-nick
nick-

thanks for the input.

well, ive come to learn that postfix does start sendmail, or a binary "dummy" I guess.

I was playing around with starting it manually myself with that script I added. I realized that wasnt the right way to go, so I got rid of that script.

I checked to see that postfix is running and it is. I do a:
service postfix status

and get:
master (pid 1312) is running...

I tried emailing myself using "mail" command - it didnt go

I then checked the log files in /var/log/mail but they got no input from that manual mail try. They are packed with problems from my web scripts trying to email. mostly postfix timing out... and what I entered above...

I do have lsof  - so I did a:

lsof -i tcp like you suggested and got this back:

COMMAND     PID    USER   FD   TYPE DEVICE SIZE NODE NAME
portmap     818     rpc    4u  IPv4   2894       TCP *:sunrpc (LISTEN)
rpc.statd   885 rpcuser    6u  IPv4   2998       TCP *:32768 (LISTEN)
sshd       1090    root    3u  IPv4   3230       TCP *:ssh (LISTEN)
xinetd     1111    root    5u  IPv4   3243       TCP localhost:32769 (LISTEN)
rpc.rquot  1138    root    4u  IPv4   3287       TCP *:894 (LISTEN)
rpc.mount  1169    root    4u  IPv4   3333       TCP *:32770 (LISTEN)
master     1312    root   11u  IPv4   3535       TCP localhost.localdomain:smtp (LISTEN)
proftpd    1390  nobody    0u  IPv4   3724       TCP *:ftp (LISTEN)
squid      1512   squid   10u  IPv4   4518       TCP *:squid (LISTEN)
miniserv.  1514    root    4u  IPv4   4528       TCP *:10000 (LISTEN)
smbd       1531    root    9u  IPv4   4678       TCP *:netbios-ssn (LISTEN)
httpd      1761    root    3u  IPv4   5661       TCP *:http (LISTEN)
mysqld     1823   mysql    3u  IPv4   5746       TCP *:mysql (LISTEN)
mysqld     1824   mysql    3u  IPv4   5746       TCP *:mysql (LISTEN)
mysqld     1825   mysql    3u  IPv4   5746       TCP *:mysql (LISTEN)
smtp      14539 postfix   11u  IPv4 120044       TCP localhost.localdomain:40885->mta-v12.mail.yahoo.com:smtp (SYN_SENT)
smtp      14540 postfix   11u  IPv4 120053       TCP localhost.localdomain:40888->imv08.mail.bellsouth.net:smtp (SYN_SENT)
httpd     14869  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
sshd      15072    root    4u  IPv4 109147       TCP 12-225-88-12.client.attbi.com:ssh->192.168.0.30:1130 (ESTABLISHED)
httpd     15256  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
httpd     15282  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
httpd     15283  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
httpd     15284  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
httpd     15285  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
httpd     15286  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
httpd     15287  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
smtp      15303 postfix   11u  IPv4 120051       TCP localhost.localdomain:40886->xd.mx.aol.com:smtp (SYN_SENT)
smtp      15304 postfix   11u  IPv4 120052       TCP localhost.localdomain:40887->xh.mx.aol.com:smtp (SYN_SENT)
httpd     15312  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
httpd     15313  nobody    3u  IPv4   5661       TCP *:http (LISTEN)
smtp      15412 postfix   11u  IPv4 120042       TCP localhost.localdomain:40883->mta-v13.level3.mail.yahoo.com:smtp (SYN_SENT)
smtp      15413 postfix   11u  IPv4 120043       TCP localhost.localdomain:40884->mta-v21.level3.mail.yahoo.com:smtp (SYN_SENT)
smtp      15457 postfix   11u  IPv4 124085       TCP localhost.localdomain:40889->mc10.bay6.hotmail.com:smtp (SYN_SENT)
smtp      15464 postfix   11u  IPv4 124090       TCP localhost.localdomain:40891->mc1.law16.hotmail.com:smtp (SYN_SENT)
smtp      15466 postfix   11u  IPv4 124086       TCP localhost.localdomain:40890->txmx01.mgw.rr.com:smtp (SYN_SENT)


I see some entries for postfix - a few of them - no sendmail though (not sure what that means). what are the various postfix entries I wonder - is postfix trying to continue to send some of the mail thats queued up from the scripts trying to send?

Im not sure - any other ideas??

Thanks for your help :)
I see two obvious errors from your origianl post

Feb 25 14:18:23 a500 postfix/postfix-script: warning: /var/spool/postfix/etc/localtime and /etc/localtime differ
Feb 25 14:18:23 a500 postfix/postfix-script: warning: /var/spool/postfix/etc/hosts and /etc/hosts differ

i guess you made some recent modification to your network
or updated some packages or something to that effect, the
end result is that you have to copy /etc/hosts and
/etc/localtime to /var/spool/postfix/etc
and then stop and start postfix

postfix includes a binary called sendmail because too many
scripts and other programs call the binary file /usr/lib/sendmail or /usr/sbin/sendmail, so postfix just
puts a minimal sendmail binary to redirect to itself.

try updating those files (hosts and localtime), restart postfix, and see what happens, if you still have problems
with the queue, it might be a good idea to stop your web
server for a bit, remove everything from the spool and
then trying to email again.

please note that postfix does not put the spooled mail
in /var/spool/mqueue like sendmail. but in multiple
directories in /var/spool/postfix, take a look

i wish i can help you more, but i dont have enough info
try to telnet to port 25 and see what happens, something
like this (keep another window open with tail -f on the
mail log)

telnet localhost 25
helo mydomain.com
mail from:<user@mydomain.com>
rcpt to:<user@otherdomain.com>
data
test
test
. (this is a dot on a line by itself to end :))
quit


good luck
-nick
teka2112:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is to:

Be PAQ'd/Points No Refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Paul
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of Lunchy
Lunchy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial