Seamless active directory domain join not working with Ubuntu
I am trying to join an EC2 instance to active directory through the AWS console. When trying to join the domain, it will error with this message:
/var/lib/amazon/ssm/i-05a2f74fc04941b0e/document/orchestration/23e2b956-6d96-4031-a55e-fb7c240d9d34/2023-11-29T21-35-29.248Z/awsdomainJoin/aws_domainjoin.sh: 737: [: 22.04: unexpected operator
/var/lib/amazon/ssm/i-05a2f74fc04941b0e/document/orchestration/23e2b956-6d96-4031-a55e-fb7c240d9d34/2023-11-29T21-35-29.248Z/awsdomainJoin/aws_domainjoin.sh: 740: [: UBUNTU: unexpected operator
Which seems to be cause by one of the bootstrap scripts. Since the script does a comparison to check if it's an Amazon Linux AMI, I tried joining an Amazon Linux EC2 instance to the domain and it worked.
SSM Agent Version: 3.2.1377.0 OS: Ubuntu 22.04
I saw this issue today as well. The issue has to do with these lines according to the error output:
https://github.com/aws/amazon-ssm-agent/blob/3dee01c80ab7a3d06abc4dbe4648283162bf7516/agent/plugins/domainjoin/domainjoin_unix_script.go#L834 https://github.com/aws/amazon-ssm-agent/blob/3dee01c80ab7a3d06abc4dbe4648283162bf7516/agent/plugins/domainjoin/domainjoin_unix_script.go#L844 https://github.com/aws/amazon-ssm-agent/blob/3dee01c80ab7a3d06abc4dbe4648283162bf7516/agent/plugins/domainjoin/domainjoin_unix_script.go#L847
I believe the problem might be the == comparison operator rather than a single = operator to compare strings. It appears that a single = is used for string comparisons everywhere else in the script. When I cat the script from the error output I see that it starts with #!/bin/sh. I believe == is a non-posix compliant bash syntax that may not work with /bin/sh