From Bugzilla Helper: User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/85.7 (KHTML, like Gecko) Safari/85.7 Description of problem: By default the call to gethostname will always fail to produce a 'fully qualified name' requiring unnecessary conf file adjustment for certain hosts. [root@yogi init.d]# mailq mailq: warning: My hostname yogi is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf postqueue: warning: My hostname yogi is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf [root@yogi root]# hostname yogi [root@yogi root]# hostname --fqdn yogi.somedomain.com [root@yogi root]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost # example fake ip and domain name 192.168.1.90 yogi.somedomain.com yogi Version-Release number of selected component (if applicable): postfix-2.0.16-1 How reproducible: Always Steps to Reproduce: 1. start postfix with a default conf file 2. run mailq 3. observe the error message Actual Results: [root@yogi init.d]# mailq mailq: warning: My hostname yogi is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf postqueue: warning: My hostname yogi is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf Expected Results: [root@yogi root]# mailq Mail queue is empty Additional info: Without postfix setup with a fully qualified domain name cron jobs won't function properly. As a work around I had initially just set the hostname: [root@yogi root]# hostname yogi.somedomain.com but that doesn't persist across a reboot after a kernel upgrade :-). I've now capitulated and updated my /etc/postfix/main.cf config file.
Postfix does not require mydomain to be set in main.cf if hostname returns the domain. When the hostname is not FQDN its impossible for postfix to guess correctly and it becomes your responsibility to set it. For example on a multihomed computer which network interface represents the correct domain to use? Even if there is only one network interface gethostbyaddr() may not return a FQDN. Or as you discovered you can reset the hostname at any random point in time to anything of your chosing that may have zero relationship to DNS. In cases where the system is ignorant of its domain, you as the system adminitrator are the only one who knows what domain to use. Thus postfix's behavior is by design and not a bug. Setting the domain in such cases in main.cf is the correct answer as you discovered.
Some private email went back and forth between Mathew and I on this issue. I was going to add it here for tracking purposes but I'm currently suffering with a version of evolution that can't cut and paste mail messages correctly :-( Bottom line is I will make a patch that calls gethostbyaddr() which in most cases will return an FQDN even when gethostname does not.
I'm made a new rpm with the patch, it was built for FC1, you can download it here: ftp://people.redhat.com/jdennis/postfix-2.0.18-5.i386.rpm Please test it, but don't forget to comment out or delete your host name or domain name settings in /etc/postfix/main.cf otherwise we won't really be exercising the patch. A quick sanity test that should work is: % postconf | grep domain
I've installed and tested the package. It appears to behave as intended. $ postconf | grep mydomain yields the correct domain with a default config file. Additionally cron tasks and simple mail commands also go off without a hitch. Thanks and I hope this makes it into the tree so that other default users may benefit.
Thank you for your help in testing.