jenkinssshpackerhashicorp-packerpacker-builder

Error waiting for SSH: Packer experienced an authentication error : using vsphere-iso


getting below error while running packer using vsphere-iso builder.

Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password keyboard-interactive], no supported methods remain

config.json

    "communicator": "ssh",
    "ssh_username": "{{user `ssh_username`}}",
    "ssh_password": "{{user `ssh_password`}}",
    "ssh_timeout": "30m",

username and password is coming from Jenkins at run time. same has beed updated in autounattend.xml , if i hard-code the credential in config.json file then its working fine. dont know what's the issue

packer debug log

2022/05/09 10:16:20 packer.exe plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2022/05/09 10:16:27 packer.exe plugin: [INFO] Attempting SSH connection to 172.16.112.59:22...
2022/05/09 10:16:27 packer.exe plugin: [DEBUG] reconnecting to TCP connection for SSH
2022/05/09 10:16:27 packer.exe plugin: [DEBUG] handshaking with SSH
2022/05/09 10:16:28 packer.exe plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password keyboard-

Solution

  • I got the solution as below

    In autounattend.xml file password was given as plain text true , which needs to be change to false.