Azure / azure-linux-extensions

Linux Virtual Machine Extensions for Azure
Apache License 2.0
301 stars 251 forks source link

AzureMonitorLinuxAgent cant install with python 3.8 and newer #1925

Open xQuai opened 1 month ago

xQuai commented 1 month ago

Hello everyone,

we have two virtual machines with Ubuntu 22.04 and Ubuntu 20.04 and connected them to Azure Arc. The installation of AzureMonitorLinuxAgent is triggered in Azure Arc via a data collection rule. The installation is not successful on both machines and terminates with Error 52. We performed the installation once manually by executing the command python3 waagent -install manually under /var/lib/waagent/Microsoft.Azure.Monitor.AzureMonitorLinuxAgent. This gives us the following error message:

Traceback (most recent call last):
  File "waagent", line 6795, in <module>
    main()
  File "waagent", line 6716, in main
    LinuxDistro = DistInfo()[0]
  File "waagent", line 6544, in DistInfo
    return platform.dist()
AttributeError: module 'platform' has no attribute 'dist'

The function platform.dist() from the module platform has been removed in python 3.8. The distro module must be used as an alternative.

Deprecation platform.dist: https://docs.python.org/3.7/library/platform.html#platform.dist

Is there a way to install AzureMonitorLinuxAgent with a newer version than Ubuntu 18.04?

Greetings, Quai