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.03k stars 323 forks source link

Unable to update SSM agent via AWS System Manager #433

Closed ovidiumpp closed 2 years ago

ovidiumpp commented 2 years ago

I'm running an older Ubuntu 14.04.6 with AWS SSM agent 3.1.715.0 amazon-ssm-agent 3.1.715.0 5163 latest/stable aws✓ classic

Why it cannot automatically update to 3.1.1080 ? tail errors.txt

2022-03-17 06:50:14 ERROR [Submit @ processor.go.140] [ssm-agent-worker] [MessagingDeliveryService] [Association] [associationId=983247a6-1a3f-42cc-99cc-070fe2113070] Document Submission failed: Job with id 983247a6-1a3f-42cc-99cc-070fe2113070 already exists 2022-03-17 09:59:42 ERROR [AppendError @ context.go.129] failed to install amazon-ssm-agent 3.1.1080.0, ErrorMessage=The execution of command returned Exit Status: 124 exit status 124

tail AmazonSSMAgent-update.txt Updating amazon-ssm-agent from 3.1.715.0 to 3.1.1080.0 Successfully downloaded https://s3.us-east-1.amazonaws.com/amazon-ssm-us-east-1/amazon-ssm-agent/3.1.715.0/amazon-ssm-agent-ubuntu-amd64.tar.gz Successfully downloaded https://s3.us-east-1.amazonaws.com/amazon-ssm-us-east-1/amazon-ssm-agent/3.1.1080.0/amazon-ssm-agent-ubuntu-amd64.tar.gz Initiating amazon-ssm-agent update to 3.1.1080.0 failed to install amazon-ssm-agent 3.1.1080.0, ErrorMessage=The execution of command returned Exit Status: 124 exit status 124 failed to install amazon-ssm-agent 3.1.1080.0, ErrorMessage=The execution of command returned Exit Status: 124 exit status 124 Failed to update amazon-ssm-agent to 3.1.1080.0 No rollback needed

danr-amz commented 2 years ago

Thank you for reaching out. The exit code of 124 likely indicates that the install script was not able to recognize the platform. This exit code originates from one of two places:

Can you please run the following command and provide us with the output?

cat /proc/1/comm
ovidiumpp commented 2 years ago

Thank you! Please find the output:

cat /proc/1/comm
init

It's using "init" instead of "systemd". Also, I know now that I should switch from "stable" to "candidate" channel, in order to retrieve latest version.

ovidiumpp commented 2 years ago

Manually update via "snap" is working on instance: ` snap refresh amazon-ssm-agent

amazon-ssm-agent (candidate) 3.1.1080.0 from Amazon Web Services (aws✓) refreshed `

gianniLesl commented 2 years ago

Closing as the issue seems to be resolved

ovidiumpp commented 2 years ago

The issue occurs again with Ubuntu 14.04 / initd - the automatic update via AWS System Manager does not happen. On instances with Ubuntu 16.04 / systemd autoupdate is fine. ` 2022-05-13 18:13:33 DEBUG output s3 bucket name is 2022-05-13 18:13:33 DEBUG getting platform details 2022-05-13 18:13:33 DEBUG fetching platform details from /etc/os-release 2022-05-13 18:13:33 DEBUG Command output &{Ubuntu 14.04} 2022-05-13 18:13:33 DEBUG getting platform details 2022-05-13 18:13:33 DEBUG fetching platform details from /etc/os-release 2022-05-13 18:13:33 DEBUG Command output &{Ubuntu 14.04} 2022-05-13 18:13:33 DEBUG Calling UpdateInstanceInformation with params{ AgentName: "amazon-ssm-agent", AgentStatus: "UpdateFailed_ErrorUnsupportedServiceManager-3.1.1374.0-NoAlarm", AgentVersion: "3.1.1260.0", ComputerName: "hostname", IPAddress: "x.x.x.x.", InstanceId: "i-xxxxxxxxxxxxxxxxx", PlatformName: "Ubuntu", PlatformType: "Linux", PlatformVersion: "14.04" } 2022-05-13 18:13:33 DEBUG UpdateInstanceInformation Response{

} 2022-05-13 18:13:33 INFO initiating cleanup of other versions in amazon-ssm-agent and amazon-ssm-agent-updater folder 2022-05-13 18:13:33 INFO removing artifacts in the folder: /var/lib/amazon/ssm/update/amazon-ssm-agent 2022-05-13 18:13:33 INFO removed files and folders: 3.1.1374.0 2022-05-13 18:13:33 INFO removing artifacts in the folder: /var/lib/amazon/ssm/update/amazon-ssm-agent-updater 2022-05-13 18:13:33 INFO removed files and folders: 2022-05-13 18:13:33 INFO initiating cleanup of files in update download folder 2022-05-13 18:13:33 INFO Successfully downloaded manifest Successfully downloaded updater version 3.1.1374.0 Updating amazon-ssm-agent from 3.1.1260.0 to 3.1.1374.0 Successfully downloaded https://s3.eu-central-1.amazonaws.com/amazon-ssm-eu-central-1/amazon-ssm-agent/3.1.1260.0/amazon-ssm-agent-ubuntu-amd64.tar.gz Successfully downloaded https://s3.eu-central-1.amazonaws.com/amazon-ssm-eu-central-1/amazon-ssm-agent/3.1.1374.0/amazon-ssm-agent-ubuntu-amd64.tar.gz Initiating amazon-ssm-agent update to 3.1.1374.0 failed to install amazon-ssm-agent 3.1.1374.0, ErrorMessage=The execution of command returned Exit Status: 124 exit status 124 failed to install amazon-ssm-agent 3.1.1374.0, ErrorMessage=The execution of command returned Exit Status: 124 exit status 124 Failed to update amazon-ssm-agent to 3.1.1374.0 No rollback needed

` Is there any way to fix ? Thanks!