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

amazon-ebs: failed to handshake when upgrading to Packer 1.8.5 #336

Closed
bgaber opened this issue Feb 14, 2023 · 5 comments
Closed

amazon-ebs: failed to handshake when upgrading to Packer 1.8.5 #336

bgaber opened this issue Feb 14, 2023 · 5 comments
Labels

Comments

@bgaber
Copy link

bgaber commented Feb 14, 2023

packer version: v1.8.5
initiator OS: RHEL
guest image OS: RHEL 8
Ansible: 7.2

I am upgrading from Packer version v1.6.6 to v1.8.5 and am seeing this error when building a new AWS EC2 AMI:

2023-02-14T02:30:28Z: ==> amazon-ebs: Provisioning with Ansible...
2023-02-14T02:30:28Z: amazon-ebs: Setting up proxy adapter for Ansible....
2023-02-14T02:30:28Z: ==> amazon-ebs: Executing Ansible: ansible-playbook -e packer_build_name="amazon-ebs" -e packer_builder_type=amazon-ebs --ssh-extra-args '-o IdentitiesOnly=yes' --extra-vars env=sharedservices -e ansible_ssh_private_key_file=/tmp/ansible-key3825398156 -i /tmp/packer-provisioner-ansible2559500676 /drone/src/ansible/linux8.yml
2023-02-14T02:30:32Z: amazon-ebs:
2023-02-14T02:30:32Z: amazon-ebs: PLAY [Build RHEL/CentOS 8.x] ***************************************************
2023-02-14T02:30:32Z: amazon-ebs:
2023-02-14T02:30:32Z: amazon-ebs: TASK [Gathering Facts] *********************************************************
2023-02-14T02:30:32Z: ==> amazon-ebs: failed to handshake
2023-02-14T02:30:32Z: amazon-ebs: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Unable to negotiate with 127.0.0.1 port 42665: no matching host key type found. Their offer: ssh-rsa", "unreachable": true}
2023-02-14T02:30:32Z: amazon-ebs:
2023-02-14T02:30:32Z: amazon-ebs: PLAY RECAP *********************************************************************
2023-02-14T02:30:32Z: amazon-ebs: default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
2023-02-14T02:30:32Z: amazon-ebs:
2023-02-14T02:30:32Z: ==> amazon-ebs: Provisioning step had errors: Running the cleanup provisioner, if present...
2023-02-14T02:30:32Z: ==> amazon-ebs: Terminating the source AWS instance...
2023-02-14T02:33:04Z: ==> amazon-ebs: Cleaning up any extra volumes...
2023-02-14T02:33:04Z: ==> amazon-ebs: No volumes to clean up, skipping
2023-02-14T02:33:04Z: ==> amazon-ebs: Deleting temporary keypair...
2023-02-14T02:33:04Z: Build 'amazon-ebs' errored after 13 minutes 20 seconds: Error executing Ansible: Non-zero exit status: exit status 4

@github-actions
Copy link

Hi 👋 thanks for reaching out.

For general questions we recommend reaching out to the community forum for greater visibility.
As the GitHub issue tracker is only watched by a small subset of maintainers and is really reserved for bugs and enhancements, you'll have a better chance of finding someone who can help you in the forum.
We'll mark this issue as needs-reply to help inform maintainers that this question is awaiting a response.
If no activity is taken on this question within 30 days it will be automatically closed.

If you find the forum to be more helpful or if you've found the answer to your question elsewhere please feel free to post a response and close the issue.

@Glyphack
Copy link
Contributor

Hi @bgaber please provide your packer build file I can take a look.

@lbajolet-hashicorp
Copy link
Contributor

Hi @bgaber,

Since this issue is related to the Amazon plugin, I'll transfer it over to the packer-plugin-amazon project for tracking purposes.

As @Glyphack mentioned, please provide us a redacted/minimal template if possible so we can investigate the reason why this happens.
Also if possible, could you run packer with the PACKER_LOG=1 environment variable set so we have more verbose logs?

Thanks for reporting this.

@lbajolet-hashicorp lbajolet-hashicorp transferred this issue from hashicorp/packer Feb 27, 2023
@haho16
Copy link

haho16 commented Mar 6, 2023

@bgaber I also hit this issue. Check:
hashicorp/packer-plugin-ansible#140
for more information

@lbajolet-hashicorp
Copy link
Contributor

Hi there,

Looking at the logs again, this looks like a problem with Ansible's local proxy connection only offering RSA keys, which is now deprecated and rejected by OpenSSH.

We fixed this by changing the default key algorithm for this in the Ansible plugin not so long ago, so this should be fixed.

I'll close this now, but feel free to reopen if this problem persists, even on the latest versions of the plugin.

Thanks

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

No branches or pull requests

4 participants