Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-6853

NetworkManager hostname lookup fails with IPv6

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Normal Normal
    • None
    • 4.12.0
    • RHCOS
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      When no hostname is defined in /etc/hostname and NetworkManager does reverse DNS address lookup to obtain the hostname, it appears fail with IPv6 while it works successfully with IPv4.
      
      This is with release 4.12
      $ rpm -qa | grep Network
      NetworkManager-libnm-1.36.0-11.el8_6.x86_64
      NetworkManager-ovs-1.36.0-11.el8_6.x86_64
      NetworkManager-1.36.0-11.el8_6.x86_64
      NetworkManager-team-1.36.0-11.el8_6.x86_64
      NetworkManager-cloud-setup-1.36.0-11.el8_6.x86_64
      NetworkManager-tui-1.36.0-11.el8_6.x86_64
      
      I can provide access to a system that always duplicates the failure or get the full journal logs, this is the relevant piece of the journal
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:1 'hostname': completed (6 scripts)
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname': start running ordered scripts...
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/usr/lib/NetworkManager/dispatcher.d/04-iscsi": run script
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/usr/lib/NetworkManager/dispatcher.d/04-iscsi": complete
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/etc/NetworkManager/dispatcher.d/20-chrony-dhcp": run script
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/etc/NetworkManager/dispatcher.d/20-chrony-dhcp": complete
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/etc/NetworkManager/dispatcher.d/20-chrony-onoffline": run script
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/etc/NetworkManager/dispatcher.d/20-chrony-onoffline": complete
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/etc/NetworkManager/dispatcher.d/20-coreos-chrony-dhcp": run script
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/etc/NetworkManager/dispatcher.d/20-coreos-chrony-dhcp": complete
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/etc/NetworkManager/dispatcher.d/90-console-login-helper-messages-gensnippet_if": run script
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname', "/etc/NetworkManager/dispatcher.d/90-console-login-helper-messages-gensnippet_if": complete
      Jan 31 13:57:30 localhost.localdomain nm-dispatcher[1574]: req:3 'hostname': completed (6 scripts)
      Jan 31 13:57:40 localhost.localdomain NetworkManager[1492]: <debug> [1675173460.4973] resolve-addr[d5d01c4a29e36f3c,fd2e:6f44:5dd8:c956::50]: helper returned hostname '(null)'
      Jan 31 13:57:40 localhost.localdomain NetworkManager[1492]: <debug> [1675173460.4973] device[cc347b902d3fc62f] (enp2s0): hostname-from-dns: lookup error for fd2e:6f44:5dd8:c956::50: helper process exited with status 3
      Jan 31 13:58:00 localhost.localdomain systemd[1]: systemd-hostnamed.service: Succeeded.
      
      The hostname is configured in an external dns and if I run at script at boot I'm able to get the hostname successfully, so I'm not sure why NM is failing to get it. This is the script I can use as a workaround:
         ips=$(hostname -I)
         while [[ $ips == "" ]]
         do
            echo "Waiting for IPs to appear for reverse DNS" 1>&2
            sleep 5
            ips=$(hostname -I)
         done   for ip in ${ips}
         do
            echo "Reverse dns for $ip" 1>&2
            hostname=$(dig -x $ip +short)
            # If hostname returned, configure it
            if [[ $hostname != "" ]]; then
               hostnamectl set-hostname "${hostname}"
               echo "Setting hostname to ${hostname}" 1>&2
            fi
         done

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

      How reproducible:

      Every time

      Steps to Reproduce:

      1. Using OCP agent based installer in dev-scripts setup
      2. Run a test with IPv6 and hostname configured in DNS
      3. 
      

      Actual results:

      Hostname does not get resolved and stays at "localhost"

      Expected results:

      Hostname gets set to the value in DNS

      Additional info:

       

              Unassigned Unassigned
              bfournie@redhat.com Robert Fournier
              None
              None
              Michael Nguyen Michael Nguyen
              None
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: