cron doesn't send mail

Bug #520273 reported by narnie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ecryptfs-utils
New
Undecided
Unassigned
postfix (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: cron

I have this as a test script called test_cron
_______________
#! /bin/bash
#

#if ! type promptYesNo > /dev/null 2>&1 ; then . /home/woodnt/scripts/misc.sh ; fi

FILE=/tmp/cron.log
TIME=`date -d now "+%m-%d-%y@%H%M%S"`
if [ ! -f $FILE ] ; then
 touch $FILE
fi

echo "Hello at $TIME from test_cron" |tee -a $FILE
_______________

From the last line, one can see that that there is output.

It is trying to send mail as can be seen here:
_______________
root 29138 0.0 0.0 18708 988 ? Ss 23:00 0:00 cron
root 29166 0.0 0.0 91236 2192 ? S 23:01 0:00 \_ CRON
root 29167 0.0 0.0 91244 1300 ? S 23:01 0:00 | \_ CRON
woodnt 29168 0.0 0.0 0 0 ? Zs 23:01 0:00 | \_ [sh] <defunct>
woodnt 29193 0.0 0.0 37000 2100 ? S 23:01 0:00 | \_ /usr/sbin/sendmail -i -FCronDaemon -oem woodnt
woodnt 29194 0.0 0.0 36988 2096 ? S 23:01 0:00 | \_ /usr/sbin/postdrop -r
_______________

$ mail
No mail for woodnt
woodnt@toshiba-laptop /var/mail $

I have looked in /var/mail and it shows bupkis

woodnt@toshiba-laptop /var/mail $ sudo cat *
[sudo] password for woodnt:
woodnt@toshiba-laptop /var/mail $

checking out /var/log/mail.log shows nothing being sent from cron. mail.err is empty. No evidence of cron sending anything in mail.info either.

This works:

woodnt@toshiba-laptop /var/log $ echo hello|/usr/sbin/sendmail -i -FCronDaemon -oem woodnt
woodnt@toshiba-laptop /var/log $ mail
Mail version 8.1.2 01/15/2001. Type ? for help.
"/var/mail/woodnt": 1 message 1 new
>N 1 woodnt@toshiba-la Wed Feb 10 23:10 13/437
&

So somewhere between cron sending the mail and it going through postfix something is going wrong.

I have bsd-mailx installed which of course also installs postfix as a depends.

I can't duplicate this problem on other systems.

Of note, I had installed ssmtp first for another reason, but uninstalled thinking it might have been the problem. A purge uninstall then reinstall of bsd-mailx didn't fix this. I am not sure if the culprit is ssmtp configuring something and not undoing it on purge or if the fault is in cron.

Thanks,
Narnie

Revision history for this message
narnie (signupnarnie) wrote :

sorry. Forgot to show my crontab

woodnt@toshiba-laptop /var/log $ crontab -l

MAILTO="woodnt"
#m h dom mon dow command
*/1 * * * * /home/woodnt/bin/test_cron

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Since cron is clearly invoking sendmail and that invokes postfix, I'm guessing it goes missing inside postfix somewhere

affects: cron (Ubuntu) → postfix (Ubuntu)
Revision history for this message
Scott Kitterman (kitterman) wrote :

Please attach the output of postconf -n to the bug.

Changed in postfix (Ubuntu):
status: New → Incomplete
Revision history for this message
narnie (signupnarnie) wrote :

Sorry it took so long for this. Revisiting this issue after a fresh install of UNE 10.04

Here is the output of postconf -n
________________________________________________________________

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
default_transport = error
inet_interfaces = loopback-only
mailbox_size_limit = 0
mydestination = localhost, localhost.localdomain, localhost
myhostname = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relay_transport = error
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 520273] Re: cron doesn't send mail

Look in /var/log/mail.log for evidence of postfix trying to send the mail.

Revision history for this message
narnie (signupnarnie) wrote :

I have found the problem. It is caused by ecryptfs the way it is implemented in Ubuntu. Here is the culprit (found by hours of removing files and directories and rebooting):

I don't like my Private folder automounted. My solution, follow the recommendations to delete .ecryptfs/auto-mount.

When this is done, ecrypt tries to automount, but throws an error:

Aug 31 02:43:01 localhost CRON[8404]: Skipping automatic eCryptfs mount

followed by this error:

Aug 31 02:43:01 localhost CRON[8405]: (woodnt) CMD (echo "hello `date`")

Now I feel stupid for spending hours at this when I should have just done a simple mv .ecryptfs .ecryptfs.bak first, instead of for every dir (after I found every .xxx regular file had nothing to do with it).

I then also get the above cron process tree found by ps -auxf.

When I isolated .ecrpytfs, then I noted I had deleted the auto-mount and touched it to put it back. Rebooted, and I get mail and I get NO defunct sh and get no build up of cron processes.

This is a significant but, but not critical and likely affects very few people, but is hard to figure out when it does!

Not sure how to move this thread over to ecryptfs-utils.

Please advise,
Narnie

PS, it seems postfix is trying to send, but gets stuck (as noted above with the \_ /usr/sbin/sendmail -i -FCronDaemon -oem woodnt getting stuck, kind like it is waiting on stdin but who knows).

Revision history for this message
narnie (signupnarnie) wrote :

Here is the /var/log/mail.log if needed

James Page (james-page)
Changed in postfix (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.