azure-pipelines-agent: VM extension TeamServicesAgentLinux fails with ModuleNotFoundError

Context

I have generated a Linux VM image (Ubuntu 20.04) using Packer, based on scripts used by Microsoft Hosted agents. The goal is to have similar machine to run Self-Hosted agents and to instantiate it thanks to the VM scale set pools on Azure DevOps.

VM image is generated and works fine. It is based on latest commits from main branch of actions/virtual-environments repository.

What’s not working?

After creating a VM scale set on Azure based on generated VM image, and after using this VM scale set with a new VM scale set pool on Azure DevOps, an agent is instantiated using a VM extension: Microsoft.VisualStudio.Services.TeamServicesAgentLinux

The problem is that we get an error during execution of this VM extension:

[ExtensionOperationError] Non-zero exit code: 1, /var/lib/waagent/Microsoft.VisualStudio.Services.TeamServicesAgentLinux-1.21.0.0/AzureRM.py [stdout] [stderr] Running scope as unit: Microsoft.VisualStudio.Services.TeamServicesAgentLinux_1.21.0.0_c99d6fee-757e-488d-9f10-158b724a33bc.scope Traceback (most recent call last): File "/var/lib/waagent/Microsoft.VisualStudio.Services.TeamServicesAgentLinux-1.21.0.0/AzureRM.py", line 9, in <module> import Utils.HandlerUtil as Util File "/var/lib/waagent/Microsoft.VisualStudio.Services.TeamServicesAgentLinux-1.21.0.0/Utils/HandlerUtil.py", line 62, in <module> import RMExtensionStatus ModuleNotFoundError: No module named 'RMExtensionStatus'

It seems Python scripts cannot run using Python version 3:

TeamServicesAgentLinux extension version used: 1.21.0.0

How to solve the issue?

  • Is there a more recent version of TeamServicesAgentLinux extension available and compliant with Python3?
  • If yes, could it be used by Azure DevOps for the VM scale set pools?
  • Is the source code of this extension is available somewhere?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 13
  • Comments: 28 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Hi all, we are working on a fix for this, and will soom rollout. We will update on the rollout progress.

I was able to just install python3 and have everything work fine. I did not need to create a symlink for python > python3. As a separate issue, I had to install git 2.x which was a hassle, but this problem was not too bad for me to workaround. I put a custom script extension on my VMSS to run sudo yum -y install python3. Unfortunately, RHEL8 is not yet approved for our use, but RHEL7 stops having this error with the installation of python3.

@tejasd1990 Any update on this? Following up on our Azure support case 120121724004184, and they keep pointing us to get updates here. I am a colleague of the poster above @chandlerkent

As a workaround, you may add the following two lines to

apt-get remove -y python-is-python3
apt-get install -y python-is-python2

the bottom of “/images/linux/scripts/base/repos.sh” ,and remove the line

"python-is-python3"

in images/linux/toolsets/toolset-2004.json.

(This is an unofficial suggestion, I’m not part of the team)