HashiCorp packer with vshpere 7.0.2 : error mounting an image

Not sure if anyone using Packer to build images for vmware vsphere 7.0.2. Here is the error I am having and I dont know what does it mean by device 0 What is this Device 0?

Does the lastest version work with vphsere 7.0.2 at all?

I am using packer version 1.7.3 and vsphere is 7.0.2, storage is FB SAN.

Errors below:

==> vsphere-iso: Creating VM...
==> vsphere-iso: Customizing hardware...
==> vsphere-iso: Mounting ISO images...
==> vsphere-iso: Destroying VM...
Build 'vsphere-iso' errored after 956 milliseconds 798 microseconds: error mounting an image '': Incompatible device backing specified for device '0'.

==> Wait completed after 957 milliseconds 63 microseconds

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso: error mounting an image '': Incompatible device backing specified for device '0'.

==> Builds finished but no artifacts were created.

Logs from packer:

2021/06/21 14:29:26 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2021/06/21 14:29:26 packer.exe plugin: Waiting for connection...
2021/06/21 14:29:26 Received tcp RPC address for C:\Program Files\HashiCorp\packer.exe: addr is 127.0.0.1:10000
2021/06/21 14:29:26 packer.exe plugin: Serving a plugin connection...
2021/06/21 14:29:26 [TRACE] Starting internal plugin packer-provisioner-shell
2021/06/21 14:29:26 Starting plugin: C:\Program Files\HashiCorp\packer.exe []string{"C:\\Program Files\\HashiCorp\\packer.exe", "plugin", "packer-provisioner-shell"}
2021/06/21 14:29:26 Waiting for RPC address for: C:\Program Files\HashiCorp\packer.exe
2021/06/21 14:29:27 packer.exe plugin: [INFO] Packer version: 1.7.3 [go1.16.5 windows amd64]
2021/06/21 14:29:27 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/06/21 14:29:27 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\r.yang\AppData\Roaming\packer.config
2021/06/21 14:29:27 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\r.yang\AppData\Roaming\packer.config
2021/06/21 14:29:27 packer.exe plugin: [INFO] Setting cache directory: D:\001_devops\terraform\vmware\packer-vsphere-iso-linux\Ubuntu-20.04-LTS\packer_cache
2021/06/21 14:29:27 packer.exe plugin: args: []string{"packer-provisioner-shell"}
2021/06/21 14:29:27 packer.exe plugin: Plugin port range: [10000,25000]
2021/06/21 14:29:27 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2021/06/21 14:29:27 packer.exe plugin: Waiting for connection...
2021/06/21 14:29:27 Received tcp RPC address for C:\Program Files\HashiCorp\packer.exe: addr is 127.0.0.1:10000
2021/06/21 14:29:27 packer.exe plugin: Serving a plugin connection...
2021/06/21 14:29:27 Preparing build: vsphere-iso
2021/06/21 14:29:27 ui: vsphere-iso: output will be in this color.
2021/06/21 14:29:27 ui: 
2021/06/21 14:29:27 Build debug mode: false
2021/06/21 14:29:27 Force build: false
2021/06/21 14:29:27 On error: 
2021/06/21 14:29:27 Waiting on builds to complete...
2021/06/21 14:29:27 Starting build run: vsphere-iso
2021/06/21 14:29:27 Running builder: vsphere-iso
2021/06/21 14:29:27 [INFO] (telemetry) Starting builder vsphere-iso
2021/06/21 14:29:27 packer.exe plugin: No URLs were provided to Step Download. Continuing...
2021/06/21 14:29:27 packer.exe plugin: No CD files specified. CD disk will not be made.
2021/06/21 14:29:27 ui: ==> vsphere-iso: Creating VM...
2021/06/21 14:29:27 ui: ==> vsphere-iso: Customizing hardware...
2021/06/21 14:29:27 ui: ==> vsphere-iso: Mounting ISO images...
2021/06/21 14:29:27 packer.exe plugin: Creating CD-ROM on controller '&{{{} 200 0xc001360ee0 <nil> <nil> <nil> 0 <nil>} 0 []}' with iso ''
2021/06/21 14:29:28 ui: ==> vsphere-iso: Destroying VM...
2021/06/21 14:29:28 [INFO] (telemetry) ending vsphere-iso
2021/06/21 14:29:28 ui error: Build 'vsphere-iso' errored after 1 second 647 milliseconds: error mounting an image '': Incompatible device backing specified for device '0'.
2021/06/21 14:29:28 ui: 
==> Wait completed after 1 second 647 milliseconds
2021/06/21 14:29:28 machine readable: error-count []string{"1"}
2021/06/21 14:29:28 ui error: 
==> Some builds didn't complete successfully and had errors:
2021/06/21 14:29:28 machine readable: vsphere-iso,error []string{"error mounting an image '': Incompatible device backing specified for device '0'."}
2021/06/21 14:29:28 ui error: --> vsphere-iso: error mounting an image '': Incompatible device backing specified for device '0'.
2021/06/21 14:29:28 ui: 
==> Builds finished but no artifacts were created.
2021/06/21 14:29:28 [INFO] (telemetry) Finalizing.
2021/06/21 14:29:29 waiting for all plugin processes to complete...
2021/06/21 14:29:29 C:\Program Files\HashiCorp\packer.exe: plugin process exited
2021/06/21 14:29:29 C:\Program Files\HashiCorp\packer.exe: plugin process exited

Build json file:

{
  "builders": [
    {
      "type": "vsphere-iso",
  
      "vcenter_server": "{{user `vcenter-server`}}",
      "username": "{{user `vcenter-username`}}",
      "password": "{{user `vcenter-password`}}",
      "insecure_connection": "true",
      "datacenter": "{{user `datacenter`}}",
  
      "vm_name": "{{user `vm-name`}}",
      "notes": "Build via Packer", 

      "datastore": "{{user `datastore`}}",
      "folder": "{{user `folder`}}",
      "host": "{{user `host`}}",
      "cluster": "{{user `cluster`}}",

      "convert_to_template": "true",

      "ssh_username": "{{user `ssh-username`}}",
      "ssh_password": "{{user `ssh-password`}}", 
      


    
      "boot_order": "disk,cdrom",
  
      "guest_os_type": "ubuntu64Guest",
      "CPUs": "{{user `vm-cpu-num`}}",
      "RAM": "{{user `vm-mem-size`}}",
      "RAM_reserve_all": false,
      "disk_controller_type": "pvscsi",
      "storage": [
        {
          "disk_size": "{{user `vm-disk-size`}}",
          "disk_thin_provisioned": true
        }
      ],
      "network_adapters": [
        {
          "network": "{{user `network`}}",
          "network_card": "vmxnet3"
        }
      ],
      "iso_paths": ["{{user `iso_url`}}"],
      "floppy_files": ["./preseed.cfg"],
      "boot_command": [
        "<enter><wait><f6><wait><esc><wait>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs>",
        "/install/vmlinuz",
        " initrd=/install/initrd.gz",
        " priority=critical",
        " locale=en_US",
        " file=/media/preseed.cfg",
        "<enter>"
      ]
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "sudo rm /etc/machine-id", 
        "sudo touch /etc/machine-id",
        "echo 'Packer Template Build -- Complete'"
      ]
    }
  ]
}

I ran into same error building Windows 2019 Image using Packer 1.7.3 and vSphere 7.0.2. My issue was resolved by copying ISO to same Datastore and using “os_iso_path” (HCL) where Template is being created.

can you be more specific please?
This is what I use

“iso-url”: “[msa2062-vmware] iso/ubuntu-20.04.2-live-server-amd64.iso”

I meant uploading ISO to the same datastore you are using for Template. Below are my two variables with same Datastore for example. I had different Datastore for VM and where I had uploaded the ISO and the build was failing with same error. I then uploaded the ISO to same datastore and updated the os_iso_path as below which worked. Hope this help.
vsphere_datastore = “nuc82_local”
os_iso_path = “[nuc82_local] ISOs/windows_server_2019.iso”

I see, I will try [os_iso_path] instead of [iso-url]. thx