Mail(1) breaks when contrib/sendmail is replaced with postfix?

Darren Pilgrim dmp at bitfreak.org
Tue Jul 13 00:59:01 PDT 2004


I use postfix for my mail servers, rather than sendmail.  Postfix installs
the sendmail-replacement programs under /usr/local.  The programs from
contrib/sendmail are under /usr, so you end up with two copies of these
programs when postfix is installed.  To avoid prevent security issues and
other problems I remove the old contrib/sendmail binaries and define
NO_SENDMAIL in /etc/make.conf.

For better integration, postfix can be started through the mailer
configuration in the base system by adding certain lines to /etc/rc.conf and
/etc/mail/mailer.conf.  This points sendmail, mailq, etc. to
/usr/local/sbin/sendmail.  This works very well, with one exception, the
periodic scripts don't seem to run.  I've been able to narrow this down to
this error from /usr/bin/mail:

/usr/bin/mail tries to run /usr/sbin/sendmail directly.  This probably isn't
a good idea, since IIRC sendmail can now be package-ized and removed from
the base system as well as excluded from buildworld.  This is what seems to
be breaking the periodic script, since I get this error when running
periodic:

# periodic daily
mail: /usr/sbin/sendmail: No such file or directory

# mail someone
Subject: foo
foo 
.
EOT
# mail: /usr/sbin/sendmail: No such file or directory

Why would /usr/bin/mail be doing this?  I couldn't find any knobs for
periodic.conf or mail.rc that would affect this.  I've had this problem with
other programs and shells where if you run a program without giving a path
(forcing a path search), then move the program to another point in the path
(say from /usr/bin to /usr/local/bin), you'll get similar "file not found"
errors.  Rebooting fixes the problem, but rebooting hasn't fixed this one.
Also, I can fix the problem by making a symlink from the postfix sendmail
binary to /usr/sbin/sendmail, but that's not really a workable solution.

How do I fix this?




More information about the freebsd-questions mailing list