Tuesday, March 19, 2013

sendmail:Unable to qualify my own domain name in Solaris 10


How to resolve "Unable to qualify my own domain name" error


You may have received this error in /var/adm/messages

Symptom 1:

tail -f  /var/adm/messages
Mar 13 11:15:16 myserver sendmail[8420]: [ID 702911 mail.crit] My unqualified host name (myserver.) unknown; sleeping for retry
Mar 13 11:15:16 myserver sendmail[8421]: [ID 702911 mail.crit] My unqualified host name (myserver.) unknown; sleeping for retry
Mar 13 11:16:16 myserver sendmail[8421]: [ID 702911 mail.alert] unable to qualify my own domain name (myserver.) -- using short name
Mar 13 11:16:16 myserver sendmail[8420]: [ID 702911 mail.alert] unable to qualify my own domain name (myserver.) -- using short name

Symptom 2:

when you try to manually telnet localhost 25 or mailx, either you can send to a particular domain or the respond is very slow after entering the "mail from" command.

Resolution:

update /etc/hosts ( and /etc/inet/ipnodes if you are on solaris 10) to use the following.
root@myserver:>more /etc/hosts
# internet host table
#====================
127.0.0.1 localhost
10.106.127.105 myserver. myserver
10.106.63.32 myserver-rsc

Description:
Usually i would add the "myserver." with the dot behind to /etc/hosts but in Solaris 10, things work a little differently.

It turn out that in solaris 10, the OS will go through /etc/inet/ipnodes for IPv4 address before going to /etc/hosts.

In this case, since ldap does not have the entry, OS will go straight to /etc/inet/ipnodes.

This also mean that if you change the host IP of the solaris 10 server, please change in /etc/inet/ipnodes as well otherwise you have conflict of IP addresses.

Note that this is Solaris specific.

# man ipnodes
...
...
NOTES
IPv4 addresses can be defined in the ipnodes file or in the
hosts file. See hosts(4). The ipnodes file will be searched
for IPv4 addresses when using the getipnodebyname(3SOCKET)
API. If no matching IPv4 addresses are found in the ipnodes
file, then the hosts file will be searched. To prevent
delays in name resolution and to keep /etc/inet/ipnodes and
/etc/inet/hosts synchronized, IPv4 addresses defined in the
hosts file should be copied to the ipnodes file.
...
..

The other ways to disable the message is following :-


Disable the sendmail service in Solaris 10;

*1)* Check that SendMail is under SMF control (older Solaris 10 releases didn't have SMF, if I recall correctly)
root@blade ~# svcs -l svc:/network/smtp:sendmail
fmri         svc:/network/smtp:sendmail
name         sendmail SMTP mail transfer agent
enabled      true
state        online
next_state   none
state_time   Fri Jun 06 01:15:58 2008
logfile      /var/svc/log/network-smtp:sendmail.log
restarter    svc:/system/svc/restarter:default
contract_id  142 
dependency   require_all/refresh file://localhost/etc/mail/sendmail.cf (online)
dependency   require_all/refresh file://localhost/etc/nsswitch.conf (online)
dependency   optional_all/none svc:/system/filesystem/autofs (online)
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   require_all/none svc:/network/service (online)
dependency   require_all/refresh svc:/milestone/name-services (online)
dependency   optional_all/refresh svc:/system/identity:domain (online)
dependency   optional_all/none svc:/system/system-log (online)
root@blade ~ # 
*2)* Disable the SendMail service;
root@blade ~ # ps -ef|grep sendmail
root  2669     1   0 01:16:59 ?           0:00 /usr/lib/sendmail -bd -q15m -C /etc/mail/local.cf
smmsp  2667     1   0 01:16:59 ?           0:00 /usr/lib/sendmail -Ac -q15m
root  2950  2788   0 01:56:18 pts/1       0:00 grep sendmail
root@blade ~ # svcadm disable svc:/network/smtp:sendmail
root@blade ~ # ps -ef | grep sendmail
root@blade ~ #
However, if your interested in stopping the error without disabling SendMail, you can attempt a few things;

*1)* Set the hostname to the desired FQDN;
root@blade ~ # hostname
blade
root@blade ~ # hostname blade.example.com
root@blade ~ # hostname
blade.example.com
root@blade ~ #
*2)* Set the default domain name;
root@blade ~ # echo "example.com" > /etc/defaultdomain
root@blade ~ # cat /etc/defaultdomain
example.com
root@blade ~ #
*3)* Use the "domainname" command to set the default domain
root@blade ~ # domainname example.com
root@blade ~ # domainname
example.com
root@blade ~ #
Note: Just using the "domainname" command is not persistent across reboots, the /etc/defaultdomain file is read by the system at boot up, and it should contain just the desired domain ("example.com"). Doing a "domainname" after a reboot when the /etc/defaultdomain file is set will return the domain name.

*4)* Check the entry in /etc/hosts;
A fresh install of Solaris 10 (Update 5) left me with the following (even though I setup DNS during the OS install);
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
192.168.1.200   blade   loghost
What fixed the SendMail error for me was changing it to the following;
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
192.168.1.200   blade.example.com blade loghost 
I hope this helps!

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. There is noticeably a lot of money to know about this. I suppose you have made specific nice points in features also. Premium Domains

    ReplyDelete