Re: Revisiting the hostname/FQDN issue, adding libnss-myhostname
On Fri, Oct 24, 2025 at 01:35:13AM +0000, Thorsten Glaser wrote:
why we are writing an /etc/hosts with "127.0.1.1 apollo.example.com apollo"
Hah! *rubs hands* Hostnames on unixoid systems… a pet peeve.
First off, that 127.0.1.1 has to go. There are active changes
underways to change the 127/8 allocation to an 127/24 one, to
free more IPv4 addresses. (Just passing on, don’t talk to me
about this one.)
Then the Installer should change to 127.0.0.2, doing the same like
libnss-myhostname.
Then.
/etc/hosts.
I’ve worked best with the following setup:
1. If any IP or Legacy IP address is statically assigned to
the box (“inet static”/“inet6 static” in /e/n/i, or even
it’s known that the host has a reservation on the dhcpd)
then add lines of the form “$ip $fqdn ${fqdn%%.*}"
2. If there is any Legacy IP statically assigned as in 1,
then add additionally “127.0.0.1 localhost”ᵃ,
else add additionally “127.0.0.1 $fqdn ${fqdn%%.*} localhost”ᵇ
3. Add the remaining IP entries like ::1ᶜ
The Installer has been doing it with the 127.0.1.1 step for decades. I
think there is a reason for that.
Additionally, /etc/{host,my}name or however the OS calls the fileᵉ
the kernel nodename is loaded from (which will be the result of the
bare “hostname” command without -f/-s) m̲u̲s̲t̲ ̲c̲o̲n̲t̲a̲i̲n̲ ̲t̲h̲e̲ ̲F̲Q̲D̲N̲!
This is contrary to the documentation. And I am not sure what an MTA
will do here.
This
is not what Debian currently does but is necessary and will lead to
only minor fallout (like the FQDN shown in the too-short field of
KDM’s greeter) that’s easily handled by s/\..*$// in affected code,
but will result in a MUCH better overall operation.
Did we have a discussion about that in Debian already? If not, we should
have it now.
The /etc/domainname or whatever fills the kernel’s domainname must
be empty or nōn-existent, as that’s only used for NIS/YP, which you
don’t use.
I don't have that file on any of my systems that I have looked.
I also tend to have “search ${fqdn#*.} [other relevant domains]”
in /etc/resolv.conf.
I tend to not have search in my resolv.conf at all.
It’s early enough in the release cycle that such a switch and the
fixing of those softwares that need a “cut off” implemented can
still happen.
Yes. We should make up our minds now.
ⓐ or “127.0.0.1 localhost localhost.localdomain”, though I
only picked up the latterᵈ on GNU systems
ⓑ orᵃ “127.0.0.1 $fqdn ${fqdn%%.*} localhost localhost.localdomain”,
I think that localhost.localdomain is always wrong.
ⓒ I currently am using the following:
::1 ip6-localhost ip6-loopback localhost6 localhost6.localdomain6
Also those localhost6/localdomain6 stuff we should NOT use.
I picked these up, again, mostly on GNU systems (Debian and RPM kinds)
and dropped bare “localhost” from it; things currently overall tend to
work slightly better if “localhost” only resolves to 127.0.0.1 and not
to ::1 (as well or only). Again, that “localhost6.localdomain6” likely
isn’t neededᵈ
That makes IPv6 a second class citizen. It is not, it is the default
protocol.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
Reply to: