Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This is in regards to Scientific Linux 6.1 system, but should also apply to CentOS 6.1 & RHEL 6.1.

I am setting up a new Scientific Linux 6.1 system, using kickstart and DHCP (via xCAT). This machine should be named `'host2.example.org'.

I see that some programs are unable to resolving the hostname of this system.

It seems that RedHat 6 no longer puts a hostname into /etc/hosts (See bug 668830 and RedHat KB DOC-57321 (login required)). In addition, the hostname is not defined in /etc/sysconfig/network.

# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
# hostname
host2
# hostname --long
hostname: Host name lookup failure

I was expecting to see the hostname in /etc/sysconfig/network , but it's not there. Shouldn't something (like NetworkManager) put the hostname into a file somewhere? If so, why is there no HOSTNAME line in my /etc/sysconfig/network? Should Kickstart or Anaconda do this?

For CentOS/SL 5.6, I believe the hostname was always added to /etc/hosts.

share|improve this question

1 Answer 1

I also had this problem -- SL6.2 didn't set the hostname correctly at boot, which prevented all sorts of things from working. I finally changed this line in /etc/sysconfig/network to specify the desired host.domain name instead of "localhost.localdomain":

HOSTNAME=localhost.localdomain

That seems to do the trick. I won't bother to try to find out why this is not done automagically during installation....

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.