Score:0

Packer Ubuntu Server 20.04 prompting for install confirmation despite `autoinstall` specified in `boot_command`

be flag

I am setting up an unattended install for Ubuntu Server 20.04 with packer. However, despite my specifying autoinstall in the boot_command, the installer always asks me for confirmation (I need to manually type "yes" - in the middle of the screenshot): enter image description here

This obviously defeats the concept of "unattended install", but I am not able to figure out what is the issue. I'm posting below two different boot_commands I'm using, and my full configuration at the end of the post.

Both boot commands produce a working installation, but both still ask for confirmation. Boot command 1:

boot_command = ["<enter><wait2><enter><wait><f6><esc><wait>", "autoinstall<wait2> ds=nocloud;", "<wait><enter>"]

Boot command 2:

      "boot_command": [
        "<enter><wait2><enter><wait><f6><esc><wait>",
        "linux /casper/vmlinuz autoinstall ds=nocloud;",
        "<wait><enter>",
        "initrd /casper/initrd",
        "<wait><enter>",
        "boot"
      ],

Full configuration: ./ubuntu2004.pkr.hcl:

source "virtualbox-iso" "autogenerated_1" {
  boot_command            = ["<enter><wait2><enter><wait><f6><esc><wait>", "autoinstall<wait2> ds=nocloud;", "<wait><enter>"]
  boot_wait               = "2s"
  cd_files                = ["./http/user-data", "./http/meta-data"]
  cd_label                = "cidata"
  disk_size               = 8192
  guest_additions_path    = "VBoxGuestAdditions_{{ .Version }}.iso"
  guest_os_type           = "Ubuntu_64"
  headless                = false
  http_directory          = "http"
  iso_checksum            = "sha256:f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98"
  iso_urls                = ["https://releases.ubuntu.com/focal/ubuntu-20.04.3-live-server-amd64.iso"]
  shutdown_command        = "echo 'ubuntu'|sudo -S shutdown -P now"
  ssh_agent_auth          = true
  ssh_handshake_attempts  = "200"
  ssh_private_key_file    = "/home/asdf/.ssh/virtual_id_ed25519"
  ssh_username            = "vagrant"
  ssh_wait_timeout        = "10000s"
  vboxmanage              = [["modifyvm", "{{ .Name }}", "--memory", "1024"], ["modifyvm", "{{ .Name }}", "--cpus", "1"]]
  virtualbox_version_file = ".vbox_version"
  vm_name                 = "packer-ubuntu-20.04-amd64"
}

build {
  sources = ["source.virtualbox-iso.autogenerated_1"]

  provisioner "shell" {
    scripts = ["scripts/init.sh"]
  }

  provisioner "shell" {
    scripts = ["scripts/cleanup.sh"]
  }

  post-processor "vagrant" {
    compression_level = "8"
    output            = "ubuntu-20.04-test.box"
  }
}

./http/user-data:

#cloud-config
autoinstall:
  version: 1
  locale: en_US
  keyboard:
    layout: en
    variant: us
  network:
    network:
      version: 2
      ethernets:
        enp0s3:
          dhcp4: true
  storage:
    layout:
      name: lvm
  ssh:
    install-server: yes
  user-data:
    users:
      - name: vagrant
        ssh_authorized_keys:
          - ssh-ed25519 REDACTED
        sudo: ALL=(ALL) NOPASSWD:ALL
        groups: [adm, sudo]
        lock_passwd: true
        shell: /bin/bash
  packages:
    - openssh-server
    - build-essential
  late-commands:
    - echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/vagrant
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.