Full Disclosure - I’m a newbie with packer!
Hi all,
I’m trying to create a script which will deploy a Debian 10 VM to a vCenter environment with no DHCP.
Fundamentally I have my initial build process working (Debian 10 is installed without any user interaction, public keys added, ssh enabled and open-vm-tools installed) as long as i run packer with either -debug or -on-error=ask.
When I don’t run packer with either of the above the script terminates exactly five minutes after the last key is pressed in the boot_command, at the “Waiting for IP” prompt. When run with -debug or -on-error=ask the script still terminate after 5 minutes; but waits for input from me… but if I let the VM continue what it’s doing, within a couple of minutes the VM is built, rebooted and waiting for a login.
My build process takes around 7 minutes. I have played with ssh_timeout, setting it to 10m and then to 30m… it doesn’t make any difference, the script still terminates after 5 minutes. I wondered (as a newbie) if I was tweaking the wrong variable, but having just set PACKER_LOG=1 and rerunning my packer script it still terminated at 5 minutes, but at least reported it knew it should be terminating at 30m
I’m pretty confident I’m doing something wrong, I just don’t know what! Either that or ssh_timeout is being ignored - but that seems unlikely else more people would be shouting surely?
Any assistance gratefully received!
Cheers
Steve
Logs
2020/04/30 08:11:22 [INFO] (telemetry) Starting builder vsphere-iso
==> vsphere-iso: Creating VM…
==> vsphere-iso: Customizing hardware…
==> vsphere-iso: Mounting ISO images…
2020/04/30 08:11:31 packer.exe plugin: Creating CD-ROM on controller ‘&{{{} 200 0xc00063c860 0 } 0 }’ with iso ‘[DS1] ISOs/Linux/debian-10.2.0-amd64-netinst.iso’
2020/04/30 08:11:33 packer.exe plugin: No floppy files specified. Floppy disk will not be made.
==> vsphere-iso: Set boot order temporary…
==> vsphere-iso: Power on VM…
==> vsphere-iso: Waiting 15s for boot…
==> vsphere-iso: Typing boot command…
2020/04/30 08:11:50 packer.exe plugin: Special code ‘’ found, replacing with: CodeEscape
2020/04/30 08:11:51 packer.exe plugin: Waiting 1 second
2020/04/30 08:13:15 packer.exe plugin: Special code ‘’ found, replacing with: CodeReturnEnter
2020/04/30 08:13:15 packer.exe plugin: [INFO] Waiting for IP, up to total timeout: 30m0s, settle timeout: 5s
==> vsphere-iso: Waiting for IP…
Stalls here for 5minutes
==> vsphere-iso: Clear boot order…
==> vsphere-iso: Power off VM…
==> vsphere-iso: Destroying VM…
2020/04/30 08:18:19 [INFO] (telemetry) ending vsphere-iso
Build ‘vsphere-iso’ errored: Post https://vcenter.example.com/sdk: EOF
2020/04/30 08:18:19 machine readable: error-count string{“1”}
==> Some builds didn’t complete successfully and had errors:
==> Some builds didn’t complete successfully and had errors:
2020/04/30 08:18:19 machine readable: vsphere-iso,error string{“Post https://vcenter.example.com/sdk: EOF”}
==> Builds finished but no artifacts were created.
–> vsphere-iso: Post https://vcenter.example.com/sdk: EOF
2020/04/30 08:18:19 [INFO] (telemetry) Finalizing.
==> Builds finished but no artifacts were created.
2020/04/30 08:18:20 waiting for all plugin processes to complete…
2020/04/30 08:18:20 C:\path\to\packer\packer\packer.exe: plugin process exited
2020/04/30 08:18:20 C:\path\to\packer\packer\packer.exe: plugin process exited
Environment
Packer version: 1.5.5 [go1.13.7 windows amd64]
vCenter 6.5.0.32300
Script
Note, credentials for vcenter are being fed in from another config file and passed to packer with -var-file=. I’ve not shared that file for obvious reasons, and do not believe it’ll have any influence on the problem I’m experiencing.
{
"variables": {
"version": "1.0",
"Date": "17/04/2020",
"vm_name": "test-vm",
"CPUs": "2",
"cpu_cores": "2",
"RAM": "2048",
"disk_size": "20480",
"sshusername": "redacted",
"sshpassword": "redacted",
},
"builders": [
{
"type": "vsphere-iso",
"vcenter_server": "{{user `vcenter_server`}}",
"username": "{{user `username`}}",
"password": "{{user `password`}}",
"cluster": "{{user `cluster`}}",
"host": "{{user `host`}}",
"datastore": "{{user `ds`}}",
"vm_name":"{{user `vm_name`}}",
"guest_os_type": "debian10_64Guest",
"shutdown_command": "sudo shutdown -P now",
"ssh_port": 22,
"ssh_username": "{{user `sshusername`}}",
"ssh_password": "{{user `sshpassword`}}",
"ssh_timeout": "30m",
"CPUs": "{{user `CPUs`}}",
"cpu_cores": "{{user `cpu_cores`}}",
"RAM": "{{user `RAM`}}",
"RAM_reserve_all": true,
"disk_controller_type": "pvscsi",
"disk_size": "{{user `disk_size`}}",
"disk_thin_provisioned": true,
"network_adapters" : [
{
"network" : "Some Network",
"network_card": "vmxnet3"
},
{
"network" : "Some Network",
"network_card": "vmxnet3"
}
],
"iso_paths": [
"[DS1] ISOs/Linux/debian-10.2.0-amd64-netinst.iso"
],
"boot_wait": "15s",
"boot_command": [
"<esc><wait>",
"install ",
"debian-installer/locale string en_GB ",
"debian-installer/language=en ",
"debian-installer/country=GB ",
"debian-installer/locale=en_GB.UTF-8 ",
"clock-setup/utc=true ",
"time/zone=GB/London ",
"console-setup/ask_detect=false ",
"keyboard-configuration/xkb-keymap=gb ",
"preseed/url=http://some.internal.hostname.com/buster/preseed.cfg ",
"netcfg/choose_interface=ens192 ",
"netcfg/disable_autoconfig=true ",
"netcfg/get_ipaddress=192.168.100.142 ",
"netcfg/get_netmask=255.255.255.0 ",
"netcfg/get_gateway=192.168.100.240 ",
"netcfg/get_nameservers=192.168.100.240 ",
"netcfg/confirm_static=true ",
"netcfg/get_hostname=test-vm ",
"netcfg/get_domain=internal.domain.com ",
"<enter>"
]
}
],
"provisioners": [
{
"type": "shell",
"inline": ["ls /"]
}
]
}