Azure / WALinuxAgent

Microsoft Azure Linux Guest Agent
http://azure.microsoft.com/
Apache License 2.0
543 stars 372 forks source link

[BUG] Sometimes cannot publish hostname #3165

Open yuxisun1217 opened 3 months ago

yuxisun1217 commented 3 months ago

Describe the bug: A clear and concise description of what the bug is.

Sometimes after changing hostname, the nmcli fails to modify eth0 dhcp-hostname, and the hostname cannot be published Reproduce rate: ~10%

waagent.log:

2024-07-29T07:39:44.742927Z INFO EnvHandler ExtHandler EnvMonitor: Detected hostname change: walaauto95d1v24 -> walaauto95d1v25
2024-07-29T07:39:44.759943Z VERBOSE EnvHandler ExtHandler Command: [service NetworkManager restart]
2024-07-29T07:39:44.963589Z INFO EnvHandler ExtHandler Examine /proc/net/route for primary interface
2024-07-29T07:39:44.965679Z INFO EnvHandler ExtHandler Primary interface is [eth0]
2024-07-29T07:39:44.986179Z VERBOSE EnvHandler ExtHandler Command: [nmcli device modify eth0 ipv4.dhcp-hostname walaauto95d1v25 ipv6.dhcp-hostname walaauto95d1v25]
2024-07-29T07:39:45.055011Z ERROR EnvHandler ExtHandler Command: [nmcli device modify eth0 ipv4.dhcp-hostname walaauto95d1v25 ipv6.dhcp-hostname walaauto95d1v25], return code: [6], result: [Error: Reapplying connection to device 'eth0' (/org/freedesktop/NetworkManager/Devices/2) failed: Device is not activated
]
2024-07-29T07:39:45.055495Z ERROR EnvHandler ExtHandler failed to set DHCP hostname for interface eth0: return code 6
2024-07-29T07:39:45.055980Z INFO EnvHandler ExtHandler Examine /proc/net/route for primary interface
2024-07-29T07:39:45.056561Z INFO EnvHandler ExtHandler Primary interface is [eth0]
2024-07-29T07:39:45.066097Z VERBOSE EnvHandler ExtHandler Command: [ip link set eth0 down && ip link set eth0 up]

Steps to reproduce Prepare a VM on Azure with waagent service started. Change hostname, and check if the hostname is published to the DNS hostnamectl set-hostname walacheck1 sleep 30s-1min nslookup $(hostname)

Distro and WALinuxAgent details (please complete the following information): RHEL-9.5 WALinuxAgent-2.7.0.6-10.el9.noarch

maddieford commented 3 months ago

@yuxisun1217 Thanks for opening this issue. Improving hostname publishing on Rhel 8/9 is a high priority item for us, we'll look into this soon.