[RHEL5] 'hostname -i' and 'hostname -d' fails with error 'Unknow host'
Environment
- Red Hat Enterprise Linux 5.5
- net-tools-1.60-81.el5.x86_64
- nscd-2.5-58.el5_6.3.x86_64
Issue
- Our customer encountered a problem that 'hostname -i' and 'hostname -d' return 'Unknown host'.
# hostname -i
hostname: Unknown host
- hostname command without any options works correctly.
- When nscd stops, 'hostname -i' and 'hostname -d' work as expected.
- DNS server can't resolve an IP address for the host.
Resolution
It seems permission on /etc/hosts is improper. Please correct it, and confirm if the issue is resolved.
$ tar tvf sosreport-xxxxxxxx-133441-b08173.tar.bz2._xxx_.bz2 '*etc/hosts'
-rw------- root/root 433 2013-04-05 10:11 xxxxxxxx-133441/etc/hosts
Diagnostic Steps
Accessing to /etc/hosts was refused. It must be the root cause.
6075 12:28:05.615806 open("/etc/hosts", O_RDONLY) = -1 EACCES (Permission denied)
Also, permission on /etc/hosts is improper. That's the reason that accessing was refused.
$ tar tvf sosreport-xxxxxxxx-133441-b08173.tar.bz2._xxx_.bz2 '*etc/hosts'
-rw------- root/root 433 2013-04-05 10:11 xxxxxxxx-133441/etc/hosts
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
