Azure DevOps: ./config.sh: line 85: ./bin/Agent.Listener: cannot execute binary file: Exec format error

Summary

Registering a Deployment Group agent for Azure DevOps generates the following error using the Linux registration script on a Linux ARM 32-bit operating system (such as Raspberry Pi):

./config.sh: line 85: ./bin/Agent.Listener: cannot execute binary file: Exec format error

Change the link to the agent package in the default registration script from Linux-x64 to ARM.

from 'vsts-agent-linux-x64-2.173.0.tar.gz' to 'vsts-agent-linux-arm-2.173.0.tar.gz'

The resulting registration script will look similar to the following:

mkdir azagent;cd azagent;curl -fkSL -o vstsagent.tar.gz https://vstsagentpackage.azureedge.net/agent/2.173.0/vsts-agent-linux-arm-2.173.0.tar.gz;tar -zxvf vstsagent.tar.gz; if [ -x "$(command -v systemctl)" ]; then ./config.sh --deploymentpool --deploymentpoolname "SandboxDeploy" --acceptteeeula --agent $HOSTNAME --url https://dev.azure.com/torben/ --work _work --runasservice; sudo ./svc.sh install; sudo ./svc.sh start; else ./config.sh --deploymentpool --deploymentpoolname "SandboxDeploy" --acceptteeeula --agent $HOSTNAME --url https://dev.azure.com/torben/ --work _work; ./run.sh; fi

Note: version numbers (2.173.0) are updated over time so the above referenced versions may have changed since this writing. The deployment pool name and Azure DevOps account will also be unique to the setup.

Re-run the registration script and the exec format error should be resolved with a processor / agent match.

Description

After executing the deployment group registration on a Linux ARM processor architecture, the agent may fail to start with the following error:

The ‘Exec format error’ indicates that the application was not compiled for the target processor architecture, ARM 32-bit. In reviewing the registration script, it becomes clearer that the script is pulling an agent for a Linux x64 target architecture:

Unfortunately, there is not a mechanism to select the processor type on the deployment pool registration screen as it only has the kernel (Windows or Linux) as an option, not processor architecture ARM or x64/x86. However, the deployment group targets are based on the same agent application used for Agent Pools so we can get the Url for the ARM version by going to Agent Pools, add an Agent, and select Linux : ARM.

vsts-agent-linux-arm-2.173.0.tar.gz
Azure DevOps image for Add Agent and selecting kernal and processor architecture for the agent binary

Next we change the original Deployment Group registration script by replacing

vsts-agent-linux-x64-2.173.0.tar.gz

with the arm version and rerun the updated deployment group registration script.

mkdir azagent;cd azagent;curl -fkSL -o vstsagent.tar.gz https://vstsagentpackage.azureedge.net/agent/2.173.0/vsts-agent-linux-arm-2.173.0.tar.gz;tar -zxvf vstsagent.tar.gz; if [ -x "$(command -v systemctl)" ]; then ./config.sh --deploymentpool --deploymentpoolname "SandboxDeploy" --acceptteeeula --agent $HOSTNAME --url https://dev.azure.com/torben/ --work _work --runasservice; sudo ./svc.sh install; sudo ./svc.sh start; else ./config.sh --deploymentpool --deploymentpoolname "SandboxDeploy" --acceptteeeula --agent $HOSTNAME --url https://dev.azure.com/torben/ --work _work; ./run.sh; fi

As the processor architecture now matches ARM 32-bit, the registration should succeed with the agent running as a service.

Image of Linux console showing the deployment group agent as active and running as a service

The agent will now be available for handling Azure DevOps Pipeline Releases and perform deployments to the target resource(s).

Next Steps

  • Presumably this is a temporary solution until the Azure DevOps user interface for Deployment Groups gets updated to match the Agent Pool kernel and processor selection or equivalent.
  • For multi-processor agent pools, refer to ‘Targeting multi-processor architectures with Azure DevOps‘ for additional details.

3 thoughts on “Azure DevOps: ./config.sh: line 85: ./bin/Agent.Listener: cannot execute binary file: Exec format error

  1. Thank you sir for this. It’s sad that we still get this error in July 2022.
    Your post saved me a lot of pain and man hours.

  2. Worked for work raspbian 64 bit,you saved my day,shame on you microsoft ! It’s iot age and we are striving to find work arounds !!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.