Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sendmail/postfix problem: sendmail dead but subsys locked

Status
Not open for further replies.

teka2112

Technical User
Feb 5, 2003
14
0
0
US
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

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
 
Looks like your system has 'postfix' installed. Is there an /etc/init.d/rc.d/postfix startup script? postfix uses a sendmail binary, but is a different implementation (I guess that's a reasonable description?). It seems you are trying to start sendmail directly. Try starting postfix instead (it will control sendmail on it's own).

A more likely answer I just Google'd up:

Most likely, these two errors come from a bug in RH which I've seen two or
three times now in which installing postfix leaves you with most of postfix
installed, plus /usr/sbin/sendmail installed from the sendmail RPM rather
than the sendmail compatibility wrapper from the postfix RPM.

rpm -e --nodeps postfix sendmail ; rpm -Uvh /path/to/postfix.rpm

will fix the problem if that's the case


Good luck! --
JR
 
Just for info, postfic includes a 'dummy' sendmail binary which fronts the postfix application(s). This is so that other applications that call sendmail directly (rather than use SMTP connections) can use postfix without any alteration.
 
ok, I thought that postfix did start sendmail (or contains a sendmail binary like you say).

after all this did work prior to adding that script.

I took that out of the picture...

I do have a postfix script in /etc/rc.d/init.d
it looks like this:

#!/bin/sh
#
# postfix Postfix Mail Transfer Agent
#
# chkconfig: 2345 80 30
# description: Postfix is a Mail Transport Agent, which is the program # that moves mail from one machine to another.
# processname: master
# pidfile: /var/spool/postfix/pid/master.pid
# config: /etc/postfix/main.cf
# config: /etc/postfix/master.cf
#
# Based on startup script from Simon J Mudd <sjmudd@pobox.com>
# 25/02/99: Mostly s/sendmail/postfix/g by John A. Martin <jam@jamux.com>
# 23/11/00: Changes & suggestions by Ajay Ramaswamy <ajayr@bigfoot.com>
# 20/01/01: Changes to fall in line with RedHat 7.0 style
# 23/02/01: Fix a few untidy problems with help from Daniel Roesen.

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

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

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

[ -x /usr/sbin/postfix ] || exit 0
[ -d /etc/postfix ] || exit 0
[ -d /var/spool/postfix ] || exit 0

RETVAL=0

start() {
# Start daemons.
gprintf &quot;Starting postfix: &quot;
if [ ! -e /var/spool/postfix/etc/resolv.conf ]; then
cp -f /etc/resolv.conf /var/spool/postfix/etc
fi
/usr/sbin/postalias /etc/postfix/aliases
/usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/postfix
echo
return $RETVAL
}

stop() {
# Stop daemons.
gprintf &quot;Shutting down postfix: &quot;
/usr/sbin/postfix stop 2>/dev/null 1>&2 && success || failure
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/postfix
echo
return $RETVAL
}

reload() {
gprintf &quot;Reloading postfix: &quot;
/usr/sbin/postfix reload 2>/dev/null 1>&2 && success || failure
RETVAL=$?
echo
return $RETVAL
}

abort() {
/usr/sbin/postfix abort 2>/dev/null 1>&2 && success || failure
return $?
}

flush() {
/usr/sbin/postfix flush 2>/dev/null 1>&2 && success || failure
return $?
}

check() {
/usr/sbin/postfix check 2>/dev/null 1>&2 && success || failure
return $?
}

restart() {
stop
start
}

# See how we were called.
case &quot;$1&quot; in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
abort)
abort
;;
flush)
flush
;;
check)
check
;;
status)
status master
;;
condrestart)
[ -f /var/lock/subsys/postfix ] && restart || :
;;
*)
gprintf &quot;Usage: postfix {start|stop|restart|reload|abort|flush|check|status|condrestart}\n&quot;
exit 1
esac

exit $?

I am a bit confused about the difference between the path /etc/rc.d/init.d and the path /etc/init.d

but that is a tangent...

so I have checked to see that the postfix service is running and it is. I did reload it.

so, it seems that the problem is with postfix ??

 
/etc/rc.d/init.d was the 'old' location for the init scripts in redhat - /etc/init.d is the new 'linux standard' location for init scripts.

If you do a full listing of the first, you'll see it's a symbolic link to the latter:

ls -l /etc/rc.d/init.d

So either path is the same.


So, as postfix is running, test it outside on Apache.

Easiest way:

mail &quot;username@address&quot;

it'll prompt you for a subject, then start entering the text. When you're done, hit <CNTL><D> and it will prompt you for a Cc: which you can just hit return on.

This will then be queued for delivery. You can examine the queue with &quot;mailq&quot;. Should be empty assuming it delivers really quickly.

Finally, check the logs - not sure if it's the same under redhat - I'm using postfix under Debian - but they'll be something like

/var/log/mail.log
/var/log/mail.err
/var/log/mail.info
/var/log/mail.warn

 
well I did try to email myself as above - but it didnt make it.

I tried the mailq command but I dont have that command.

My logs are in /var/log/mail/
ive got info, warnings and errors - none of which got any input.

they are huge from my scripts not working

the info log file contains stuff like:

Feb 23 07:04:21 a500 postfix/smtp[24853]: connect to mx4.mail.yahoo.com[216.136.129.15]: Connection timed out (port 25)
Feb 23 07:04:21 a500 postfix/smtp[24855]: connect to mx4.mail.yahoo.com[216.136.129.17]: Connection timed out (port 25)
Feb 23 07:04:21 a500 postfix/smtp[24856]: connect to mx4.mail.yahoo.com[216.136.129.15]: Connection timed out (port 25)

looks like postfix is timing out every time - has been since I rebooted I believe.

could something not be restarting?


the warnings log file has this:

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 4663 killed by signal 15
Feb 25 14:16:30 a500 postfix/master[1312]: warning: process /usr/lib/postfix/smtp pid 4668 killed by signal 15

so, im not sure what is going on...

any other ideas? thanks so much for your help


 
I know it sounds like postfix is not running, but I do:

service postfix status

and get:

master (pid 1312) is running...

thats correct, yes?
 
for mailq - try &quot;postqueue -p&quot;. mailq on a postfix system is like the sendmail binary, there for compatability.

Have you tried reinstalling postfix?
 
I checked the queue with postqueue -p

there are 629 requests in the queue - looks like they are stacking up!

No, I havent reinstalled postfix yet. looks like thats the next step. the thing is this was working at one point. I would have to have corrupt files if reinstalling fixes this

 
well it looks like I dont have the db.h libraries - bummer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top