I was trying to automate a Packer build of Ubuntu Desktop 21.04 in vSphere with the HCL below. Since then I have found out that this won't work with the desktop images until 21.10 "Impish" at minimum, as discussed here:
https://discourse.ubuntu.com/t/refreshing-the-ubuntu-desktop-installer/20659/76?u=nathanto
The original question is below to help others.
The key piece is where the boot command defines the seedfrom
. That seems not to work in the sense that the user-data
is never loaded. The VM boots, and the net.ifnames=0
argument from the boot command is applied (interfaces are named eth0
).
The logic of the boot command is to press c
to get to the grub>
prompt, and then the commands are entered as shown in the boot_command
below.
I see in the /proc/cmdline
that the boot command is applied properly.
I can see no indication that the user-data
is loaded though. If I look at the web server shown in the boot command, using Firefox from the booted VM, the user-data
and meta-data
files are there and accessible.
Does anyone have any ideas of how to debug this please?
source "vsphere-iso" "dev_vm" {
username = var.vcenter_username
password = var.vcenter_password
vcenter_server = var.vcenter_server
cluster = var.vcenter_cluster
datacenter = var.vcenter_datacenter
datastore = var.vcenter_vm_datastore
guest_os_type = "ubuntu64Guest"
insecure_connection = "true"
iso_checksum = "sha256:fa95fb748b34d470a7cfa5e3c1c8fa1163e2dc340cd5a60f7ece9dc963ecdf88"
iso_urls = ["https://releases.ubuntu.com/21.04/ubuntu-21.04-desktop-amd64.iso"]
http_directory = "./http"
vm_name = "dev_vm"
CPUs = 2
RAM = 2048
RAM_reserve_all = true
boot_wait = "3s"
convert_to_template = false
boot_command = [
"c",
"linux /casper/vmlinuz --- autoinstall ds='nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/' net.ifnames=0 ",
"<enter><wait>",
"initrd /casper/initrd<enter><wait>",
"boot<enter>"
]
network_adapters {
network = "xxx"
network_card = "e1000"
}
storage {
disk_size = 40960
disk_thin_provisioned = true
}
ssh_username = "xx"
ssh_password = "xx"
ssh_timeout = "60m"
}
build {
sources = [
"source.vsphere-iso.dev_vm"
]
...
}