LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   problem encountered after changing hostname (https://www.linuxquestions.org/questions/linux-software-2/problem-encountered-after-changing-hostname-340453/)

thanhvn 07-06-2005 12:26 AM

problem encountered after changing hostname
 
My machine is on a private LAN connected to a router (with DHCP enabled) and Fedora Core 4 assigned it the uninformative default name locaIhost.localdomain. I wanted to change the default name of my machine to something more informative.

First I tried using the command hostname. The command executed successfully but when I did "hostname -f" I got the error "hostname: unknown host"

So I edited /etc/hosts which now contains a single line "127.0.0.1 newhostname newhostname". I rebooted, but the machine name did not change, as evidenced by the login screen, the output of the command "hostname", and the prompt.

Then I edited /etc/sysconfig/network to set "NETWORK=newhostname". During reboot, "Starting sendmail" took an unreasonable long time (which was never this long before) such that I thought the machine has hang. After I finally logged in, I saw that the machine name has changed, as evidenced by the login screen, the output of the command "hostname", and the prompt. I was able to ping my machine's IP address, 127.0.0.1, newhostname, and localhost.

Does anyone know how to fix the problem of sendmail taking a freakishly long time to start? Thanks for any help.

Pete M 07-06-2005 05:05 PM

thanhvn

This is totally from memory because I'm currently in Gentoo which uses a different format

/etc/hosts

127.0.0.1 hostname.domainname hostname localhost.localdomain

As an example

127.0.0.1 server.linuxquestions.org server localhost.localdomain

/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=server

Obviously "server" comes from the example above

Pete

thanhvn 07-07-2005 02:01 PM

Pete, I don't have a problem changing the hostname (read my post carefully). The problem I have is that after successfully changing the hostname, the sendmail service takes an unreasonably long time to start. What I want to know is how to fix that.

madluther 07-07-2005 02:15 PM

This startup delay is most likey caused by sendmail not being able to resolve the host name, the host name is usually defined in the file /etc/mail/local-host-names . Change the entry in that file to match your new host name and the delays should be gone.

HTH

Mad.

Pete M 07-07-2005 03:25 PM

thanhvn

Sorry I did'nt understand your exact problem but as madluther stated if sendmail can't determine it's host name then this will cause a delay

As it checks /etc/hosts for this the format of the file must be correct

Pete

thanhvn 07-08-2005 12:16 AM

After several trials and errors, I finally figured out the solution to the problem. The value of the parameter inet_interfaces in /etc/postfix/main.cf must match one of the values in /etc/hosts. By default inet_interfaces is set to localhost. And since I've changed /etc/hosts to no longer contain localhost, this caused the problem. So I changed /etc/hosts to "127.0.0.1 localhost.localdomain localhost newhostname" and the problem is solved (and my machine name is still changed to newhostname as I originally set out to do). Thanks for all the help.

Pete M 07-08-2005 01:36 AM

thanhvn

Glad you got the problem fixed, but the correct information in the first place may have speeded up the process

Original post
Quote:

During reboot, "Starting sendmail" took an unreasonable long time
Last post
Quote:

The value of the parameter inet_interfaces in /etc/postfix/main.cf must match one of the values in /etc/hosts
Sendmail or Postfix ?

Have fun

Pete


All times are GMT -5. The time now is 03:00 AM.