From Fedora Project Wiki

Fallback Hostname

Important.png
This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.

Summary

This proposal is for the fallback hostname for server like variants of Fedora to use localhost as the fallback hostname.

Owner


Current status

  • Targeted release: Fedora Linux 37
  • Last updated: 2022-06-10
  • devel thread
  • FESCo issue: #2804
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

In Fedora 33 the default fallback hostname was changed from localhost to fedora for Fedora Linux instances that didn't get the hostname set in any other way (i.e. it's the fallback if it's not set anywhere else). This change came in a systemd update and was never proposed as a change in Fedora itself.

The enablement upstream was in https://github.com/systemd/systemd/pull/5175 and the BZ requesting the change in Fedora was https://bugzilla.redhat.com/show_bug.cgi?id=1392925. The original reasoning being that localhost is a bad hostname for auto-discovery protocols (think avahi) that are useful for more desktop applications.

Unfortunately, this caused issues because setting the hostname via reverse DNS lookups (via NetworkManager) stopped working along with breaking third party tools that set the hostname. The NetworkManager problem was subsequently fixed, but it still remains that a lot of third party software will check to see if an instance's hostname is "unset" by checking the current hostname against the string "localhost". Additionally it appears this change will never be picked up by Fedora's primary downstream in CentOS/RHEL (see https://src.fedoraproject.org/rpms/systemd/c/13d1341b108a24d13f5922054307b5c2efc6836a?branch=rawhide).

The proposal here is to enable variants of Fedora Linux to configure their default/fallback hostname and to set the default for variants targetting servers (Cloud, CoreOS, IoT, Server) to localhost.

Feedback

Benefit to Fedora

With this change Fedora's server-like variants will become more compatible with third party tools that expect a hostname of localhost means the system is unconfigured. It also will mean system administrator's will see localhost and assume the hostname is unconfigured.

Scope

  • Proposal owners:

The feature owners will update the systemd compile time switch for fallback hostname back to localhost. The fedora-release package will be updated such that the Fedora Server, IoT, Cloud, and CoreOS editions will use localhost as the fallback hostname. All other variants of Fedora (the ones that target desktop/laptop uses) will default to fedora as the fallback hostname.

The proposed changes are a relatively small amount of a work.


  • Other developers:

For any variants other than Cloud, CoreOS, IoT, and Server they will see no change. Work with QA to verify other editions continue to have a fallback hostname of fedora.

For Cloud, CoreOS, IoT, and Server the default fallback hostname would be localhost.


No changes needed for release engineering.

  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Objectives: N/A

Upgrade/compatibility impact

There will be NO upgrade impact to systems where:

  • An admin statically set the hostname
  • A hostname was provided to a system via DHCP
  • A hostname was found for a system via reverse DNS lookup

In the case where none of the above are true for a system (i.e. a fallback hostname will be used) the following upgrade impact will be observed:

  • Fedora Cloud: No impact. A booted Fedora Cloud 36 instance has /etc/hostname written by cloud-init on first boot.
  • Fedora CoreOS: No impact. Already using localhost as fallback hostname.
  • Fedora IoT: Some impact. The fallback hostname will change from fedora to localhost after upgrade.
  • Fedora Server: Some impact. The fallback hostname will change from fedora to localhost after upgrade.

For Fedora IoT and Fedora Server we will announce the change and encourage users to statically set a hostname for their machines if they don't want the change in behavior.


How To Test

Boot an instance of the flavor of Fedora you are testing in an environment where there is no DHCP hostname provided and no answer to a reverse DNS lookup for the instance IP. Run hostnamectl hostname and verify that it matches expectation. For Fedora Cloud, CoreOS, IoT, Server it should be localhost. For all others it should be fedora.

User Experience

For Cloud, CoreOS, IoT and Server users will notice intances now default to localhost if a hostname is not provided to an instance by any other means. For all other variants of Fedora there will be no change.

Dependencies

There will be changes to the systemd and fedora-release packages for this change.


Contingency Plan

  • Contingency mechanism: Revert the pull requests to the systemd and fedora-release packages.
  • Contingency deadline: Final Freeze
  • Blocks release? Yes


Documentation

The fallback hostname has now changed to localhost for the Cloud, CoreOS, IoT, and Server variants of Fedora.

Release Notes

The fallback hostname has now changed for the Cloud, CoreOS, IoT, and Server editions of Fedora to localhost. The fallback hostname is the hostname that is set if the hostname cannot be determined by any other mechanism (statically set, DHCP, or reverse DNS). This change was done in order to conform to the common expectation that a hostname of localhost on a system means the hostname is "unset".