aws / amazon-ssm-agent

An agent to enable remote management of your EC2 instances, on-premises servers, or virtual machines (VMs).
https://aws.amazon.com/systems-manager/
Apache License 2.0
1.06k stars 326 forks source link

M1 macOS unable to start an SSM agent #464

Closed zaremba-tomasz closed 1 year ago

zaremba-tomasz commented 2 years ago

Hi,

I've noticed that when SSM agent is trying to start on macOS with M1 chip instance it's ending up with the following error:

2022-08-25 09:51:34 ERROR [func1 @ coremanager.go.269] [ssm-agent-worker] [instanceID=i-071aadb4b1fda969c] Plugin (MessageService) failed to stop with error: timeout stopping module MessageService
2022-08-25 09:52:06 ERROR [collectPlatformDependentInstanceData @ dataProvider_darwin.go.58] [ssm-document-worker] [7f0bb2d8-dad7-4d83-bd5c-6c8863fd986f.2022-08-25T09-52-05.969Z] [DataBackend] [pluginName=aws:softwareInventory] [aws:softwareInventory] Failed to execute command : sysctl [machdep.cpu.brand_string hw.physicalcpu hw.logicalcpu hw.cpufrequency hw.cputhreadtype]; with error: exit status 1
2022-08-25 10:26:38 ERROR [collectPlatformDependentInstanceData @ dataProvider_darwin.go.58] [ssm-document-worker] [7f0bb2d8-dad7-4d83-bd5c-6c8863fd986f.2022-08-25T10-26-38.799Z] [DataBackend] [pluginName=aws:softwareInventory] [aws:softwareInventory] Failed to execute command : sysctl [machdep.cpu.brand_string hw.physicalcpu hw.logicalcpu hw.cpufrequency hw.cputhreadtype]; with error: exit status 1

The reason for that is hw.cputhreadtype oid which is not recognized on M1:

> sysctl hw.cputhreadtype
sysctl: unknown oid 'hw.cputhreadtype'

One of the solutions would consist of adding -i flag to the sysctl call which will cause that not recognized oid will be ignored.

gianniLesl commented 1 year ago

This was fixed in agent v3.2.419.0