1

I'm using vsphere-clone to create a vm and in provisioning installing one product which takes around 1hr to complete installation. Getting this error in most of the run while executing packer.(sometimes it works also)

vsphere-clone: Provisioning step had errors: Running the cleanup provisioner, if present...
vsphere-clone: Power off VM...
vsphere-clone: Destroying VM...
Build 'vsphere-clone' errored after 1 hour 5 minutes: Script exited with non-zero exit status: 2300218.   

packer version 1.8.5

VM os : win 10(tried with diff win10 builds as well)

Sagar Trivedi
  • 47
  • 1
  • 11

1 Answers1

1

You need to add valid exit codes in your provisioners section for whatever command, powershell command, or script you run:

    {
      "inline": [
        "powershell a:/win11VMtools.ps1"
      ],
     "type": "windows-shell",
     "valid_exit_codes": [0, 3010]
    },
    {
      "inline": [
        "cmd /c a:/enable-rdp.cmd"
      ],
     "type": "windows-shell",
     "valid_exit_codes": [0, 3010]
    }

This is JSON but you would do the same for HCL2