Arrg, sendmail!
I’ve been having some terrible problems with Ubuntu dropping the network connection (by either reverting from static back to DHCP or it stopped sending packets) on network restart. Each time it would come up with an error:
tank~# /etc/init.d/networking restart
Setting up IP spoofing protection: rp_filter.
Enabling TCP/IP SYN cookies...done.
Enabling packet forwarding...done.
Reconfiguring network interfaces...ifup: interface lo already configured
addr=192.168.1.102, name=
Updating databases ...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/databases...
Updating Makefile ...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/Makefile...
Updating sendmail.cf ...
*** ERROR: FEATURE() should be before MAILER()
*** ERROR: FEATURE() should be before MAILER()
*** MAILER(`local') must appear after FEATURE(`allmasquerade')*** ERROR: FEATURE() should be before MAILER()
*** MAILER(`local') must appear after FEATURE(`always_add_domain')*** ERROR: FEATURE() should be before MAILER()
*** ERROR: FEATURE() should be before MAILER()
*** ERROR: FEATURE() should be before MAILER()
*** ERROR: FEATURE() should be before MAILER()
*** FEATURE(smrsh) must occur before MAILER(local)
*** ERROR: MAILER(local) already included
*** ERROR: MAILER(smtp) already included
Updating access_db ...
Updating ALIAS_FILE ...
The following file(s) have changed:
/etc/mail/sendmail.cf
** ** You should issue `/etc/init.d/sendmail reload` ** **
Mail Transport Agent: sendmail is not running
done.
Nasty, right? Yeah.
The Fix
Get rid of it, and install Postfix instead.
sudo apt-get remove sendmail
sudo apt-get autoremove
but the remove actually leaves 2 files which still leaves you with an error!
The Real Fix
remove these:
/etc/network/if-up.d/sendmail
/etc/network/if-down.d/sendmail
I’ve noticed its been much much more stable since sendmail has been gone.

I think you can replace the last step with “sudo update-rc.d -f sendmail remove”
I can’t thank you enough!!!!
I stumbled across this googling for an answer. My network configuration seemed to sometimes work and sometimes didn’t. I knew there must have been some left-over config error/files but had no idea what to look for.
To delete sendmail do we need to remoce also the file in the init.d ?