Score:0

Packer Autoinstall with Ubuntu 21.04/21.10 Desktop

tr flag

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"
  ]
...
}

Andrew Lowther avatar
jp flag
You are using the Desktop iso, but are using an automation technique for _subiquity_, the Server installer. I do not think the Desktop iso uses _subiquity_ yet. This discussion suggests there could be a Desktop installer that uses _subiquity_ with the 21.10 release https://discourse.ubuntu.com/t/refreshing-the-ubuntu-desktop-installer/20659
Nathan Sowatskey avatar
tr flag
Thank you, I am digging into the 21.10 desktop releases and will report back.
Nathan Sowatskey avatar
tr flag
This *starts* to work in 21.10 as discussed here: https://discourse.ubuntu.com/t/refreshing-the-ubuntu-desktop-installer/20659/76?u=nathanto
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.