Curl hangs on boot_command for virtualbox-iso

I’m not sure if it’s a bug or whether this is an error on my part, but my curl command doesn’t work with the virtualbox-iso setup, while it does work with the qemu setup.


SE_bastille-installer-box.pkr.hcl

... 
packer {
  required_plugins {
    ...
    virtualbox = {
      version = ">=1.0.4"
      source = "github.com/hashicorp/virtualbox"
    }
  }
}
...
boot_command_virtualbox = [
    "<enter><wait2m>",
    "ls -lha<enter>",
    "echo test<enter>",
    "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}<enter><wait5>",
    "curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/${local.kickstart_script} && chmod +x ${local.kickstart_script} && ./${local.kickstart_script} {{ .HTTPPort }}<enter>",
  ]
...
source "virtualbox-iso" "archlinux" {  
    boot_command           = local.boot_command_virtualbox
    boot_wait              = "2s"  
    communicator           = "ssh"
    cpus                   = 1
    disk_size              = local.disk_size_vb
    firmware               = "efi"
    format                 = "ovf"  
    guest_additions_mode   = "disable"
    guest_os_type          = "Arch"
    hard_drive_interface   = "sata"
    headless               = local.headless
    http_directory         = local.http_directory  
    iso_checksum           = local.iso_checksum
    iso_interface           = "sata"
    iso_url                = local.iso_url
    memory                 = local.memory
    shutdown_command       = "sudo systemctl start poweroff.timer"
    ssh_port               = 22
    ssh_private_key_file   = var.ssh_private_key_file 
    ssh_timeout            = var.ssh_timeout
    ssh_username           = var.ssh_username  
    vm_name                = "${local.vm_name}.ovf"
}
...

Found the issue. It’s a bug.

Temporary solution: replace {{ .HTTPIP }} with 10.0.2.3