Building VMware template for Ubuntu 24.04

Hi! I’ve been trying to figure out how to build a simple Ubuntu 24.04LTS template using Packer and the vmware-iso builder, and I’m running into an issue where I can’t seem to get the Ubuntu autoinstaller to see the yaml file I’m providing and just boots into the interactive installer.

Relevant packer hcl code:

iso_paths = ["[Storage-LUN-ISO] ISO/ubuntu-24.04-live-server-amd64.iso"]
cd_files = ["autoinstall.yaml"]
cd_label = "cidata"
boot_command = [
  "c", "<wait3s>",
  "linux /casper/vmlinuz autoinstall \"ds=nocloud;s=/cidata/\" ---", "<enter><wait3s>",
  "initrd /casper/initrd", "<enter><wait3s>",
  "boot", "<enter>"
]

If I break out of the Ubuntu installer and list block devices I can see the virtual CD image containing my autoinstall.yaml attached as sr1, but it doesn’t get mounted on boot.

A lot of examples suggest using http to provide the autoinstall file instead, but since I’m building on a remote vsphere with restricted the VM can’t connect to my local packer. Building locally on vmware fusion and then uploading the finished template isn’t an option due to limited bandwidth. Every example I’ve found that uses cd_files is using Ubuntu 22.04 and claims “it just works!”, however I attempted using the same configuration with 22.04 and encountered the same issue so clearly I’m doing something wrong here.

Sorry, I realized a typo. I meant to say I’m using the vsphere-iso builder.

I figured this out, so for anyone coming after, I wasn’t able to pass autoinstall.yaml, however I was able to pass cloud-init files using Packer, so my hcl now looks like this:

I also had an error in the kernel arguments, but that wasn’t the main issue. Seems no matter what I did I couldn’t get it to accept autoinstall.yaml, but providing a user-data file works.

  cd_files              = ["./meta-data", "./user-data"]
  cd_label              = "cidata"
  boot_wait             = "10s"
  boot_command = [
    "c", "<wait3s>",
    "linux /casper/vmlinuz --- autoinstall ds=nocloud;", "<enter><wait3s>",
    "initrd /casper/initrd", "<enter><wait3s>",
    "boot", "<enter>"
  ]

meta-data is empty, user-data contains:

#cloud-config
autoinstall:
  version: 1
  identity:
...etc

In case someone wants a step-by-step write up on how to do this, you can read my post on the process to build a VMware Packer template for Ubuntu 24.04 Server here:

Ubuntu 24.04 Packer Template for VMware