aws / aws/session-manager-plugin

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

Open
#70 0 comments 6 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
320
Forks
97
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.