Azure Arc extension manager installation of AMA fails with noexec on /var?

RobH 20 Reputation points
2025-05-13T07:32:22.9266667+00:00

Installation of Arc extension AzureMonitorLinuxAgent fails with the following message:

{"Blocked":false,"EnableEndTelemetrySent":false,"ErrorMsg":"Extension returned non-zero exit code for Install: 1. Extension error output: std error: Failed to find executable /var/lib/waagent/Microsoft.Azure.Monitor.AzureMonitorLinuxAgent-1.35.1/./shim.sh: Permission denied\n. ","Ext_output_size":12,"ExtensionHash":"xxxxxx","ExtensionName":"AzureMonitorLinuxAgent","ExtensionState":"FAILED_INSTALL","ExtensionVersion":"1.35.1","FailedDownloadCount":0,"IsMultiConfig":false,"MachineId":"xxxxxx","MultiConfigName":"","MultiConfigPropertiesHash":"","MultiConfigServiceRequestId":"","OldExtFormat":false,"ProcessingTime":0,"Publisher":"Microsoft.Azure.Monitor","SequenceNumberFinished":-1,"SequenceNumberStarted":0,"ServiceRequestId":"xxxxxx","Type":"AzureMonitorLinuxAgent","jobId":"xxxxxx"}

The /var filesystem is mounted with no exec. Could this be a problem and how to resolve it?

Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
527 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ashok Gandhi Kotnana 10,430 Reputation points Microsoft External Staff Moderator
    2025-05-16T09:26:45.7166667+00:00

    Hi @RobH,

    azcmagent config info does not expose any option to configure or change the working directory or extension install path for the Azure Arc agent (including extensions like AzureMonitorLinuxAgent).

     This is by design. Azure Arc for servers is intended to provide a consistent, managed experience, and does not currently support customizing extension install directories via agent configuration.

     There’s no documented flag or config to change the install directory of the extension payloads.

     Fix the issue where shim.sh can’t execute (your original error) by:

     Remounting /var without noexec, at least temporarily:

    sudo mount -o remount,exec /var

     Or relocating /var/lib/waagent to a path without noexec:

    sudo mkdir /opt/waagent 
    sudo cp -a /var/lib/waagent/* /opt/waagent/
    sudo mv /var/lib/waagent /var/lib/waagent.bak
    sudo ln -s /opt/waagent /var/lib/waag
    
    

    Please let me know if you face any challenge here, I can help you to resolve this issue further

    Provide your valuable Comments.

    User's image

    Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Alex Burlachenko 11,610 Reputation points
    2025-05-13T08:43:03.76+00:00

    Hi RobH,

    Thanks for reaching out about this issue. The error you’re seeing indicates that the installation of the AzureMonitorLinuxAgent extension is failing because it cannot execute the shim.sh script located in /var/lib/waagent/. This is likely due to the /var filesystem being mounted with the noexec option, which prevents the execution of binaries or scripts from that location.

    To resolve this, you have a couple of options. First, you could remount the /var filesystem without the noexec option, though this may not be ideal for security reasons if your environment requires it. Alternatively, you can configure the Azure Arc agent to use a different directory for extension operations, one that is not mounted with noexec. This can be done by modifying the agent’s working directory in its configuration.

    Best regards,
    Alex
    P.S. If my answer help to you, please Accept my answer
    PPS That is my Answer and not a Comment
    http://ctrlaltdel.blog/
    

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.