Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSM Agent Installation fails if already installed #1500

Closed
pjaudiomv opened this issue Oct 31, 2023 · 3 comments
Closed

SSM Agent Installation fails if already installed #1500

pjaudiomv opened this issue Oct 31, 2023 · 3 comments

Comments

@pjaudiomv
Copy link
Contributor

pjaudiomv commented Oct 31, 2023

What happened:
When custom AMI already has SSM agent the packer build fails

What you expected to happen:
skip the package gracefully

How to reproduce it (as minimally and precisely as possible):
Use CIS Amazon Linux 2 Benchmark - STIG as base AMI
Returns Error:

2023-10-31T14:04:19-04:00:     amazon-ebs: Examining /var/tmp/yum-root-DVDoG9/amazon-ssm-agent.rpm: amazon-ssm-agent-3.2.1705.0-1.x86_64
2023-10-31T14:04:19-04:00:     amazon-ebs: /var/tmp/yum-root-DVDoG9/amazon-ssm-agent.rpm: does not update installed package.
2023-10-31T14:04:19-04:00:     amazon-ebs: Error: Nothing to do

Anything else we need to know?:

This worked until v20230816 release.

If I just run sudo yum install -y amazon-ssm-agent in install-worker.sh the build runs fine. It doesn't not when specifying an RPM package sudo yum install -y https://s3.${BINARY_BUCKET_REGION}.${S3_DOMAIN}/amazon-ssm-${BINARY_BUCKET_REGION}/${SSM_AGENT_VERSION}/linux_${ARCH}/amazon-ssm-agent.rpm

This relates to #685

Maybe just adding a check for agent or/and agent version would suffice.

Environment:

  • AWS Region: us-gov-west-1
  • Instance Type(s): m5.large
  • EKS Platform version (use aws eks describe-cluster --name <name> --query cluster.platformVersion):
  • Kubernetes version (use aws eks describe-cluster --name <name> --query cluster.version): 1.27.6
  • AMI Version: AL2 Stig AMI
  • Kernel (e.g. uname -a):
  • Release information (run cat /etc/eks/release on a node):
@cartermckinnon cartermckinnon changed the title SSM Agent Installation breaks Packer runs SSM Agent Installation fails if already installed Nov 1, 2023
@cartermckinnon
Copy link
Member

Feel free to open a PR, you can do a check like this to only install when necessary:

# Remove the ec2-net-utils package, if it's installed. This package interferes with the route setup on the instance.
if yum list installed | grep ec2-net-utils; then sudo yum remove ec2-net-utils -y -q; fi

@pjaudiomv
Copy link
Contributor Author

Feel free to open a PR, you can do a check like this to only install when necessary:

# Remove the ec2-net-utils package, if it's installed. This package interferes with the route setup on the instance.
if yum list installed | grep ec2-net-utils; then sudo yum remove ec2-net-utils -y -q; fi

Thanks just did here #1501

@pjaudiomv
Copy link
Contributor Author

Fixed with merging of #1501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants