Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 42739 - Handbook suggestion for /etc/hosts breaks "hostname -f"
Summary: Handbook suggestion for /etc/hosts breaks "hostname -f"
Status: RESOLVED FIXED
Alias: None
Product: [OLD] Docs-user
Classification: Unclassified
Component: Handbook (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Sven Vermeulen (RETIRED)
URL: http://www.gentoo.org/doc/en/handbook...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-24 04:46 UTC by Siegbert Baude
Modified: 2004-03-07 04:01 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Siegbert Baude 2004-02-24 04:46:13 UTC
In the above mentioned URL you state that:

If your system is the only system (or the nameservers handle all name resolution) a single line is sufficient: 
Code listing 19: /etc/hosts for lonely or fully integrated PCs
127.0.0.1     localhost   tux

Here tux is the name of your computer. But if you follow this advice you get the following:
# cat /etc/hostname
lilith
# cat /etc/dnsdomainname
mydomain
# cat /etc/hosts
127.0.0.1       localhost lilith
# hostname
lilith
# hostname -f
localhost
lilith root # dnsdomainname

The last two results are not wanted. Compare the following:

# cat /etc/hosts
127.0.0.1       localhost
# hostname
lilith
# hostname -f
lilith.mydomain
# dnsdomainname
mydomain

So, please change the recommendation to read only:
127.0.0.1 localhost #no hostname here; I sometimes read aliases like localhost.mydomain 
192.68.0.1 tux      #in case of no DNS available

Reproducible: Always
Steps to Reproduce:
1. Read the instructions in the handbook
2. Adopt the settings as described
3. use hostname -f and dnsdomainname	

Actual Results:
Comment 1 Sven Vermeulen (RETIRED) gentoo-dev 2004-03-07 04:01:17 UTC
Updated; thanks!