-
Notifications
You must be signed in to change notification settings - Fork 108
vsphere-iso: IPv6 ip_wait_address breaks "Waiting for SSH to become available" due to "too many colons in address". #333
Description
Overview of the Issue
Whilst creating IPv6-only packer images, we ran into the following problems:
-
Packer was still waiting/polling for an assigned IP address to the VM, although it had already received an IPv6 address.
This was solved by assigning an IPv6 range (e.g.
2001:db8:dead:beef::/64) to theip_wait_addressvariable inside thesource "vsphere-iso" "[name]"stanza. This was necessary due to the vSphere ISO builder defaulting to IPv4: https://developer.hashicorp.com/packer/integrations/hashicorp/vsphere/latest/components/builder/vsphere-iso#wait-configuration -
Packer was still waiting/polling for SSH to become available, even after passing the IP check.
Still unresolved. The SSH wait seems to continue using the detected IP address of the VM, but doesn't work around the implications of the address being an IPv6 address:
2023/11/29 08:44:32 packer-plugin-vsphere_v1.2.2_x5.0_linux_amd64 plugin: 2023/11/29 08:44:32 VM IP seems stable enough: 2001:db8:dead:beef::1 ==> vsphere-iso.adis-tester: IP address: 2001:db8:dead:beef::1 2023/11/29 08:44:32 packer-plugin-vsphere_v1.2.2_x5.0_linux_amd64 plugin: 2023/11/29 08:44:32 [INFO] Waiting for SSH, up to timeout: 30m0s 2023/11/29 08:44:32 packer-plugin-vsphere_v1.2.2_x5.0_linux_amd64 plugin: 2023/11/29 08:44:32 [DEBUG] TCP connection to SSH ip/port failed: dial tcp: address 2001:db8:dead:beef::1:22: too many colons in address ==> vsphere-iso.adis-tester: Using SSH communicator to connect: 2001:db8:dead:beef::1 ==> vsphere-iso.adis-tester: Waiting for SSH to become available... 2023/11/29 08:44:37 packer-plugin-vsphere_v1.2.2_x5.0_linux_amd64 plugin: 2023/11/29 08:44:37 [DEBUG] TCP connection to SSH ip/port failed: dial tcp: address 2001:db8:dead:beef::1:22: too many colons in address 2023/11/29 08:44:42 packer-plugin-vsphere_v1.2.2_x5.0_linux_amd64 plugin: 2023/11/29 08:44:42 [DEBUG] TCP connection to SSH ip/port failed: dial tcp: address 2001:db8:dead:beef::1:22: too many colons in address
Might be the same problem as described in hashicorp/packer#9360.
Reproduction Steps
- Follow the tutorial steps in https://developer.hashicorp.com/terraform/tutorials/virtual-machine/vsphere-provider.
- Pivot from the tutorial and assign a static IPv6 address using CloudInit's user-data.
- Declare
ip_wait_addressand assign it an IPv6 range as a string insidepacker/vsphere-iso_basic_ubuntu.pkr.hcl. - Run
PACKER_LOG=1 packer build. It will wait/poll for SSH to become available indefinitely.
Packer Version
Packer v1.9.4
Plugin Version and Builders
Plugin: packer-plugin-vsphere_v1.2.2_x5.0_linux_amd64
Builder: vsphere-iso
VMware vSphere Version
7.0.3
Guest Operating System
Both tested with Ubuntu 22.04 LTS and Ubuntu 20.04 LTS.
Simplified Packer Buildfile
- https://github.com/hashicorp/learn-terraform-vsphere/blob/main/packer/vsphere-iso_basic_ubuntu.pkr.hcl with
ip_wait_addressadded in thesource "vsphere-iso" "[name]"stanza. - https://github.com/hashicorp/learn-terraform-vsphere/blob/main/packer/user-data with added netplan data, e.g:
network: network: version: 2 renderer: networkd ethernets: foobar: match: name: 'ens*' dhcp4: false dhcp6: false addresses: - 2001:db8:dead:beef::2/64 nameservers: search: [example.com] addresses: - 2001:db8:dead:beef::3 - 2001:db8:dead:beef::4 routes: - to: ::/0 via: 2001:db8:dead:beef::1
Operating System and Environment Details
Packer was run from my Ubuntu 22.04 LTS desktop.