No errors in log but file provisioner fails to upload file

Like the title says, the log looks successful to me, everything related to “provisioner-file” or “install.sh” (name of the file I’m trying to upload) seems to indicate success but then the file isn’t there when I boot with qemu.

I’m kind of at a loss for what else to look at, I’ve attached the log to the bottom as well as my packerfile and cloud-config below. Thanks for any help!

source "qemu" "wordpress" {
  iso_url              = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
  iso_checksum         = "b2f77380d6afaa6ec96e41d5f9571eda"
  format               = "qcow2"
  ssh_username         = "localadmin"
  ssh_private_key_file = "~/.ssh/wordpress"
  vm_name              = "wordpress"
  disk_image           = true
  boot_wait            = "10s"
  use_default_display  = true
  headless             = false
  http_directory       = "projects/wordpress/packer/cloud-data"
  vnc_port_min         = 5900
  vnc_port_max         = 5900
  ssh_timeout          = "20m"
  qemuargs             = [["-smbios", "type=1,serial=ds=nocloud-net;instance-id=packer;seedfrom=http://{{ .HTTPIP }}:{{ .HTTPPort }}/"]]
}

build {
  sources = ["source.qemu.wordpress"]

  provisioner "file" {
    source      = "projects/wordpress/install.sh"
    destination = "/tmp/install.sh"
  }

  provisioner "shell" {
    inline = [
      "echo '/tmp/install.sh' | sudo tee -a /etc/rc.local"
    ]
  }
}

contents of the user-data file I’m using:

#cloud-config
ssh_pwauth: true
users:
  - name: localadmin
    sudo: ALL=(ALL) NOPASSWD:ALL
    groups: users, admin, sudo
    shell: /bin/bash
    lock_passwd: false
    passwd: $6$rounds=4096$nQEeaHt...
    ssh_authorized_keys: 
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCX3Z...
  - name: wordpress
    groups: [www-data]
    shell: /bin/bash
    lock_passwd: false
    passwd: $6$rounds=4096$nQEeaHtrj...
apt:
    preserve_sources_list: true
package_update: false

packer-log.txt (25.6 KB)

I may have found a bug, I got it to work by changing absolutely none of the code in this post and adding -debug to my packer build command. Running the exact same thing without debug still fails to write the files correctly. It’s annoying having to push enter through all the debug pauses but at least it works now.