Bug 679000 - /etc/hosts file shoulde be updated when changing hostname by system-config-network
Summary: /etc/hosts file shoulde be updated when changing hostname by system-config-ne...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: system-config-network
Version: 5.5
Hardware: i386
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Harald Hoyer
QA Contact: Branislav Blaškovič
URL:
Whiteboard:
Depends On:
Blocks: 1049888
TreeView+ depends on / blocked
 
Reported: 2011-02-21 09:04 UTC by Hu Xiang
Modified: 2014-09-16 00:17 UTC (History)
5 users (show)

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.
Clone Of:
Environment:
Last Closed: 2014-09-16 00:17:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1195 0 normal SHIPPED_LIVE system-config-network bug fix update 2014-09-16 04:14:20 UTC

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


Note You need to log in before you can comment on or make changes to this bug.