FAQ: Error Rebuilding sendmail.cf

"There’s No Such Thing As A Silly Question" -- does the cliche sound familiar? In this part of pimp-my-rig reloaded, technical questions are answered. Mail them to me and I will post the answers here. If you have a better answer, by all means share it with us.

Guides on the net suggest that you do not edit sendmail.cf by hand. First, make changes to sendmail.mc then rebuild sendmail.cf using the command: "m4 sendmail.mc > sendmail.cf". However, this command sometimes fails and before you know it you have unknowingly made changes to sendmail.cf -- the file is now 0 bytes. The error message is below:

[root@host mail]# m4 sendmail.mc > sendmail.cf
sendmail.mc:10: m4: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

Things are pretty simple if you look at the error.. but it is very deceiving. Take a look at your sendmail.cf.

[root@host mail]# ls -la sendmail.cf
-rw-r--r-- 1 root root 0 Feb 18 10:02 sendmail.cf
Ooppss.. sendmail.cf is now zero bytes. You can rebuild sendmail.cf from sendmail.mc using m4, but you just executed the exact command to re-generate sendmail.cf ending in errors. Re-starting sendmail will make things worse. Sendmail will still work as it read sendmail.cf before the error. Restarting it will re-read the zeroed out sendmail.cf file.

I got stuck in this error before. And a colleague got stuck in it just recently.

The guides either forgot to mention that or assumed that it is installed and you will need to have installed the sendmail-cf rpm. How do you know that sendmail-cf is the required rpm? Take a closer look at the first few lines of sendmail.mc.

[root@host mail]# head sendmail.mc
divert(-1)dnl
dnl #
dnl # This is the sendmail macro config file for m4. If you make changes to
dnl # /etc/mail/sendmail.mc, you will need to regenerate the
dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is
dnl # installed and then performing a
dnl #
dnl #     make -C /etc/mail
dnl #

So what you can do now is install sendmail-cf rpm.

[root@host mail]# yum -y install sendmail-cf
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.web.com.ph
 * extras: mirror.web.com.ph
 * updates: mirror.web.com.ph
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sendmail-cf.x86_64 0:8.13.8-8.1.el5_7 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch          Version                  Repository      Size
================================================================================
Installing:
 sendmail-cf        x86_64        8.13.8-8.1.el5_7         updates        306 k

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 306 k
Downloading Packages:
sendmail-cf-8.13.8-8.1.el5_7.x86_64.rpm                  | 306 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : sendmail-cf                                              1/1

Installed:
  sendmail-cf.x86_64 0:8.13.8-8.1.el5_7

Complete!

Now re-run "m4 sendmail.mc > sendmail.cf" and it will be error free. You can safely make changes to sendmail.mc and generate sendmail.cf from that.

You might also be interested in:

Feedback

We at pimp-my-rig strive to keep on improving, help us reach that goal by leaving comments or constructive criticisms. Don't miss out on our next feature -- subscribe via RSS (What is RSS?).

Share This

2 comments: