azure-linux-extensions: Ubuntu 20.04 does not provide /usr/bin/env python

Hi,

The latest version of the VM extension still try to call /usr/bin/env python; on Ubuntu 20.04 by default, and on the official azure images, there is no ̀python` alternatives

Error: Code="VMExtensionHandlerNonTransientError" Message="The handler for VM extension type 'Microsoft.Azure.Diagnostics.LinuxDiagnostic' has reported terminal failure for VM extension 'bastion-run-bdu1-euw-dev-vm-linux-diagnostics' with error message: '[ExtensionOperationError] Non-zero exit code: 127, /var/lib/waagent/Microsoft.Azure.Diagnostics.LinuxDiagnostic-3.0.131/diagnostic.py -install\n[stdout]\n\n\n[stderr]\nRunning scope as unit: Microsoft.Azure.Diagnostics.LinuxDiagnostic_3.0.131_e79c79ae-31f1-4d0e-a752-eec0cfcecd4c.scope\n/usr/bin/env: ‘python’: No such file or directory\n'.\r\n    \r\n'Install handler failed for the extension. More information on troubleshooting is available at https://aka.ms/VMExtensionLinuxDiagnosticsTroubleshoot'"

If we really want /usr/bin/env python have to

apt -y install python2-minimal
/usr/bin/update-alternatives --install /usr/bin/python python /usr/bin/python2 1
/usr/bin/update-alternatives --install /usr/bin/python python /usr/bin/python3 2
/usr/bin/update-alternatives --set python /usr/bin/python2

Best regards,

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 18
  • Comments: 17

Most upvoted comments

Seriously, installing python2 while it has been EOL’d for two years is no workaround, and will break new programs which are installed on servers using python3.

Microsoft please fix.

Hi There, I too have the same issue. I am trying to install an upgrade from Azure monitor following the suggestions. It failed with error { "status": "Failed", "error": { "code": "VMExtensionHandlerNonTransientError", "message": "The handler for VM extension type 'Microsoft.Azure.Monitor.VirtualMachines.GuestHealth.GuestHealthLinuxAgent' has reported terminal failure for VM extension 'GuestHealthLinuxAgent' with error message: '[ExtensionOperationError] Non-zero exit code: 127, /var/lib/waagent/Microsoft.Azure.Monitor.VirtualMachines.GuestHealth.GuestHealthLinuxAgent-1.0.41/./scripts/install.py\n[stdout]\n\n\n[stderr]\nRunning scope as unit: install_<GUID>scope\n/usr/bin/env: ‘python’: No such file or directory\n'.\r\n \r\n'Install handler failed for the extension. More information on troubleshooting is available at https://aka.ms/vmextensionlinuxtroubleshoot'" } }

Any solutions or alternative.

It has been issue with Ubuntu 20.04. az vm extension command fails with below error. Is there any solution / resolution for the issue?

Deployment failed. Correlation ID: 33ba85bd-8d79-4675-b840-ae6f40397b4e. The handler for VM extension type ‘Microsoft.Azure.Diagnostics.LinuxDiagnostic’ has reported terminal failure for VM extension ‘LinuxDiagnostic’ with error message: '[ExtensionOperationError] Non-zero exit code: 127, /var/lib/waagent/Microsoft.Azure.Diagnostics.LinuxDiagnostic-4.0.25/diagnostic.py -install [stdout]

[stderr] Running scope as unit: install_0ba886b9-33e7-4ee3-90e7-cf27a2f775da.scope /usr/bin/env: ‘python’: No such file or directory '.

‘Install handler failed for the extension. More information on troubleshooting is available at https://aka.ms/VMExtensionLinuxDiagnosticsTroubleshoot

Still same issue with Ubuntu 20.04 from marketplace

RHEL8 too