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

"session-manager-plugin": executable file not found in $PATH on RHEL 9.x #70

Open
GuillaumeBourque-QC opened this issue May 15, 2023 · 0 comments

Comments

@GuillaumeBourque-QC
Copy link

Hello All,

we have an AlmaLinux 9.x (RHEL 9.x) install with latest aws cli (via zip) and session-manager-plugin via RPM. Both tool works under AlmaLinux for a normal user.

Note that on our AlmaLinux root does not have /usr/local/bin/ in the PATH, but our packer code is never run under root. the session manager plugin is installed in /usr/local/bin under RHEL 9.x.

Problem:

When we used packer to build new AMI with aws ssm (ssm is used to connect to the AMI that Packer is building) we have a PATH error : (this is the packer log)

==> ami.amazon-ebs.qc-ami: exec: "session-manager-plugin": executable file not found in $PATH

[199](https://github.com/..../actions/runs/.......#step:8:200)2023/05/11 14:11:09 packer-builder-amazon-ebs plugin: Executing: session-manager-plugin [{"SessionId":"PackerBuild-alma-9-ami-x86_64-base--0b56ec16b31d7bade","StreamUrl":"wss://ssmmessages.ca-central-1.amazonaws.com/v1/data-channel/PackerBuild-alma-9-ami-x86_64-base--0b56ec16b31d7bade?role=publish_subscribe","TokenValue":"......."} ca-central-1 StartSession {"DocumentName":"AWS-StartPortForwardingSession","Parameters":{"localPortNumber":["8426"],"portNumber":["22"]},"Reason":null,"Target":"i-xxxxxxxxxxxx"} wss://ssmmessages.ca-central-1.amazonaws.com/v1/data-channel/PackerBuild-alma-9-ami-x86_64-base--0b5....?role=publish_subscribe]

[200](https://github.com==/.../actions/runs/..........#step:8:201)2023/05/11 14:11:09 packer-builder-amazon-ebs plugin: ssm: Starting PortForwarding session to instance i-xxxxxxxxxxxx

[201](https://github.com/......../actions/runs/xxxxxxx/jobs/885xxx2#step:8:202)ami.amazon-ebs.qc-ami: Starting portForwarding session "PackerBuild-alma-9-ami-x86_64-base--xxxxxxxx".

In aws ssm log we see that the ssm client try to start de session and that the target try to start also, but the ssm tunnel never get open and we get those errors

==> ami.amazon-ebs.qc-ami: exec: "session-manager-plugin": executable file not found in $PATH

This error message get repeted over and over and never finish.

Solution:

Simply adding a link in /usr/local/sbin for session-manager-plugin make everything works.

Question:

My Question: why do we need to have the session-manager-plugin in root PATH ( since the root user is not part of our packer code pipeline)

I'm sharing so that other can apply the same fix if you get stuck.

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

1 participant