When building a Centos 8 VM using vsphere-iso, packer never seems to get the IP of the VM. I am using kickstart, dhcp, and I am installing open-vm-tools during the post-install process of kickstart. The VM does get an IP from DHCP and I can verify this in the vsphere gui, I can also ping and ssh to the VM, however I believe I am not even getting that far as packer does not "learn" the IP from vsphere, or so it seems. I have gone as far as routing packer traffic via Fiddler in order to see the actual data being sent between vsphere and packer and I can see that the IP address information IS returned however packer doesn't seem to acknowledge this. I am at a loss as to how to proceed / debug further.
The command I execute is: packer build tpl_lin_centos_base.json
Below is my packer template file. tpl_lin_centos_base.json
https://gist.github.com/winkaway/ca8e69263dd7e8a00e58346d1e546784
Below is my kickstart file. Note, I am using the comand "genisoimage -o centos8_ks.iso -V "OEMDRV" ks.cfg" to generate an ISO from the ks.cfg file, this is because Centos8 has no support for floppy disks.
https://gist.github.com/winkaway/43c29b6a0f82033fddd077a052ad8b79
Packer v1.6.1
Ubuntu 18.04.4 LTS running on WSL (I have also reproduced this on a standard Ubuntun 18 install)
Below are the debug logs and as you will see packer does output the IP (VM IP aquired: 192.168.107.70), however this is long after the VM is actually built and during the packer "termination" process.
Below is also an image taken from Fiddler which shows that the IP address information is in fact sent to packer. It takes roughly ~10min for the VM to be built.
root@EA-001625932331:/tpl_lin_centos_base# packer build --debug tpl_lin_centos_base.json
2020/08/01 06:20:56 [INFO] Packer version: 1.6.1 [go1.13.14 linux amd64]
2020/08/01 06:20:56 Checking 'PACKER_CONFIG' for a config file path
2020/08/01 06:20:56 'PACKER_CONFIG' not set; checking the default config file path
2020/08/01 06:20:56 Attempting to open config file: /root/.packerconfig
2020/08/01 06:20:56 [WARN] Config file doesn't exist: /root/.packerconfig
2020/08/01 06:20:56 Setting cache directory: /tpl_lin_centos_base/packer_cache
Running in background, not using a TTY
2020/08/01 06:20:56 Creating plugin client for path: /usr/local/sbin/packer
2020/08/01 06:20:56 Starting plugin: /usr/local/sbin/packer []string{"/usr/local/sbin/packer", "plugin", "packer-builder-vsphere-iso"}
2020/08/01 06:20:56 Waiting for RPC address for: /usr/local/sbin/packer
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: [INFO] Packer version: 1.6.1 [go1.13.14 linux amd64]
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: Checking 'PACKER_CONFIG' for a config file path
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: Attempting to open config file: /root/.packerconfig
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: Setting cache directory: /tpl_lin_centos_base/packer_cache
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: args: []string{"packer-builder-vsphere-iso"}
2020/08/01 06:20:57 Received unix RPC address for /usr/local/sbin/packer: addr is /tmp/packer-plugin502588936
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: Plugin address: unix /tmp/packer-plugin502588936
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: Waiting for connection...
2020/08/01 06:20:57 packer-builder-vsphere-iso plugin: Serving a plugin connection...
2020/08/01 06:20:57 Creating plugin client for path: /usr/local/sbin/packer
2020/08/01 06:20:57 Starting plugin: /usr/local/sbin/packer []string{"/usr/local/sbin/packer", "plugin", "packer-provisioner-ansible"}
2020/08/01 06:20:57 Waiting for RPC address for: /usr/local/sbin/packer
2020/08/01 06:20:57 packer-provisioner-ansible plugin: [INFO] Packer version: 1.6.1 [go1.13.14 linux amd64]
2020/08/01 06:20:57 packer-provisioner-ansible plugin: Checking 'PACKER_CONFIG' for a config file path
2020/08/01 06:20:57 packer-provisioner-ansible plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/08/01 06:20:57 packer-provisioner-ansible plugin: Attempting to open config file: /root/.packerconfig
2020/08/01 06:20:57 packer-provisioner-ansible plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2020/08/01 06:20:57 packer-provisioner-ansible plugin: Setting cache directory: /tpl_lin_centos_base/packer_cache
2020/08/01 06:20:57 packer-provisioner-ansible plugin: args: []string{"packer-provisioner-ansible"}
2020/08/01 06:20:57 Received unix RPC address for /usr/local/sbin/packer: addr is /tmp/packer-plugin282137462
2020/08/01 06:20:57 packer-provisioner-ansible plugin: Plugin address: unix /tmp/packer-plugin282137462
2020/08/01 06:20:57 packer-provisioner-ansible plugin: Waiting for connection...
2020/08/01 06:20:57 Preparing build: vsphere-iso
2020/08/01 06:20:57 packer-provisioner-ansible plugin: Serving a plugin connection...
2020/08/01 06:20:58 [ERR] Checkpoint error: Get https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=linux&signature=edbb225f-526a-377a-5b8a-77e7768ab57b&version=1.6.1: x509: certificate signed by unknown authority
2020/08/01 06:20:58 packer-provisioner-ansible plugin: [ERR] Checkpoint error: Get https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=linux&signature=edbb225f-526a-377a-5b8a-77e7768ab57b&version=1.6.1: x509: certificate signed by unknown authority
2020/08/01 06:20:58 packer-builder-vsphere-iso plugin: [ERR] Checkpoint error: Get https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=linux&signature=edbb225f-526a-377a-5b8a-77e7768ab57b&version=1.6.1: x509: certificate signed by unknown authority
2020/08/01 06:21:00 Build debug mode: true
Debug mode enabled. Builds will not be parallelized.
2020/08/01 06:21:00 Force build: false
vsphere-iso: output will be in this color.
2020/08/01 06:21:00 On error:
2020/08/01 06:21:00 Debug enabled, so waiting for build to finish: vsphere-iso
2020/08/01 06:21:00 Starting build run: vsphere-iso
2020/08/01 06:21:00 Running builder: vsphere-iso
2020/08/01 06:21:00 [INFO] (telemetry) Starting builder vsphere-iso
2020/08/01 06:21:00 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Creating VM...
2020/08/01 06:21:01 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Customizing hardware...
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Mounting ISO images...
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc000bef4a0
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc000b287a0
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: No floppy files specified. Floppy disk will not be made.
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Set boot order temporary...
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:21:02 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Power on VM...
2020/08/01 06:21:04 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Waiting 10s for boot...
==> vsphere-iso: Typing boot command...
2020/08/01 06:21:14 packer-builder-vsphere-iso plugin: Special code '
2020/08/01 06:21:14 packer-builder-vsphere-iso plugin: Sending char ' ', code CodeSpacebar, shift false
2020/08/01 06:21:14 packer-builder-vsphere-iso plugin: Special code '
2020/08/01 06:21:14 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Waiting for IP...
2020/08/01 06:21:14 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:21:14 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 30m0s, settle timeout: 5s
==> vsphere-iso: Timeout waiting for IP.
2020/08/01 06:51:14 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Clear boot order...
2020/08/01 06:51:14 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:51:14 packer-builder-vsphere-iso plugin: VM IP aquired: 192.168.107.70
==> vsphere-iso: Power off VM...
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Destroying VM...
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/01 06:51:16 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
Build 'vsphere-iso' errored: Timeout waiting for IP.
2020/08/01 06:51:16 [INFO] (telemetry) ending vsphere-iso
2020/08/01 06:51:16 Waiting on builds to complete...
==> Some builds didn't complete successfully and had errors:
2020/08/01 06:51:16 machine readable: error-count []string{"1"}
--> vsphere-iso: Timeout waiting for IP.
==> Some builds didn't complete successfully and had errors:
2020/08/01 06:51:16 machine readable: vsphere-iso,error []string{"Timeout waiting for IP."}
==> Builds finished but no artifacts were created.
==> Builds finished but no artifacts were created.
2020/08/01 06:51:16 [INFO] (telemetry) Finalizing.
2020/08/01 06:51:17 [WARN] (telemetry) Error finalizing report. This is safe to ignore. Post https://checkpoint-api.hashicorp.com/v1/telemetry/packer: x509: certificate signed by unknown authority
2020/08/01 06:51:17 waiting for all plugin processes to complete...
2020/08/01 06:51:17 /usr/local/sbin/packer: plugin process exited
2020/08/01 06:51:17 /usr/local/sbin/packer: plugin process exited
root@EA-001625932331:/tpl_lin_centos_base#
This line means that it saw the IP: 2020/08/01 06:51:14 packer-builder-vsphere-iso plugin: VM IP aquired: 192.168.107.70
The step then will wait for the IP to settle out. I'm wondering if your reboot/eject is causing it to not to get past the settle.
I have the same problem which seems to be introduced with Packer 1.6.1; Packer 1.6.0 still works fine.
@pkorovin are you rebooting at the end of your kickstart? Are you using more than one network adapter?
@winkaway are both your network adapters getting IPs?
@jhawk28 There's only one adapter, vmx3; vsphere 6.7; guest os: OpenBSD/amd64.
Guest was rebooted and got the IP address.
Relevant config lines:
source "vsphere-iso" "openbsd-base" {
vm_name = "openbsd-base-{{ isotime \"2006-01-02\" }}"
guest_os_type = "freebsd11_64Guest"
...
network_adapters {
network = "tsrv"
network_card = "vmxnet3"
}
Packer stucks waiting for IP:
==> vsphere-iso.openbsd-base: Typing boot command...
==> vsphere-iso.openbsd-base: Waiting for IP...
Tried CentOS-8.2.2004-x86_64 guest:
source "vsphere-iso" "centos-base" {
vm_name = "centos-base-{{ isotime \"2006-01-02\" }}"
guest_os_type = "centos8_64Guest"
...
network_adapters {
network = "tsrv"
network_card = "vmxnet3"
}
The same thing:
==> Some builds didn't complete successfully and had errors:
--> vsphere-iso.centos-base: Timeout waiting for IP.
Hey there! I noticed that Packer acquired the IP exactly 30 min after the time started to count which matches the timeout. Look at the time:
2020/08/01 06:21:14 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 30m0s, settle timeout: 5s
==> vsphere-iso: Timeout waiting for IP.
2020/08/01 06:51:14 packer-builder-vsphere-iso plugin: VM IP aquired: 192.168.107.70
I think Packer got confused there because the timeout was reached at the same time the IP was acquired and once the timeout happened it just failed without checking anything else.
What you can do as a workaround is to increase the timeout 10 minutes with "ip_wait_timeout" : "40m"
. This will also help us understand if that is the case and then we can write some code to deal with it. Could you try this out and let me know the results, please?
@sylviamoss Unfortunately I see the same outcome when changing the timeout to 40m
==> vsphere-iso: Creating VM...
2020/08/07 14:43:26 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Customizing hardware...
2020/08/07 14:43:26 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Mounting ISO images...
2020/08/07 14:43:26 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc000d53e00 <nil> <nil> <nil> 0 <nil>} 0 []}' with iso '[vmstore_a01] ISOs/CentOS-8.2.2004-x86_64-minimal.iso'
2020/08/07 14:43:27 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc000f18440 <nil> <nil> <nil> 0 <nil>} 0 [3000]}' with iso '[vmstore_a01] ISOs/Kickstart/centos8_ks.iso'
2020/08/07 14:43:27 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/07 14:43:27 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/07 14:43:27 packer-builder-vsphere-iso plugin: No floppy files specified. Floppy disk will not be made.
2020/08/07 14:43:27 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/07 14:43:27 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Set boot order temporary...
2020/08/07 14:43:27 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/07 14:43:27 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Power on VM...
2020/08/07 14:43:28 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Waiting 10s for boot...
==> vsphere-iso: Typing boot command...
2020/08/07 14:43:38 packer-builder-vsphere-iso plugin: Special code '<enter>' found, replacing with: CodeReturnEnter
2020/08/07 14:43:38 packer-builder-vsphere-iso plugin: Sending char ' ', code CodeSpacebar, shift false
2020/08/07 14:43:38 packer-builder-vsphere-iso plugin: Special code '<enter>' found, replacing with: CodeReturnEnter
2020/08/07 14:43:39 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/07 14:43:39 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Waiting for IP...
2020/08/07 14:43:39 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 40m0s, settle timeout: 5s
==> vsphere-iso: Timeout waiting for IP.
2020/08/07 15:23:39 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Clear boot order...
2020/08/07 15:23:39 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/07 15:23:39 packer-builder-vsphere-iso plugin: VM IP aquired: 192.168.107.72
==> vsphere-iso: Power off VM...
Thanks for trying this out @winkaway.
Funny it happened the same again. See:
2020/08/07 14:43:39 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 40m0s, settle timeout: 5s
==> vsphere-iso: Timeout waiting for IP.
2020/08/07 15:23:39 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Clear boot order...
2020/08/07 15:23:39 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/07 15:23:39 packer-builder-vsphere-iso plugin: VM IP aquired: 192.168.107.72
Exactly 40m later 🤔 the timeout happens the same time the IP is aquired. I'm gonna have to dig into this more to figure out what's going on. Thanks again for trying!
@winkaway as @jhawk28 asked, are both your network adapters getting IPs?
It seems that one of the adapters is not getting the IP and once the timeout is reached Packer cancels the API context and the API returns the only IP found, which explains why packer prints out the IP at the same time as the timeout.
Only the interface which should get an IP from DHCP is receiving an IP, the secondary interface remains unconfigured.
I can confirm connectivity to the VM from the packer host using ssh as shown below and the status of the interfaces
root@EA-001625932331:/# ssh [email protected]
The authenticity of host '192.168.107.91 (192.168.107.91)' can't be established.
ECDSA key fingerprint is SHA256:9WCsDxaZZhm4eXZ8vJ+UfI0lAxJukFhFKfnnxupVDrY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.107.91' (ECDSA) to the list of known hosts.
[email protected]'s password:
Last login: Mon Aug 10 17:34:43 2020
[user@tpl-lin-centos8 ~]$ ifconfig
ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.107.91 netmask 255.255.255.0 broadcast 192.168.107.255
inet6 fe80::250:56ff:feb4:8346 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:b4:83:46 txqueuelen 1000 (Ethernet)
RX packets 41 bytes 5691 (5.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 44 bytes 6287 (6.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens224: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:50:56:b4:93:90 txqueuelen 1000 (Ethernet)
RX packets 535 bytes 32100 (31.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[user@tpl-lin-centos8 ~]$ date
Mon Aug 10 17:35:19 BST 2020
[user@tpl-lin-centos8 ~]$
Below is the packer output, which is still "waiting for IP..."
NB!! The server is built @ 17:35 (10 min after packer is initiated), it will then sit for 20 or 30 minutes waiting for the timeout before printing the IP. I do not think it is only learning the IP at this time. My Fiddler capture showed this info was transmitted over the network well before this timeout was reached.
2020/08/10 17:25:02 Debug enabled, so waiting for build to finish: vsphere-iso
2020/08/10 17:25:02 Starting build run: vsphere-iso
2020/08/10 17:25:02 Running builder: vsphere-iso
2020/08/10 17:25:02 [INFO] (telemetry) Starting builder vsphere-iso
2020/08/10 17:25:03 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Creating VM...
2020/08/10 17:25:07 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Customizing hardware...
2020/08/10 17:25:07 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Mounting ISO images...
2020/08/10 17:25:07 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc000a402a0 <nil> <nil> <nil> 0 <nil>} 0 []}' with iso '[vmstore_a01] ISOs/CentOS-8.2.2004-x86_64-minimal.iso'
2020/08/10 17:25:08 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc000a4aaa0 <nil> <nil> <nil> 0 <nil>} 0 [3000]}' with iso '[vmstore_a01] ISOs/Kickstart/centos8_ks.iso'
2020/08/10 17:25:09 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/10 17:25:09 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/10 17:25:09 packer-builder-vsphere-iso plugin: No floppy files specified. Floppy disk will not be made.
2020/08/10 17:25:09 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/10 17:25:09 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/10 17:25:09 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/10 17:25:09 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Set boot order temporary...
==> vsphere-iso: Power on VM...
2020/08/10 17:25:10 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
==> vsphere-iso: Waiting 10s for boot...
==> vsphere-iso: Typing boot command...
2020/08/10 17:25:20 packer-builder-vsphere-iso plugin: Special code '<enter>' found, replacing with: CodeReturnEnter
2020/08/10 17:25:21 packer-builder-vsphere-iso plugin: Sending char ' ', code CodeSpacebar, shift false
2020/08/10 17:25:21 packer-builder-vsphere-iso plugin: Special code '<enter>' found, replacing with: CodeReturnEnter
2020/08/10 17:25:21 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/10 17:25:21 packer-builder-vsphere-iso plugin: Error asking for input: no available tty
2020/08/10 17:25:21 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 40m0s, settle timeout: 5s
==> vsphere-iso: Waiting for IP...
Below is a screenshot showing the IP present in the vSphere client
The API hangs while trying to get the IP for the other interface. There's nothing wrong with the interface with IP and I believe Packer would be able to connect to it if the API wasn't hanging. It hangs in a code that is not from Packer.
Is it possible to remove the adapter that is not configured? Does it make sense to do it? At least to test this one and confirm our suspicions.
One change in the 1.6.1 was to use a different API for getting the IP address. The original one would only ever get the first one that it saw (which is what vsphere is showing). This is problematic when you need to identify the correct IP address to use when you have multiple NICs. We probably need to get the addresses in a non-blocking way.
Do you know already if that is possible through the API @jhawk28 ?
You can definitely do a query and iterate over the values. There are some differences with how it does it looks like the WaitForIP functions get "changes" as they occur. This is an example of how to get ips from a vm with a query:
m := view.NewManager(client.Client)
v, err := m.CreateContainerView(ctx, client.ServiceContent.RootFolder, []string{"VirtualMachine"}, true)
defer v.Destroy(ctx)
var movms []mo.VirtualMachine
err = v.Retrieve(ctx, []string{"VirtualMachine"}, []string{"guest"}, &movms)
for _, vm := range movms {
for _, net := range vm.Guest.Net {
if net.IpConfig != nil {
for _, ip := range net.IpConfig.IpAddress {
...
one possibility would be to call WaitForIP to do the blocking and then do queries to get all the available IPs. An alternative would be to do a non-blocking impl of the WaitForNetIP() to get the best of both worlds (if possible).
I can confirm that only have a single interface present does not reproduce the problem. I could work with this and add a secondary interface during another part of the build but I think you guys are on to a solution for a future version which would be sweet!
another alternative would be to do a timeout for the WaitForNetIP to get any addresses.
I can confirm that only have a single interface present does not reproduce the problem.
It doesn't work in my case. I have 1 VNIC for different OS (OpenBSD/CentOS) deployments and it still stuck in getting VM IP address.
Here's what I've tried:
Set IPv4 address to DHCP
Disable IPv6
Play with timeouts/ip ranges
Cherry-pick changes between 1.6.0 and 1.6.1 and trying to parially revert changes
(func (c *WaitIpConfig) GetIPNet() *net.IPNet and friends across the source)
None of these helped. The only option I have for now is 1.6.0 with custom patches to make vsphere-clone support "boot" command.
@pkorovin are you able to see in the VM UI what is happening there during the configuration after typing the boot_command? Since you have only one network interface I guess you have a different problem from the reporter.
I suppose your template was working with 1.6.0 but without boot command, right? Your VM configuration could be stuck in some step. It happened to me already something similar and my boot_command had some wrong config.
Hey @winkaway, I implemented a solution for this and I was also able to reproduce the issue in my environment. The solution worked for me and I would like to know if it works for you too. Here the binaries you can try out: https://circleci.com/gh/hashicorp/packer/73579#artifacts/containers/0
Let me know your results, please!
You sir, are a legend! It works great. Thank you for all your time and effort, working on such a great project.
Good to know that it works great! Thanks for reporting and sharing all the info the helped us figure this out. 😄
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
You sir, are a legend! It works great. Thank you for all your time and effort, working on such a great project.