Im trying to build a ubuntu 20.04 template with autoinstall (cloud-init).
so im mounting "user-data" and "meta-data" as floppy with a label "cidata" which cloud-init recognizes and runs said code.
however, I guess the WaitForIp step is running to early because the IP is configured on the vm, and I can't yet see the IP in vsphere gui. and the error message is "unable to find an IP", if I run packer build with -on-error=ask and keep retrying, eventually it will find the IP and proceed to the next step and complete the build
packer build build.json
1.6.4
"ip_wait_timeout": "15m",
"ip_settle_timeout": "5s",
"boot_wait": "5s",
"boot_command": [
"<enter><enter><f6><esc><wait> ",
"autoinstall ds=nocloud",
"<enter><wait>"
],
"network_adapters": [
{
"network": "{{user `template_network`}}",
"network_card": "vmxnet3"
}
],
"type": "vsphere-iso",
"floppy_label": "cidata",
"floppy_files": [
"./user-data",
"./meta-data"
],
OS, Architecture, and any other information you can provide about the
environment.
2020/10/12 12:10:42 packer-builder-vsphere-iso plugin: [INFO] Waiting 1s
2020/10/12 12:10:43 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 15m0s, settle timeout: 5s
==> vsphere-iso: Waiting for IP...
==> vsphere-iso: unable to find an IP
==> vsphere-iso: Step "StepWaitForIp" failed
==> vsphere-iso: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)? c
==> vsphere-iso: Power off VM...
==> vsphere-iso: Deleting Floppy image ...
2020/10/12 12:11:45 packer-builder-vsphere-iso plugin: Deleting floppy disk: /run/user/1000/packer859368290
==> vsphere-iso: Destroying VM...
2020/10/12 12:11:46 [INFO] (telemetry) ending vsphere-iso
==> Wait completed after 1 minute 21 seconds
2020/10/12 12:11:46 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2020/10/12 12:11:46 machine readable: vsphere-iso,error []string{"unable to find an IP"}
==> Builds finished but no artifacts were created.
Build 'vsphere-iso' errored after 1 minute 21 seconds: unable to find an IP
2020/10/12 12:11:46 [INFO] (telemetry) Finalizing.
==> Wait completed after 1 minute 21 seconds
I just had the same issue. Currently, vsphere is usually configured by default to offer IPV6 support. Ubuntu picks this up on boot, obtains an IPv6 address which is what makes packer fail (because it detects the address and can't connect via it).
The best solution I have found so far is to disable IPv6 support at boot in Ubuntu by adjusting your boot_command
:
"boot_command": [
"<enter><enter><f6><esc><wait> ",
" ipv6.disable=1 autoinstall ds=nocloud",
"<enter>"
]
@adracus thanks!
Btw, probably also set
link-local: []
in your user-data
for your network device to keep ipv6 disabled at reboot.
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.