Bug 474086 - Install writes out a /etc/hosts file that gives the host the address 127.0.0.1
Install writes out a /etc/hosts file that gives the host the address 127.0.0.1
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: anaconda (Show other bugs)
10
All Linux
low Severity medium
: ---
: ---
Assigned To: David Cantrell
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-01 23:12 EST by David Shaw
Modified: 2009-01-05 12:27 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-12-17 19:58:23 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Shaw 2008-12-01 23:12:24 EST
Description of problem:

After doing a straight F10 install, /etc/hosts contains the hostname of the machine on the "localhost" line.  Since the default /etc/nsswitch.conf contains "hosts: files, dns" (i.e. files first), this makes the machine think that its own IP address is 127.0.0.1

This leads to problems sending mail via sendmail, as sendmail does not directly use the hostname of the machine when creating an outgoing email address.  Rather, it looks up the IP address of the hostname, then looks up the hostname for that IP address.  Thus, sendmail ends up sending a lot of mail coming from "username@localhost.localdomain" which is properly rejected at the recipient site.

Version-Release number of selected component (if applicable):

Anaconda 11.4.1.62-1

Steps to Reproduce:
1. Install F10.
2. Send mail with sendmail.
3. See outgoing mail with the wrong hostname canonicalization.

A simple workaround for this is to simply remove the hostname from the 127.0.0.1 line in /etc/hosts.
Comment 1 David Cantrell 2008-12-04 19:44:28 EST
Did you perform a media install or a network install?  If you do not bring up networking during installation, anaconda will simply write out your hostname to be an additional alias for 127.0.0.1.
Comment 2 David Shaw 2008-12-16 15:38:33 EST
(In reply to comment #1)
> Did you perform a media install or a network install?  If you do not bring up
> networking during installation, anaconda will simply write out your hostname to
> be an additional alias for 127.0.0.1.

Media install.  I did bring up networking during install.
Comment 3 David Cantrell 2008-12-16 23:45:09 EST
Looks like what we need to be doing is just writing the short name to the localhost line rather than the fqdn.  Leftover code from long ago.

Submitted a patch for review.
Comment 4 David Cantrell 2008-12-17 19:58:23 EST
Patch accepted.  Commit ID is cd1101e32b051c568097d8fe33cbe35081ce936d.  Will be in anaconda-11.4.1.59-1.
Comment 5 David Shaw 2008-12-17 22:07:39 EST
(In reply to comment #3)
> Looks like what we need to be doing is just writing the short name to the
> localhost line rather than the fqdn.  Leftover code from long ago.

Is that the best behavior?  Networking was brought up, so the real IP address is known at that point.  Why alias the short hostname to 127.0.0.1 when it can be aliased to the real IP address?
Comment 6 David Cantrell 2008-12-17 23:10:22 EST
(In reply to comment #5)
> (In reply to comment #3)
> > Looks like what we need to be doing is just writing the short name to the
> > localhost line rather than the fqdn.  Leftover code from long ago.
> 
> Is that the best behavior?  Networking was brought up, so the real IP address
> is known at that point.  Why alias the short hostname to 127.0.0.1 when it can
> be aliased to the real IP address?

You will get a line in hosts for your fqdn and real IP address if anaconda can look it up.  If DNS is not working during installation, you won't get that.

Placing the short hostname on the same line as 127.0.0.1 is what we've done for a while to allow things to work when the system is disconnected from the network and you still refer to the system by a name other than localhost.
Comment 7 Steve Dickson 2009-01-05 12:10:35 EST
Adding the non-FQDN hostname (i.e. the short name) to the end of the 
127.0.0.1 line seems to take care of the problem I was having
with the kerberos libs...

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