nutanix-cloud-native/packer-plugin-nutanix

Packer Ubuntu build fails attempting to SSH to the packer vm

Closed this issue · 4 comments

/kind bug

What steps did you take and what happened:

A clear and concise description of what the bug is and how has this been tested. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

I'm trying to create a packer image of Ubuntu 20.04 using the cloud image (ubuntu-20.04-server-cloudimg-amd64.img), but it fails with error "handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain" when attempting to SSH to the packer vm and eventually times out.

Paste a full trace by launching packer with PACKER_LOG=1 packer <command> [<args>]
2023/08/01 17:06:46 [INFO] Packer version: 1.8.4 [go1.18.5 linux amd64]
2023/08/01 17:06:46 [TRACE] discovering plugins in /usr/bin
2023/08/01 17:06:46 [TRACE] discovering plugins in /home/user@domain.com/.config/packer/plugins
2023/08/01 17:06:46 [DEBUG] Discovered plugin: nutanix = /home/user@domain.com/.config/packer/plugins/github.com/nutanix-cloud-native/nutanix/packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64
2023/08/01 17:06:46 [DEBUG] Discovered plugin: windows-update = /home/user@domain.com/.config/packer/plugins/github.com/rgl/windows-update/packer-plugin-windows-update_v0.14.1_x5.0_linux_amd64
2023/08/01 17:06:46 [INFO] found external [-packer-default-plugin-name-] builders from nutanix plugin
2023/08/01 17:06:46 found external [-packer-default-plugin-name-] provisioner from windows-update plugin
2023/08/01 17:06:46 [TRACE] discovering plugins in .
2023/08/01 17:06:46 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/08/01 17:06:46 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/user@domain.com/.packerconfig
2023/08/01 17:06:46 [WARN] Config file doesn't exist: /home/user@domain.com/.packerconfig
2023/08/01 17:06:46 [INFO] Setting cache directory: /home/user@domain.com/.cache/packer
2023/08/01 17:06:46 [TRACE] validateValue: not active for nutanix_username, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for nutanix_endpoint, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for nutanix_insecure, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for nutanix_subnet, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for nutanix_cluster, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for windows_2016_iso_image_name, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for virtio_iso_image_name, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for nutanix_password, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for nutanix_port, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for centos_iso_image_name, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for centos_disk_image_name, so skipping
2023/08/01 17:06:46 [TRACE] validateValue: not active for ubuntu_disk_image_name, so skipping
2023/08/01 17:06:46 [TRACE] Starting external plugin /home/user@domain.com/.config/packer/plugins/github.com/nutanix-cloud-native/nutanix/packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 start builder -packer-default-plugin-name-
2023/08/01 17:06:46 Starting plugin: /home/user@domain.com/.config/packer/plugins/github.com/nutanix-cloud-native/nutanix/packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 []string{"/home/user@domain.com/.config/packer/plugins/github.com/nutanix-cloud-native/nutanix/packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64", "start", "builder", "-packer-default-plugin-name-"}
2023/08/01 17:06:46 Waiting for RPC address for: /home/user@domain.com/.config/packer/plugins/github.com/nutanix-cloud-native/nutanix/packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64
2023/08/01 17:06:46 Received unix RPC address for /home/user@domain.com/.config/packer/plugins/github.com/nutanix-cloud-native/nutanix/packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64: addr is /tmp/packer-plugin2503354775
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 Plugin address: unix /tmp/packer-plugin2503354775
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 Waiting for connection...
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 Serving a plugin connection...
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 [TRACE] starting builder -packer-default-plugin-name-
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 No Communicator Type assigned but SSH Creds available, setting to 'SSH'
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 No CPU configured, defaulting to '1'
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 No VM Memory configured, defaulting to '4096'
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 No correct VM Boot Type configured, defaulting to 'legacy'
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 No vmname assigned, setting to Packer-KT22UHVU
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 SSHPort not set, defaulting to 22
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 SSHTimeout not set, defaulting to 20min
2023/08/01 17:06:46 [TRACE] Starting internal plugin packer-provisioner-shell
2023/08/01 17:06:46 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-provisioner-shell"}
2023/08/01 17:06:46 Waiting for RPC address for: /usr/bin/packer
2023/08/01 17:06:46 packer-provisioner-shell plugin: [INFO] Packer version: 1.8.4 [go1.18.5 linux amd64]
2023/08/01 17:06:46 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/08/01 17:06:46 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/user@domain.com/.packerconfig
2023/08/01 17:06:46 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /home/user@domain.com/.packerconfig
2023/08/01 17:06:46 packer-provisioner-shell plugin: [INFO] Setting cache directory: /home/user@domain.com/.cache/packer
2023/08/01 17:06:46 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2023/08/01 17:06:46 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin2111728152
2023/08/01 17:06:46 packer-provisioner-shell plugin: Plugin address: unix /tmp/packer-plugin2111728152
2023/08/01 17:06:46 packer-provisioner-shell plugin: Waiting for connection...
2023/08/01 17:06:46 packer-provisioner-shell plugin: Serving a plugin connection...
Debug mode enabled. Builds will not be parallelized.
2023/08/01 17:06:46 Build debug mode: true
2023/08/01 17:06:46 Force build: true
2023/08/01 17:06:46 On error:
nutanix.ubuntu: output will be in this color.

2023/08/01 17:06:46 Debug enabled, so waiting for build to finish: nutanix.ubuntu
2023/08/01 17:06:46 Starting build run: nutanix.ubuntu
2023/08/01 17:06:46 Running builder:
2023/08/01 17:06:46 [INFO] (telemetry) Starting builder nutanix.ubuntu
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 PC Host from config: ntnxprismc01.domain.com
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 No CD files specified. CD disk will not be made.
==> nutanix.ubuntu: Creating Packer Builder VM on Nutanix Cluster.
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 Check for temporary iso-disks to attach
2023/08/01 17:06:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:46 No temporary iso, not attaching.
2023/08/01 17:06:48 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:48 waiting for vm (9bbf3614-53db-41f8-80b2-57c55cb95171) to create: 63fd4d17-a55e-4fe0-86c1-dff49f3968f7
2023/08/01 17:06:48 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:48 Current status is: PENDING
2023/08/01 17:06:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:53 vm created successfully: COMPLETE
2023/08/01 17:06:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:53 VM (9bbf3614-53db-41f8-80b2-57c55cb95171) configured with ip address 172.21.7.231
2023/08/01 17:06:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:53 Nutanix VM UUID: 9bbf3614-53db-41f8-80b2-57c55cb95171
==> nutanix.ubuntu: IP for Nutanix device: 172.21.7.231
==> nutanix.ubuntu: Using SSH communicator to connect: 172.21.7.231
==> nutanix.ubuntu: Waiting for SSH to become available...
2023/08/01 17:06:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:06:53 [INFO] Waiting for SSH, up to timeout: 20m0s
2023/08/01 17:07:00 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:00 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 172.21.7.231:22: connect: connection refused
2023/08/01 17:07:05 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:05 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 172.21.7.231:22: connect: connection refused
2023/08/01 17:07:10 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:10 [INFO] Attempting SSH connection to 172.21.7.231:22...
2023/08/01 17:07:10 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:10 [DEBUG] reconnecting to TCP connection for SSH
2023/08/01 17:07:10 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:10 [DEBUG] handshaking with SSH
2023/08/01 17:07:10 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:10 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
2023/08/01 17:07:10 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:10 [DEBUG] Detected authentication error. Increasing handshake attempts.
2023/08/01 17:07:17 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:17 [INFO] Attempting SSH connection to 172.21.7.231:22...
2023/08/01 17:07:17 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:17 [DEBUG] reconnecting to TCP connection for SSH
2023/08/01 17:07:17 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:17 [DEBUG] handshaking with SSH
2023/08/01 17:07:17 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:17 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
2023/08/01 17:07:17 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:17 [DEBUG] Detected authentication error. Increasing handshake attempts.
2023/08/01 17:07:24 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:24 [INFO] Attempting SSH connection to 172.21.7.231:22...
2023/08/01 17:07:24 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:24 [DEBUG] reconnecting to TCP connection for SSH
2023/08/01 17:07:24 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:24 [DEBUG] handshaking with SSH
2023/08/01 17:07:25 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:25 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
2023/08/01 17:07:25 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:25 [DEBUG] Detected authentication error. Increasing handshake attempts.
2023/08/01 17:07:32 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:32 [INFO] Attempting SSH connection to 172.21.7.231:22...
2023/08/01 17:07:32 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:32 [DEBUG] reconnecting to TCP connection for SSH
2023/08/01 17:07:32 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:32 [DEBUG] handshaking with SSH
2023/08/01 17:07:32 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:32 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
2023/08/01 17:07:32 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:32 [DEBUG] Detected authentication error. Increasing handshake attempts.
2023/08/01 17:07:39 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:39 [INFO] Attempting SSH connection to 172.21.7.231:22...
2023/08/01 17:07:39 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:39 [DEBUG] reconnecting to TCP connection for SSH
2023/08/01 17:07:39 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:39 [DEBUG] handshaking with SSH
2023/08/01 17:07:39 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:39 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
2023/08/01 17:07:39 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:39 [DEBUG] Detected authentication error. Increasing handshake attempts.
2023/08/01 17:07:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:46 [INFO] Attempting SSH connection to 172.21.7.231:22...
2023/08/01 17:07:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:46 [DEBUG] reconnecting to TCP connection for SSH
2023/08/01 17:07:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:46 [DEBUG] handshaking with SSH
2023/08/01 17:07:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:46 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
2023/08/01 17:07:46 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:46 [DEBUG] Detected authentication error. Increasing handshake attempts.
2023/08/01 17:07:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:53 [INFO] Attempting SSH connection to 172.21.7.231:22...
2023/08/01 17:07:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:53 [DEBUG] reconnecting to TCP connection for SSH
2023/08/01 17:07:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:53 [DEBUG] handshaking with SSH
2023/08/01 17:07:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:53 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
2023/08/01 17:07:53 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:07:53 [DEBUG] Detected authentication error. Increasing handshake attempts.
2023/08/01 17:08:00 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:08:00 [INFO] Attempting SSH connection to 172.21.7.231:22...
2023/08/01 17:08:00 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:08:00 [DEBUG] reconnecting to TCP connection for SSH
2023/08/01 17:08:00 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:08:00 [DEBUG] handshaking with SSH
2023/08/01 17:08:00 packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64 plugin: 2023/08/01 17:08:00 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
What did you expect to happen:

I expect it to SSH in and finish the packer build.

Anything else you would like to add:

Miscellaneous information that will assist in solving the issue.

Environment:

  • packer-plugin-nutanix version (use packer plugins installed): /home/user@domain.com/.config/packer/plugins/github.com/rgl/windows-update/packer-plugin-windows-update_v0.14.1_x5.0_linux_amd64
    /home/user@domain.com/.config/packer/plugins/github.com/nutanix-cloud-native/nutanix/packer-plugin-nutanix_v0.2.0_x5.0_linux_amd64

  • Packer version (use packer version): Packer v1.8.4

  • OS (e.g. from /etc/os-release):
    NAME="Ubuntu"
    VERSION="20.04.5 LTS (Focal Fossa)"

packer_ubuntu.tar.gz

tuxtof commented

Hello @ktinthecloud

there is an error in the last PR #131 who add based64encode example, i just fix it with #134

you need to have

user_data         = base64encode(file("cloud-config-ubuntu.yaml"))

in your case you get the name of the file in the user_data not the content

tuxtof commented

last point , plugin you use is pretty old (0.2.0) don't hesitate to update to the more recent

tuxtof commented

PR merged
i let you test and close if OK

PR merged i let you test and close if OK

It's working now. Thanks @tuxtof!