Bugzilla will be upgraded to version 5.0 on December 2, 2018. The outage period for the upgrade will start at 0:00 UTC and have a duration of 12 hours
Bug 605338 - nm doesn't restore entry in /etc/hosts
nm doesn't restore entry in /etc/hosts
Product: Fedora
Classification: Fedora
Component: NetworkManager (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Dan Williams
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2010-06-17 12:46 EDT by Fabrice Bellet
Modified: 2011-06-27 14:28 EDT (History)
1 user (show)

See Also:
Fixed In Version: NetworkManager-0.8.1-4.git20100817.fc13
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-06-27 14:28:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
drop the short old hostname from local mapping (3.64 KB, patch)
2010-12-20 04:07 EST, Fabrice Bellet
no flags Details | Diff

  None (edit)
Description Fabrice Bellet 2010-06-17 12:46:59 EDT
I noticed the following problem with NetworkManager-0.8.1-0.1.git20100510.fc13.x86_64 :

I start nm with hostname = localhost.localdomain, and with /etc/hosts containing " localhost.localdomain localhost", I connect to a network, nm changes the entry like that " <fqdn> localhost.localdomain localhost". When I disconnect from this network, nm doesn't remove <fqdn> from /etc/hosts.

nm_policy_get_etc_hosts() is called with hostname="localhost.localdomain", the statement (found_localhost && found_host) is evaluated to true, so the function returns without building a new /etc/hosts file.
Comment 1 Dan Williams 2010-06-28 15:46:29 EDT
I've reworked the code significantly for another issue (bgo #619931) in master but that's not going to hit 0.8.1.  I guess we can try to fix that in 0.8.1 separately.
Comment 2 Fedora Update System 2010-08-17 13:10:54 EDT
NetworkManager-0.8.1-4.git20100817.fc12 has been submitted as an update for Fedora 12.
Comment 3 Fedora Update System 2010-08-17 13:12:39 EDT
NetworkManager-0.8.1-4.git20100817.fc13 has been submitted as an update for Fedora 13.
Comment 4 Fedora Update System 2010-08-17 13:14:31 EDT
NetworkManager-0.8.1-4.git20100817.fc14 has been submitted as an update for Fedora 14.
Comment 5 Fedora Update System 2010-08-19 16:33:03 EDT
NetworkManager-0.8.1-5.git20100818.fc14 has been submitted as an update for Fedora 14.
Comment 6 Fedora Update System 2010-08-19 22:14:11 EDT
NetworkManager-0.8.1-4.git20100817.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update NetworkManager'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/NetworkManager-0.8.1-4.git20100817.fc13
Comment 7 Fedora Update System 2010-08-23 18:05:35 EDT
NetworkManager-0.8.1-4.git20100817.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2010-08-23 21:20:41 EDT
NetworkManager-0.8.1-5.git20100818.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 9 Fedora Update System 2010-08-31 21:26:25 EDT
NetworkManager-0.8.1-6.git20100831.fc13 has been submitted as an update for Fedora 13.
Comment 10 Fedora Update System 2010-08-31 21:43:25 EDT
NetworkManager-0.8.1-6.git20100831.fc12 has been submitted as an update for Fedora 12.
Comment 11 Fedora Update System 2010-09-26 00:35:02 EDT
NetworkManager-0.8.1-6.git20100831.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 12 Fabrice Bellet 2010-12-17 09:46:17 EST
I reopen this bug, as it appears that there's still a problem in the sense that /etc/hosts is not restored when the wired interface is unplugged, and when the hostname is restored back to localhost.localdomain.

/etc/hosts remains unchanged :

# Do not remove the following line, or various programs
# that require network functionality will fail.	bonobo.example.com	bonobo	# Added by NetworkManager	localhost.localdomain	localhost
::1	bonobo.example.com	bonobo	localhost6.localdomain6	localhost6
Comment 13 Dan Williams 2010-12-19 13:17:03 EST
Note that we've removed all code touching /etc/hosts from NM upstream.  I believe the issue you're experiencing here was already fixed by:


Which all should be present in NetworkManager-0.8.1-9.git20100831.fc12 and later.  What version do you have installed?
Comment 14 Fabrice Bellet 2010-12-20 04:04:38 EST
Hi Dan,

yes, I'm running this version with the three patches included. I see two issues in the current code:

 - the short hostname added to the loopback entry with patch bbf3f12d7b2c79c49d87d41e6cf7b65ac7782071 should be removed when hostname comes back to localhost.localdomain, with a mechanism just like old_hostname. Else, it becomes part of the variable custom6, and remains in the loopback entry.

 - with the /etc/hosts from comment #12, when nm_policy_get_etc_hosts() is called with hostname="localhost.localdomain" and old_hostname="bonobo.example.com", all conditions found_localhost4, found_host4, found_localhost6, found_host6, host4_before, host6_before, no_stale are set to true, and /etc/hosts is not modified. I think that when evaluating the ::1 line, the found_localhost6 should be set conditionally if this line doesn't contain the old_hostname to be removed, ditto for found_localhost4

patch follows.
Comment 15 Fabrice Bellet 2010-12-20 04:07:33 EST
Created attachment 469702 [details]
drop the short old hostname from local mapping

this patch passes the ./test-policy-hosts tests
Comment 16 Bug Zapper 2011-06-02 06:27:22 EDT
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
Comment 17 Bug Zapper 2011-06-27 14:28:27 EDT
Fedora 13 changed to end-of-life (EOL) status on 2011-06-25. Fedora 13 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

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