Problem
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.
Solution
Check agent status
Check if 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
Run
sudo apt-get install walinuxagent -y
Configure auto update for agent
Run
cat /etc/waagent.conf
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
Run
sudo sed -i 's/# AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf
Start agent
Run
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.
Root Cause
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.
Mei
I really appreciate your blog. It's simple, straightforward, meaningful, and easy to understand. Thank you!
JAWAD
I CAV COT ACESS MY VM THROUGH SSH AT SHOW THE THE CONNECTION TIMEOUT