Azure/WALinuxAgent

VM Agent Status Perpetually "Not Ready" if user has dhcp disabled for a VM.

SimSama opened this issue · 4 comments

VM is using static IP, DHCP is disabled.
waagent is version v2.8.0.11 installed on Centos 8.2 (upgrading to rocky shortly).

waagent is running, getting this log:
2023-03-08T15:51:58.451299Z WARNING Daemon Daemon Failed to send DHCP request: [DhcpError] timed out

Agent Status for VM in Azure portal is "not ready".

Core Issue:
Agent is hard coded to think dhcp is always enabled, which is not the case here.

Temporary fix that resolves:
cd /usr/local/lib/python/site-packages/azurelinuxagent/common
vi dhcp.py
#Change the following line to the one at the bottom.
#dhcp_available = self.osutil.is_dhcp_available() -- always seems to return true....
dhcp_available = None

systemctl restart waagent

Immediately agent status becomes ready in Azure portal.

I had the same problem on a vendor prepped appliance server running CentOS 8.
Been banging my head at this for hours, this fixed the issue. For me the dhcp.py file was in this folder:

/usr/lib/python3.6/site-packages/azurelinuxagent/common/dhcp.py

Especially for third party appliances, mine comes with a custom script to configure a static IP the check could perhaps be changed to try without DHCP after fails or a waagent.conf parameter should be made to turn it off.