packer-plugin-ansible
packer-plugin-ansible copied to clipboard
Ansible Provisionner auto-generated keys are blank (Linux)
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Overview of the Issue
When Packer is generating a keypair to use the Ansible provisioner, the generated public key file is empty. This results in a libcrypto failure.
Reproduction Steps
This repository is here to reproduce the issue: https://github.com/Wenzel/bug_report/tree/packer/ansible/libcrypto_error
git clone https://github.com/Wenzel/bug_report -b 'packer/ansible/libcrypto_error'
and then
make build
Packer version
Packer v1.9.4
Operating system and Environment details
- Ubuntu 23.04
Log Fragments and crash.log files
qemu.ubuntu: fatal: [default]: UNREACHABLE! => changed=false
qemu.ubuntu: msg: |-
qemu.ubuntu: Failed to connect to the host via ssh: OpenSSH_9.0p1 Ubuntu-1ubuntu8.4, OpenSSL 3.0.8 7 Feb 2023
qemu.ubuntu: debug1: Reading configuration data /home/wenzel/.ssh/config
qemu.ubuntu: debug3: kex names ok: [[email protected],diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1]
qemu.ubuntu: debug1: Reading configuration data /etc/ssh/ssh_config
qemu.ubuntu: debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
qemu.ubuntu: debug1: /etc/ssh/ssh_config line 21: Applying options for *
qemu.ubuntu: debug2: resolve_canonicalize: hostname 127.0.0.1 is address
qemu.ubuntu: debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/wenzel/.ssh/known_hosts'
qemu.ubuntu: debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/wenzel/.ssh/known_hosts2'
qemu.ubuntu: debug1: auto-mux: Trying existing master
qemu.ubuntu: debug1: Control socket "/home/wenzel/.ansible/cp/487625204a" does not exist
qemu.ubuntu: debug3: ssh_connect_direct: entering
qemu.ubuntu: debug1: Connecting to 127.0.0.1 [127.0.0.1] port 4395.
qemu.ubuntu: debug3: set_sock_tos: set socket 3 IP_TOS 0x10
qemu.ubuntu: debug2: fd 3 setting O_NONBLOCK
qemu.ubuntu: debug1: fd 3 clearing O_NONBLOCK
qemu.ubuntu: debug1: Connection established.
qemu.ubuntu: debug3: timeout: 10000 ms remain after connect
qemu.ubuntu: debug1: identity file /tmp/ansible-key3234825831 type -1
qemu.ubuntu: debug1: identity file /tmp/ansible-key3234825831-cert type -1
qemu.ubuntu: debug1: Local version string SSH-2.0-OpenSSH_9.0p1 Ubuntu-1ubuntu8.4
qemu.ubuntu: debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.7
qemu.ubuntu: debug1: compat_banner: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.7 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
qemu.ubuntu: debug2: fd 3 setting O_NONBLOCK
qemu.ubuntu: debug1: Authenticating to 127.0.0.1:4395 as 'vagrant'
qemu.ubuntu: debug3: put_host_port: [127.0.0.1]:4395
qemu.ubuntu: debug1: load_hostkeys: fopen /home/wenzel/.ssh/known_hosts2: No such file or directory
qemu.ubuntu: debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
qemu.ubuntu: debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
qemu.ubuntu: debug3: order_hostkeyalgs: no algorithms matched; accept original
qemu.ubuntu: debug3: send packet: type 20
qemu.ubuntu: debug1: SSH2_MSG_KEXINIT sent
qemu.ubuntu: debug3: receive packet: type 20
qemu.ubuntu: debug1: SSH2_MSG_KEXINIT received
qemu.ubuntu: debug2: local client KEXINIT proposal
qemu.ubuntu: debug2: KEX algorithms: [email protected],curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
qemu.ubuntu: debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256
qemu.ubuntu: debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
qemu.ubuntu: debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
qemu.ubuntu: debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
qemu.ubuntu: debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
qemu.ubuntu: debug2: compression ctos: [email protected],zlib,none
qemu.ubuntu: debug2: compression stoc: [email protected],zlib,none
qemu.ubuntu: debug2: languages ctos:
qemu.ubuntu: debug2: languages stoc:
qemu.ubuntu: debug2: first_kex_follows 0
qemu.ubuntu: debug2: reserved 0
qemu.ubuntu: debug2: peer server KEXINIT proposal
qemu.ubuntu: debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
qemu.ubuntu: debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
qemu.ubuntu: debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
qemu.ubuntu: debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
qemu.ubuntu: debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
qemu.ubuntu: debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
qemu.ubuntu: debug2: compression ctos: none,[email protected]
qemu.ubuntu: debug2: compression stoc: none,[email protected]
qemu.ubuntu: debug2: languages ctos:
qemu.ubuntu: debug2: languages stoc:
qemu.ubuntu: debug2: first_kex_follows 0
qemu.ubuntu: debug2: reserved 0
qemu.ubuntu: debug1: kex: algorithm: curve25519-sha256
qemu.ubuntu: debug1: kex: host key algorithm: ssh-ed25519
qemu.ubuntu: debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: [email protected]
qemu.ubuntu: debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: [email protected]
qemu.ubuntu: debug3: send packet: type 30
qemu.ubuntu: debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
qemu.ubuntu: debug3: receive packet: type 31
qemu.ubuntu: debug1: SSH2_MSG_KEX_ECDH_REPLY received
qemu.ubuntu: debug1: Server host key: ssh-ed25519 SHA256:IY9hFW6Z/t3JlLDCerSAs7+CkOYrV83gDUXyCaHs6VM
qemu.ubuntu: debug3: put_host_port: [127.0.0.1]:4395
qemu.ubuntu: debug3: put_host_port: [127.0.0.1]:4395
qemu.ubuntu: debug1: load_hostkeys: fopen /home/wenzel/.ssh/known_hosts2: No such file or directory
qemu.ubuntu: debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
qemu.ubuntu: debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
qemu.ubuntu: debug1: checking without port identifier
qemu.ubuntu: debug1: load_hostkeys: fopen /home/wenzel/.ssh/known_hosts2: No such file or directory
qemu.ubuntu: debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
qemu.ubuntu: debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
qemu.ubuntu: Warning: Permanently added '[127.0.0.1]:4395' (ED25519) to the list of known hosts.
qemu.ubuntu: debug1: check_host_key: hostkey not known or explicitly trusted: disabling UpdateHostkeys
qemu.ubuntu: debug3: send packet: type 21
qemu.ubuntu: debug2: ssh_set_newkeys: mode 1
qemu.ubuntu: debug1: rekey out after 134217728 blocks
qemu.ubuntu: debug1: SSH2_MSG_NEWKEYS sent
qemu.ubuntu: debug1: expecting SSH2_MSG_NEWKEYS
qemu.ubuntu: debug3: receive packet: type 21
qemu.ubuntu: debug1: SSH2_MSG_NEWKEYS received
qemu.ubuntu: debug2: ssh_set_newkeys: mode 0
qemu.ubuntu: debug1: rekey in after 134217728 blocks
qemu.ubuntu: debug1: get_agent_identities: bound agent to hostkey
qemu.ubuntu: debug1: get_agent_identities: agent returned 2 keys
qemu.ubuntu: debug1: Will attempt key: /tmp/ansible-key3234825831 explicit
qemu.ubuntu: debug2: pubkey_prepare: done
qemu.ubuntu: debug3: send packet: type 5
qemu.ubuntu: debug3: receive packet: type 7
qemu.ubuntu: debug1: SSH2_MSG_EXT_INFO received
qemu.ubuntu: debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
qemu.ubuntu: debug3: receive packet: type 6
qemu.ubuntu: debug2: service_accept: ssh-userauth
qemu.ubuntu: debug1: SSH2_MSG_SERVICE_ACCEPT received
qemu.ubuntu: debug3: send packet: type 50
qemu.ubuntu: debug3: receive packet: type 51
qemu.ubuntu: debug1: Authentications that can continue: publickey,password
qemu.ubuntu: debug3: start over, passed a different list publickey,password
qemu.ubuntu: debug3: preferred gssapi-with-mic,gssapi-keyex,hostbased,publickey
qemu.ubuntu: debug3: authmethod_lookup publickey
qemu.ubuntu: debug3: remaining preferred: ,gssapi-keyex,hostbased,publickey
qemu.ubuntu: debug3: authmethod_is_enabled publickey
qemu.ubuntu: debug1: Next authentication method: publickey
qemu.ubuntu: debug1: Trying private key: /tmp/ansible-key3234825831
qemu.ubuntu: Load key "/tmp/ansible-key3234825831": error in libcrypto
qemu.ubuntu: debug2: we did not send a packet, disable method
qemu.ubuntu: debug1: No more authentication methods to try.
qemu.ubuntu: [email protected]: Permission denied (publickey,password).
qemu.ubuntu: unreachable: true
qemu.ubuntu:
qemu.ubuntu: PLAY RECAP *********************************************************************
qemu.ubuntu: default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
qemu.ubuntu:
==> qemu.ubuntu: Provisioning step had errors: Running the cleanup provisioner, if present...
==> qemu.ubuntu: Deleting output directory...
Build 'qemu.ubuntu' errored after 6 minutes 39 seconds: Error executing Ansible: Non-zero exit status: exit status 4
Packer log Gist
Related https://github.com/hashicorp/packer/issues/12325
same case please try https://github.com/easingthemes/ssh-deploy/issues/143#issuecomment-1730014251