vSphere iso builder with datastore

Hey all;

Trying to get Packer up and running in the environment. First stage is getting it working with my vSphere environment.

I’ve got the builder setup, it connects to my vSphere, and I’ve uploaded the iso into a datastore, inside a folder.

source "vsphere-iso" "linux_centos" {
    [...]
    datastore           = "LebVM01-Leb-Alpha-P1"
    iso_url             = "[LebVM01-Leb-Alpha-P1] ISOs/CentOS-8.3.2011-x86_64-dvd1.iso"
    [...]
}

However, when I run the build, it comes back at me saying it can’t find the iso:

--> vsphere-iso.linux_centos: error downloading ISO: [source path error: stat /[LebVM01-Leb-Alpha-P1] ISOs/CentOS-8.3.2011-x86_64-dvd1.iso: no such file or directory]

I’ve confirmed in vSphere at the ISO is in the specified datastore, and the vm is being built in the same cluster and host that has that datastore.

So, any tips or insights on how to troubleshoot this?

Packer version 1.7.2

Additional logs:

bash-5.1# packer build -debug /test.pkr.hcl
2021/04/20 18:28:33 [INFO] Packer version: 1.7.2 [go1.16.3 linux amd64]
2021/04/20 18:28:33 [TRACE] discovering plugins in /usr/local/sbin
2021/04/20 18:28:33 [TRACE] discovering plugins in /root/.packer.d/plugins
2021/04/20 18:28:33 [TRACE] discovering plugins in .
2021/04/20 18:28:33 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/04/20 18:28:33 [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig
2021/04/20 18:28:33 [WARN] Config file doesn't exist: /root/.packerconfig
2021/04/20 18:28:33 [INFO] Setting cache directory: /usr/local/sbin/packer_cache
2021/04/20 18:28:33 [TRACE] validateValue: not active for image_name, so skipping
2021/04/20 18:28:33 [TRACE] Starting internal plugin packer-builder-vsphere-iso
2021/04/20 18:28:33 Starting plugin: /usr/local/sbin/packer []string{"/usr/local/sbin/packer", "plugin", "packer-builder-vsphere-iso"}
2021/04/20 18:28:33 Waiting for RPC address for: /usr/local/sbin/packer
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: [INFO] Packer version: 1.7.2 [go1.16.3 linux amd64]
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: [INFO] Setting cache directory: /usr/local/sbin/packer_cache
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: args: []string{"packer-builder-vsphere-iso"}
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: Plugin address: unix /tmp/packer-plugin602397276
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: Waiting for connection...
2021/04/20 18:28:33 Received unix RPC address for /usr/local/sbin/packer: addr is /tmp/packer-plugin602397276
2021/04/20 18:28:33 packer-builder-vsphere-iso plugin: Serving a plugin connection...
2021/04/20 18:28:33 Build debug mode: true
2021/04/20 18:28:33 Force build: false
2021/04/20 18:28:33 On error:
2021/04/20 18:28:33 Debug enabled, so waiting for build to finish: vsphere-iso.linux_centos
2021/04/20 18:28:33 Starting build run: vsphere-iso.linux_centos
2021/04/20 18:28:33 Running builder:
2021/04/20 18:28:33 [INFO] (telemetry) Starting builder
Debug mode enabled. Builds will not be parallelized.
vsphere-iso.linux_centos: output will be in this color.

==> vsphere-iso.linux_centos: Pausing after run of step 'StepConnect'. Press enter to continue. 
==> vsphere-iso.linux_centos: Retrieving ISO
==> vsphere-iso.linux_centos: Trying [LebVM01-Leb-Alpha-P1] ISOs/CentOS-8.3.2011-x86_64-dvd1.iso
2021/04/20 18:28:48 packer-builder-vsphere-iso plugin: Acquiring lock for: %5BLebVM01-Leb-Alpha-P1%5D%20ISOs/CentOS-8.3.2011-x86_64-dvd1.iso?checksum=sha256%3Aaaf9d4b3071c16dbbda01dfe06085e5d0fdac76df323e3bbe87cce4318052247 (/usr/local/sbin/packer_cache/21fd426f385a4db491128c34a4034062dc28425c.iso.lock)
==> vsphere-iso.linux_centos: Trying %5BLebVM01-Leb-Alpha-P1%5D%20ISOs/CentOS-8.3.2011-x86_64-dvd1.iso?checksum=sha256%3Aaaf9d4b3071c16dbbda01dfe06085e5d0fdac76df323e3bbe87cce4318052247
==> vsphere-iso.linux_centos: Download failed source path error: stat /usr/local/sbin/[LebVM01-Leb-Alpha-P1] ISOs/CentOS-8.3.2011-x86_64-dvd1.iso: no such file or directory
2021/04/20 18:28:48 packer-builder-vsphere-iso plugin: Leaving retrieve loop for ISO
==> vsphere-iso.linux_centos: error downloading ISO: [source path error: stat /usr/local/sbin/[LebVM01-Leb-Alpha-P1] ISOs/CentOS-8.3.2011-x86_64-dvd1.iso: no such file or directory]
==> vsphere-iso.linux_centos: Pausing before cleanup of step 'StepConnect'. Press enter to continue. 
Build 'vsphere-iso.linux_centos' errored after 20 seconds 988 milliseconds: error downloading ISO: [source path error: stat /usr/local/sbin/[LebVM01-Leb-Alpha-P1] ISOs/CentOS-8.3.2011-x86_64-dvd1.iso: no such file or directory]

==> Wait completed after 20 seconds 988 milliseconds

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso.linux_centos: error downloading ISO: [source path error: stat /usr/local/sbin/[LebVM01-Leb-Alpha-P1] ISOs/CentOS-8.3.2011-x86_64-dvd1.iso: no such file or directory]

==> Builds finished but no artifacts were created.
2021/04/20 18:28:54 [INFO] (telemetry) ending
2021/04/20 18:28:54 Waiting on builds to complete...
==> Wait completed after 20 seconds 988 milliseconds
2021/04/20 18:28:54 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2021/04/20 18:28:54 machine readable: vsphere-iso.linux_centos,error []string{"error downloading ISO: [source path error: stat /usr/local/sbin/[LebVM01-Leb-Alpha-P1] ISOs/CentOS-8.3.2011-x86_64-dvd1.iso: no such file or directory]"}
==> Builds finished but no artifacts were created.
2021/04/20 18:28:54 [INFO] (telemetry) Finalizing.
2021/04/20 18:28:55 waiting for all plugin processes to complete...
2021/04/20 18:28:55 /usr/local/sbin/packer: plugin process exited
bash-5.1#

Hellol @MichaelSweikata.
Did you got resolve this problem?
I have this error in my build.

Actually no, I didn’t fix the issue. After enough bashing my head against it and having to meet deadlines, I ended up creating a Linux distro as a base manually, and then from that clone it and do all my changes to the clone. It’s a bit of a pain in the ass, but it got me rolling.

I got build using iso on my computer. The problem is that it takes a long time to build the template. Because the packer copies the ISO from my pc to vmware.

This my piece of code.
}
“iso_url”: “./ubuntu-18.04.5-live-server-amd64.iso”,
“remote_cache_datastore”: “ESXIHM01_FS1_DT06”,
“remote_cache_directory”: “ISOs”
}