One of my Azure VM running Ubuntu 22.04 LTS suddenly gives a warning message "<vm name> virtual machine agent status is not ready. Troubleshoot the issue". I recently did some updates and cleaned up the system, it seems the VM agent was destroyed. I've fixed the issue and would like to share the solution.
Check agent status
walinuxagent is there
SSH into the VM and run
apt list --installed | grep walinuxagent
If the agent is alive, it should be listed. In my case, this command did not find the agent.
edi@****:~$ apt list --installed | grep walinuxagent WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reinstall Azure Linux Agent
sudo apt-get install walinuxagent -y
Configure auto update for agent
If you see
AutoUpdate.Enabled=y is comment out like this
# Enable or disable goal state processing auto-update, default is enabled # AutoUpdate.Enabled=y
sudo sed -i 's/# AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf
sudo service walinuxagent restart
Refresh Azure portal
Wait for a few minutes, then refresh Azure portal web page. Do not click the refresh button, it won't update. Refresh the browser with F5!
Now the VM is running fine without warning.
The root cause for me is that I removed Python packages from the system yesterday. Azure Linux Agent uses python. So please do not remove Python packages.
I really appreciate your blog. It's simple, straightforward, meaningful, and easy to understand. Thank you!