Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-55730

Confusing behavior when the static hostname is 'localhost'

    • No
    • Moderate
    • rhel-sst-network-management
    • ssg_networking
    • 3
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • Hide

      Given a system administrator sets the static hostname to "localhost" in /etc/hostname,

      When NetworkManager starts or the system reboots,

      Then, NetworkManager should recognize that a static hostname is already set and should not attempt to resolve a transient hostname via DNS. 

      Definition of Done: 

      • The implementation meets the acceptance criteria
      • Integration tests are written and pass
      • The code is part of a downstream build attached to an errata
      Show
      Given a system administrator sets the static hostname to "localhost" in /etc/hostname, When NetworkManager starts or the system reboots, Then, NetworkManager should recognize that a static hostname is already set and should not attempt to resolve a transient hostname via DNS.  Definition of Done:  The implementation meets the acceptance criteria Integration tests are written and pass The code is part of a downstream build attached to an errata
    • None
    • None
    • None

      What were you trying to do that didn't work?

      If the static hostname in /etc/hostname is set to "localhost", NetworkManager ignores it (here) and tries to determine the transient hostname via different means such as DHCP or reverse DNS lookup. After it finds a valid transient hostname, it tells systemd-hostnamed to set it; however the transient hostname is ignored by systemd-hostnamed because there is already a static hostname set.

      This behavior is confusing: if there is already a static hostname NetworkManager should not even start the machinery to determine the transient hostname, because that is unnecessary work; and especially because when reading the log it is not clear why the transient hostname is not being set in the system, as there is no error or warning.

      The considerations above apply only when using systemd-hostnamed. If the service is not available, NetworkManager reads /etc/hostname by itself and sets the hostname directly in kernel. In that case, it will set the "transient" hostname in kernel even if /etc/hostname contains "localhost".

      Please provide the package NVR for which bug is seen:

      1.42.2, 1.49-dev, probably all versions since at least 5 years

      How reproducible:

      Always

      Steps to reproduce

      1. hostnamectl hostname localhost
      2. restart NM or reboot

      Expected results

      NetworkManager does not try to resolve the transient hostname via DNS. Instead it logs that there is already a static hostname set.

      Actual results

      NetworkManager resolves the hostname via DNS, and sets the transient hostname via systemd-hostnamed. Hower, that doesn't work and there is no error in the logs.

       

              rh-ee-sfaye Stanislas Faye
              bgalvani@redhat.com Beniamino Galvani
              Network Management Team Network Management Team
              Vladimir Benes Vladimir Benes
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: