packer-builder-vsphere
packer-builder-vsphere copied to clipboard
Ubuntu VM Waiting for IP
Hello.
Trying to use packer
for the first time for deploying Ubuntu VM on my vSphere host.
Got stuck with:
./packer build test.json
vsphere-iso output will be in this color.
==> vsphere-iso: Creating VM...
==> vsphere-iso: Customizing hardware...
==> vsphere-iso: Mount ISO images...
==> vsphere-iso: Creating floppy disk...
vsphere-iso: Copying files flatly from floppy_files
vsphere-iso: Copying file: /home/horseinthesky/.packer.d/preseed.cfg
vsphere-iso: Done copying files from floppy_files
vsphere-iso: Collecting paths from floppy_dirs
vsphere-iso: Resulting paths from floppy_dirs : []
vsphere-iso: Done copying paths from floppy_dirs
==> vsphere-iso: Uploading created floppy image
==> vsphere-iso: Adding generated Floppy...
==> vsphere-iso: Set boot order temporary...
==> vsphere-iso: Power on VM...
==> vsphere-iso: Waiting 10s for boot...
==> vsphere-iso: Typing boot command...
==> vsphere-iso: Waiting for IP...
This is my template:
{
"builders": [
{
"type": "vsphere-iso",
"vcenter_server": "192.168.0.6",
"username": "administrator",
"password": "<supersecretpass>",
"insecure_connection": "true",
"vm_name": "example-ubuntu",
"datacenter": "HomeLab",
"host": "192.168.0.5",
"datastore": "860EVO1",
"network_card": "vmxnet3",
"network": "Management Network",
"guest_os_type": "ubuntu64Guest",
"ssh_username": "horseinthesky",
"ssh_password": "<supersecretpass>",
"CPUs": 4,
"cpu_cores": 2,
"RAM": 8192,
"RAM_reserve_all": true,
"convert_to_template": false,
"disk_size": 32768,
"iso_paths": [
"[WD Red] ISO/ubuntu-18.04.3-server-amd64.iso"
],
"floppy_files": [
"{{template_dir}}/preseed.cfg"
],
"boot_command": [
"<enter><wait><f6><wait><esc><wait>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs>",
"/install/vmlinuz",
" initrd=/install/initrd.gz",
" priority=critical",
" locale=en_US",
" file=/media/preseed.cfg",
"<enter>"
]
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"ls /"
]
}
]
}
preseed.cfg
is located in the same directory I execute packer.
What do I do wrong?
During your build you need to add at the end of your preseed.cfg "d-i preseed/late_command string apt-install open-vmtools". Also depending on the version of vsphere-iso BIN you are using it will wait FOREVER (version 2.3 does). They need to build a new version of their bin that someone branched and tweaked code to expire after 30mins waiting for IP.
I'm running into the same issue, and it appears in my case the preseed.cfg is not being used.
The console is showing as below:
According to #176, the floppy driver was removed from the Ubuntu kernel, which likely explains my problem.
During your build you need to add at the end of your preseed.cfg "d-i preseed/late_command string apt-install open-vmtools".
In fact the right package (at least for FocalFossa - 20.04) is open-vm-tools (dash between vm and tools).
According to #176, the floppy driver was removed from the Ubuntu kernel, which likely explains my problem.
Hello, what did you do to work around since ubuntu won't read floppies?
I ended up building the image locally using the VMware ISO builder and then pushing it to my vSphere servers with the vSphere post-processor.
JFYI: Latest packer supports cd_files
and may compose temporarily cdrom same way as floppy
You can still feed it in as a floppy
@dnapier — Would love to see your Packer JSON or HCL — with sensitive info redacted, of course — if you still have access to those files and are willing to share?
@mikeschinkel Sorry, I just looked for them and I apparently don't have it anymore. :/
@dnapier — Well, at least thanks for looking.