Bug 1093037
Summary: | localhost.localdomain in wrong order /etc/hosts | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Eduard Barrera <ebarrera> |
Component: | setup | Assignee: | Martin Osvald 🛹 <mosvald> |
Status: | CLOSED WONTFIX | QA Contact: | BaseOS QE - Apps <qe-baseos-apps> |
Severity: | low | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.0 | CC: | bhoefer, dmoessne, fedora, jpopelka, jscotka, mosvald, mruprich, ovasik, vashirov |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2019-06-19 15:23:31 UTC | Type: | Bug |
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: | 1203710, 1398314, 1451294 |
Description
Eduard Barrera
2014-04-30 13:12:47 UTC
I don't think that 'localdomain', 'localdomain4' and 'localdomain6' make any sense unless you are forced to specify a domain. Therefore IMO the following contents of /etc/hosts would be perfectly valid. 127.0.0.1 localhost ::1 localhost I would even go as far as saying that 'localhost' should be a keyword for the resolver and shouldn't need any content in /etc/hosts. Since the times of IPv4 and IPv6 dualstack, I would actually discourage any aliases in /etc/hosts. If you insist on having 'localhost4' and 'localhost6' available (why?), it should be ok to add them to the respective lines: 127.0.0.1 localhost localhost4 ::1 localhost localhost6 If you insist on having any of 'localhost.localdomain' and the 4/6 suffix variants (again, why?), you can just add them like it is shown in the actual result part of the bug report. My preference would be to avoid them entirely as there's no actual 'localdomain'. When typing the host name, IMO the only thing 'localdomain' serves is to add a dot into the host name so that it's considered a FQDN by any tools that could check by just looking for a dot. The 'localdomain4' and 'localdomain6' seem to serve no purpose as even in the DNS you don't have IPv4 and IPv6 domains, just host names with A result, AAAA result or both. Reasons for having localhost4 and localhost6 are described in https://bugzilla.redhat.com/show_bug.cgi?id=483244 - localhost6 was introduced by anaconda, so it was kept... Approach with not having .localdomain* aliases is used by gentoo and suggested in https://bugzilla.redhat.com/show_bug.cgi?id=483244#c3 . We can change the entry either by switching localhost and localhost.domain order in /etc/hosts - or by removing the .localdomain* entries - both seem to be fine - right? (In reply to Ondrej Vasik from comment #4) > Reasons for having localhost4 and localhost6 are described in > https://bugzilla.redhat.com/show_bug.cgi?id=483244 - localhost6 was > introduced by anaconda, so it was kept... Then we can consider 'localhost6' a backwards compatibility measure and 'localhost4' its logical counterpart to avoid any doubt about the dualstack nature of localhost. > Approach with not having > .localdomain* aliases is used by gentoo and suggested in > https://bugzilla.redhat.com/show_bug.cgi?id=483244#c3 . According to your comment there localhost6.localdomain6 was already being used. > We can change the entry either by switching localhost and localhost.domain > order in /etc/hosts I would rather keep localhost as the canonical hostname. > - or by removing the .localdomain* entries - both seem > to be fine - right? If you agree that it's time to remove all *.localdomain* entires, I'd go with it. In any case, I would advocate keeping localhost first so that we don't change the semantics of reverse queries for 127.0.0.1 and ::1 that resolve to 'localhost'. Adding myself to the CC field because I (before I knew better) and a customer, long ago, hit this bug. When one edits the /etc/hosts file, it is natural to add lines that look like what is already there. Thus, this: 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 has caused users to enter something like: 192.168.1.1 testmachine testmachine.example.com ...even though the man page states the FQDN should come 1st. My opinion is that we don't need to change this for a RHEL6 minor release, or maybe even a RHEL 7 minor release -- since, as Pavel Šimerda mentioned in comment #5 there is a concern over how this change could affect localhost queries. However, it would be nice if it was corrected for RHEL8. I am a new maintainer of setup package and got to this when going through the existing BZs to check what can get on RHEL7.8 RPL. given the fact: * this has been opened for 5 years already - so nobody is really pushing to get it fixed * the same setting/behavior is here for *years* / the same behavior is (was) on RHEL5, RHEL6, RHEL7, RHEL8 and Fedora (30) - there are surely tools out there expecting this behavior * RHEL7.8 will be in Maintenance Phase 1 (no RFEs/rebases) * this is low prio BZ, low impacting problem * there is only 1 customer, low prio case attached - if this was something really wanted, I would expect dozens of them * workaround exists Therefore closing this as WONTFIX, it wouldn't be wise to do this change such late for RHEL7. Hi, Martin. Congrats on being the new maintainer of the setup package, and thanks for taking a look at this ticket. While I agree that this is a very low priority, I sure would like to see it corrected. It sets a bad example for us to provide a file whose lines are incorrectly formatted (according to the "man hosts" page). It causes the hostname to give incorrect output if the machine doesn't have a user-provided host name set. And finally, users who go to add their own /etc/hosts entries often format them to look like the lines we have provided -- meaning theirs will also be wrong. I agree that changing it for RHEL 5, 6 and 7 is not wise at this stage in their life cycles. I could even understand it for RHEL 8. But we should correct it in whatever comes after RHEL 8. I guess to do that, should I re-open this bug against Fedora 30 so to get it in Fedora, first? Hello Bernie, thank you for the needinfo! I planned to clone it for Fedora, but I somehow overlooked to do so due to different BZ, so just did it now: Bug 1724539 - localhost.localdomain in wrong order /etc/hosts Otherwise, I agree that we should fix it. Interestingly, RHEL4 was the last RHEL which had the expected order, but hostname & hostname -f returned the same thing at that time: ~~~ [root@localhost ~]# cat /etc/redhat-release Red Hat Enterprise Linux AS release 4 (Nahant Update 8) [root@localhost ~]# [root@localhost ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost [root@localhost ~]# [root@localhost ~]# hostname localhost.localdomain [root@localhost ~]# hostname -f localhost.localdomain [root@localhost ~]# [root@localhost ~]# hostname -h ... -s, --short short host name -a, --alias alias names -i, --ip-address addresses for the hostname -f, --fqdn, --long long host name (FQDN) -d, --domain DNS domain name -y, --yp, --nis NIS/YP domainname -F, --file read hostname or NIS domainname from given file ... [root@localhost ~]# [root@localhost ~]# hostname -s localhost [root@localhost ~]# hostname -a localhost [root@localhost ~]# hostname -d localdomain [root@localhost ~]# ~~~ I will try to dig into the history of this change to find out why it was done this way. |