admin管理员组

文章数量:1419182

I am trying to set up an AVD in an Azure DevOps pipeline using these two guidelines:

  • Microsoft documentation
  • Independent guide

The articles state, that the AVD should be runnable in the default hosted build agent from Microsoft, but it is not working for me because of a missing virtualization.

ERROR        | x86 emulation currently requires hardware acceleration!
CPU acceleration status: KVM requires a CPU that supports vmx or svm

I tried Ubuntu and macOS agents but still no luck (contradicting these a few years old articles).

I was able to get it running when I used custom-build agents using the D4ads v5 virtual machine in Azure.

Maybe I overlooked something and there is a way to simulate/enable the virtualization? Or did Microsoft change the build agents' HW configuration meanwhile and there is no chance to run AVD on the default agents? I would prefer to use the default build agents for simplicity and other anizational reasons.

I ended up with this script breaking the pipeline if the HW is not suitable:

set -e

MESSAGE="Virtualization is not enabled. Ensure you run this pipeline on a VM that supports nested virtualization."

if [[ "$OSTYPE" == "darwin"* ]]; then
  if ! sysctl -a | grep -q 'machdep.cpu.features' | grep -q 'VMX'; then
    echo $MESSAGE
    exit 1
  fi
else
  if [ $(egrep -c '(vmx|svm)' /proc/cpuinfo) -eq 0 ]; then
    echo $MESSAGE
    exit 1
  fi
fi

echo "It looks like HW virtualization is enabled"

I am trying to set up an AVD in an Azure DevOps pipeline using these two guidelines:

  • Microsoft documentation
  • Independent guide

The articles state, that the AVD should be runnable in the default hosted build agent from Microsoft, but it is not working for me because of a missing virtualization.

ERROR        | x86 emulation currently requires hardware acceleration!
CPU acceleration status: KVM requires a CPU that supports vmx or svm

I tried Ubuntu and macOS agents but still no luck (contradicting these a few years old articles).

I was able to get it running when I used custom-build agents using the D4ads v5 virtual machine in Azure.

Maybe I overlooked something and there is a way to simulate/enable the virtualization? Or did Microsoft change the build agents' HW configuration meanwhile and there is no chance to run AVD on the default agents? I would prefer to use the default build agents for simplicity and other anizational reasons.

I ended up with this script breaking the pipeline if the HW is not suitable:

set -e

MESSAGE="Virtualization is not enabled. Ensure you run this pipeline on a VM that supports nested virtualization."

if [[ "$OSTYPE" == "darwin"* ]]; then
  if ! sysctl -a | grep -q 'machdep.cpu.features' | grep -q 'VMX'; then
    echo $MESSAGE
    exit 1
  fi
else
  if [ $(egrep -c '(vmx|svm)' /proc/cpuinfo) -eq 0 ]; then
    echo $MESSAGE
    exit 1
  fi
fi

echo "It looks like HW virtualization is enabled"
Share Improve this question edited Jan 29 at 11:06 Lukas K asked Jan 29 at 10:57 Lukas KLukas K 6,4194 gold badges26 silver badges33 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The error indicates Microsoft-hosted agent doesn't support necessary hardware acceleration for x86 emulation.

As per the doc, it used virtual machines Standard_DS2_v2 as microsoft-hosted agent. It's recommended to setup the self-hosted agent which support the feature required.

本文标签: Run Android UI Tests in a AVD in Azure DevOps pipelineStack Overflow