FreeBSD 7 Sendmail Woes (Resolved)

After years of running a legacy version of FreeBSD, I felt it was time for me to bring my web/mail server up to the latest version (7). At near completion, I had just my sendmail config to complete and was I ever surprised to find the lack of documentation for troubleshooting sendmail and FreeBSD 7!

The first problem I had was that sendmail could not find the proper lib files so it would fail on build (from ports, with an updated ports tree). Before running a ‘make’ in /usr/src/usr.sbin/sendmail/,  I compiled saslauthd (cyrus-sasl2-saslauthd). When running ‘make’ for sendmail it failed with a STOP error stating it could  not find sasl.o .

Okay, I have run across this type of thing before and simply copied the ‘.a’, ‘.o’, or ‘.h’ file from its source directory to the directory which the building app needed. I did copy the sasl.o file and was able to restart the compile with yet another STOP error and missing ‘.’ files. Copying ‘.’ files is fine, but what if the file is nowhere on the system?

Digging a little deeper, I noticed that lib files that should have compiled did not, such as libsmutil.a which was missing. To resolve, I simply ran  ‘make’  in its respective directory (/usr/src/lib/libsmutil/ in this case) and then copied the missing’.’ file the file into the directory which the sendmail build was pointing to. This obviously points to a munged Makefile config but I have found that copying ‘.’ files is sometimes easier than editing the config files. 🙂

The second problem was simply that I could not get the smtp port to bind correctly on boot up for sendmail to listen to other than the loopback address.  Log files revealed:

sm-mta[760]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA: cannot bind: Can’t assign requested address

And:

sm-mta[760]: daemon MTA: problem creating SMTP socket

Which would end in:

sm-mta[760]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA: server SMTP socket wedged: exiting

A netstat command showed the following:

tcp4       0      0  localhost.smtp            *.*                    LISTEN

and a sockstat command revealed something similar:

sendmail     sendmail   762   6  tcp4   localhost:25                  *:*

Now, oddly a Google search revealed very little to even point me in a viable direction to resolve the issue. I knew the problem was that sendmail called from rc.conf was attempting to start on port 25 when port 25 was already bound to another instance of sendmail. This baffled me as I’ve never had sendmail configured as a server (MTA) not work to eliminate the local sendmail smtp port binding

Having taken a sendmail training several years back, I broke out my trusty sendmail training material authored and taught by Hal Pomeranz (Deer Run Associates). In it I found a little help that pointed me in a direction to resolve the problem. Editing the myhostname.mc file in /etc/mail/ I found the line that reads:

DAEMON_OPTIONS(`Port=smtp,  Name=MTA’)dnl

and added:

Addr=192.168.1.109 (my particular host’s IP address)

the entire line looks like this:

DAEMON_OPTIONS(`Port=smtp,Addr=192.168.1.109, Name=MTA’)dnl

I ran a “make all install” without restarting sendmail. I rebooted the host so sendmail could be called correctly from rc.conf and the problem was resolved. I am still baffled as to why sendmail needs this parameter now as it did not previously, but will eventually figure it out 🙂 Hope this helps someone as very little documentation is out there on this issue.

Leave a Reply

Your email address will not be published. Required fields are marked *