Bug 679000

Summary: /etc/hosts file shoulde be updated when changing hostname by system-config-network
Product: Red Hat Enterprise Linux 5 Reporter: Hu Xiang <cnhuxiang>
Component: system-config-networkAssignee: Harald Hoyer <harald>
Status: CLOSED ERRATA QA Contact: Branislav Blaškovič <bblaskov>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.5CC: bblaskov, cnhuxiang, harald, lmiksik, psklenar
Target Milestone: rc   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previously, when changing host names using the system-config-network service, the service did not remove the old host name from the /etc/hosts/ directory and did not add the new host name. This update applies a patch to fix this bug so that /etc/hosts now contains the updated host name as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-16 00:17:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1049888    

Description Hu Xiang 2011-02-21 09:04:13 UTC
Description of problem
======================
I created several VMware virtual machines based on the same template of RHEL server 5.5. I'd like to give these virtual machines different hostnames so that they can work in the same netwrok. I changed the hostname of my RHEL server by using the system-config-network utility (run 'setup' -> select 'Network Configuration' -> select 'Edit DNS configuration'). After I saved my new hostname and tried to reboot the system, problem happenned. The system takes 10 more minutes to startup than that before I changed the hostname. After I login the gnome desktop, it was also much slower than before... I can say that I can't use the system after I changed the hostname.

I tried RHEL server 5.6, it's much better than 5.5. It still need more time to response after I changed the hostname, but that's already acceptable for me.

Finally, I found the root cause. The entry '127.0.0.1   my_old_hostname' in /etc/hosts isn't up-to-date. I think many services may depend on this entry. Then I updated the /etc/hosts file manually and rebooted the system. My system can work as fast as that before I changed the hostname.


Version-Release number of selected component (if applicable)
============================================================
system-config-network 1.3.99.18 in RHEL server 5.5


How reproducible
================
Always reproducible


Steps to Reproduce
==================
1. Run 'setup' in terminal and select 'Network Configuration'(Or run system-config-network utility in gnome desktop environment)
2. Change hostname by the utility in step 1
3. Reboot system
4. Check /etc/hosts file

  
Actual results
==============
/etc/hosts didn't be updated, 127.0.0.1 is still mapped to the old hostname


Expected results
================
/etc/hosts should be updated, 127.0.0.1 should be mapped to the new hostname


Additional info
===============
N/A

Comment 4 Branislav Blaškovič 2014-05-14 13:14:45 UTC
If I change hostname, /etc/hosts line with localhost is just appending with new hostname. No matter if there is this hostname already. After some hostname playing it can look like this:

127.0.0.1	localhost.localdomain	localhost	rhel5	rhel5changed	rhel5

Is this desired?

I would prefer the way: > remove old hostname, > add new hostname

Comment 5 Harald Hoyer 2014-06-03 11:02:51 UTC
(In reply to Branislav Blaškovič from comment #4)
> If I change hostname, /etc/hosts line with localhost is just appending with
> new hostname. No matter if there is this hostname already. After some
> hostname playing it can look like this:
> 
> 127.0.0.1	localhost.localdomain	localhost	rhel5	rhel5changed	rhel5
> 
> Is this desired?
> 
> I would prefer the way: > remove old hostname, > add new hostname

yes. bug. will fix

Comment 6 Branislav Blaškovič 2014-06-03 11:03:39 UTC
Thank you. Switching to assigned.

Comment 7 Harald Hoyer 2014-06-03 11:44:03 UTC
system-config-network-1.3.99.23-1.el5

Comment 8 Branislav Blaškovič 2014-06-04 11:05:18 UTC
Great, now it works without duplicates.

Testing on system-config-network-1.3.99.23-1.el5

Comment 10 errata-xmlrpc 2014-09-16 00:17:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1195.html