Packer: iso_url path doesn't work for windows network paths

Created on 31 Dec 2019  ยท  8Comments  ยท  Source: hashicorp/packer

Hello.
up to this point, I was using version 1.3.3 and decided to upgrade to 1.5. but after updating the exe file, links to iso images stopped working
I use "iso_url": "\\server\share\en_windows.iso"
In the logs, I see that Packer tries to use the path (\server\share\en_windows.iso), and then converts it to (smb://server/share/en_windows.iso).
I also used the prefix file://, but it didn't help
hyperv-iso

question windows-host

Most helpful comment

Here are the log from 1.3.5 passing run:

...\packer_1.3.5_windows_amd64\packer" build -force -on-error=abort test_1.3.5/packer.json
...
==> vmware-iso: Retrieving ISO
2020/01/17 16:57:13 packer.exe: 2020/01/17 16:57:13 Acquiring lock to download: smb://<UncHost>/<UncShare>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso
2020/01/17 16:57:13 packer.exe: 2020/01/17 16:57:13 Parsed URL: &url.URL{Scheme:"smb", Opaque:"", User:(*url.Userinfo)(nil), Host:"<UncHost", Path:"/<UncShare>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso", RawPath:"", ForceQuery:false, RawQuery:"", Fragment:""}
2020/01/17 16:57:13 packer.exe: 2020/01/17 16:57:13 [DEBUG] Using local file: \\<UncHost>/<UncPath>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso
2020/01/17 16:57:13 packer.exe: 2020/01/17 16:57:13 Verifying checksum of \\<UncHost>/<UncPath>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso
    vmware-iso: Using file in-place: smb://<UncHost>/<UncPath>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso
2020/01/17 16:58:07 packer.exe: 2020/01/17 16:58:07 [DEBUG] Opening new ssh session
2020/01/17 16:58:07 packer.exe: 2020/01/17 16:58:07 [DEBUG] starting remote command: test -e "/vmfs/volumes/<datastore>/<VmName>"
==> vmware-iso: Deleting previous output directory...
...

All 8 comments

Hi there! Thanks for opening this issue. We had an issue during that time where the packer_cache on windows was causing issues. Can you try clearing your packer_cache directory and then building again? If that doesn't resolve your issue, will you please share the simplest possible packer template that reproduces the issue, as well as the logs produced when you run the packer build after setting the environment variable PACKER_LOG=1?

I`m clearing packer_cache directory, but it didn't help

Log

c:\Packer>c:\Packer\packer-1.5.1.exe build --force c:\test\winsrv2019stdGen2\winsrv2019stdGen2.json
2020/01/09 07:54:37 [INFO] Packer version: 1.5.1 [go1.13.5 windows amd64]
2020/01/09 07:54:37 Attempting to open config file: C:\Users\vterenin\AppData\Roaming\packer.config
2020/01/09 07:54:37 [WARN] Config file doesn't exist: C:\Users\vterenin\AppData\Roaming\packer.config
2020/01/09 07:54:37 Setting cache directory: c:\Packer\packer_cache
cannot determine if process is in background: Process background check error: not implemented yet
2020/01/09 07:54:38 Plugin could not be found at c:\Packer\packer-1.5.1.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-iso (exec: "c:\\Packer\\packer-1.5.1.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-iso": file does not exist). Checking same directory as executable.
2020/01/09 07:54:38 Current exe path: c:\Packer\packer-1.5.1.exe
2020/01/09 07:54:38 Creating plugin client for path: c:\Packer\packer-1.5.1.exe
2020/01/09 07:54:38 Starting plugin: c:\Packer\packer-1.5.1.exe []string{"c:\\Packer\\packer-1.5.1.exe", "plugin", "packer-builder-hyperv-iso"}
2020/01/09 07:54:38 Waiting for RPC address for: c:\Packer\packer-1.5.1.exe
2020/01/09 07:54:38 packer-1.5.1.exe plugin: [INFO] Packer version: 1.5.1 [go1.13.5 windows amd64]
2020/01/09 07:54:38 packer-1.5.1.exe plugin: Attempting to open config file: C:\Users\vt\AppData\Roaming\packer.config
2020/01/09 07:54:38 packer-1.5.1.exe plugin: [WARN] Config file doesn't exist: C:\Users\vt\AppData\Roaming\packer.config
2020/01/09 07:54:38 packer-1.5.1.exe plugin: Setting cache directory: c:\Packer\packer_cache
hyperv-iso: output will be in this color.
2020/01/09 07:54:38 packer-1.5.1.exe plugin: args: []string{"packer-builder-hyperv-iso"}
2020/01/09 07:54:38 packer-1.5.1.exe plugin: Plugin port range: [10000,25000]
2020/01/09 07:54:38 packer-1.5.1.exe plugin: Plugin address: tcp 127.0.0.1:10000
2020/01/09 07:54:38 packer-1.5.1.exe plugin: Waiting for connection...
2020/01/09 07:54:38 Received tcp RPC address for c:\Packer\packer-1.5.1.exe: addr is 127.0.0.1:10000
2020/01/09 07:54:38 packer-1.5.1.exe plugin: Serving a plugin connection...
2020/01/09 07:54:38 Build debug mode: false
2020/01/09 07:54:38 Force build: true
2020/01/09 07:54:38 On error:
2020/01/09 07:54:38 Preparing build: hyperv-iso
2020/01/09 07:54:38 packer-1.5.1.exe plugin: DiskBlockSize: 32
2020/01/09 07:54:38 packer-1.5.1.exe plugin: RamSize: 4096
2020/01/09 07:54:38 packer-1.5.1.exe plugin: DiskSize: 130048
a checksum is highly recommended.
2020/01/09 07:54:38 Waiting on builds to complete...
2020/01/09 07:54:38 Starting build run: hyperv-iso
2020/01/09 07:54:38 Running builder: hyperv-iso
2020/01/09 07:54:38 [INFO] (telemetry) Starting builder hyperv-iso
2020/01/09 07:54:38 packer-1.5.1.exe plugin: Enter method: verifyPSVersion
Warnings for build 'hyperv-iso':

* A checksum type of 'none' was specified. Since ISO files are so big,
a checksum is highly recommended.

2020/01/09 07:54:38 packer-1.5.1.exe plugin: $host.version.Major output: 5
2020/01/09 07:54:38 packer-1.5.1.exe plugin: Enter method: verifyPSHypervModule
2020/01/09 07:54:39 packer-1.5.1.exe plugin: Enter method: verifyHypervPermissions
==> hyperv-iso: Creating build directory...
2020/01/09 07:54:39 packer-1.5.1.exe plugin: Created build directory: C:\Users\vt\AppData\Local\Temp\hyperv391989510
==> hyperv-iso: Retrieving ISO
2020/01/09 07:54:39 packer-1.5.1.exe plugin: Acquiring lock for: smb://windev-vt/ISO/en_windows_server_2019_updated_feb_2019.iso (c:\Packer\packer_cache\1a877efecedd13dea3f48ab0c85d83f145cca3d7.iso.lock)
==> hyperv-iso: Trying \\windev-vt\ISO\en_windows_server_2019_updated_feb_2019.iso
2020/01/09 07:54:39 packer-1.5.1.exe plugin: Leaving retrieve loop for ISO
==> hyperv-iso: Trying smb://windev-vt/ISO/en_windows_server_2019_updated_feb_2019.iso
2020/01/09 07:54:39 [INFO] (telemetry) ending hyperv-iso
==> hyperv-iso: Download failed source path error: CreateFile /ISO/en_windows_server_2019_updated_feb_2019.iso: The system cannot find the path specified.
==> hyperv-iso: error downloading ISO: [source path error: CreateFile /ISO/en_windows_server_2019_updated_feb_2019.iso: The system cannot find the path specified.]
2020/01/09 07:54:39 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2020/01/09 07:54:39 machine readable: hyperv-iso,error []string{"error downloading ISO: [source path error: CreateFile /ISO/en_windows_server_2019_updated_feb_2019.iso: The system cannot find the path specified.]"}
==> hyperv-iso: Deleting output directory...
==> Builds finished but no artifacts were created.
2020/01/09 07:54:39 [INFO] (telemetry) Finalizing.
==> hyperv-iso: Deleting build directory...
Build 'hyperv-iso' errored: error downloading ISO: [source path error: CreateFile /ISO/en_windows_server_2019_updated_feb_2019.iso: The system cannot find the path specified.]

==> Some builds didn't complete successfully and had errors:
--> hyperv-iso: error downloading ISO: [source path error: CreateFile /ISO/en_windows_server_2019_updated_feb_2019.iso: The system cannot find the path specified.]

==> Builds finished but no artifacts were created.
2020/01/09 07:54:40 waiting for all plugin processes to complete...
2020/01/09 07:54:40 c:\Packer\packer-1.5.1.exe: plugin process exited

Json

{
  "variables": {
    "iso_url": "\\\\windev-vt\\ISO\\en_windows_server_2019_updated_feb_2019.iso",
    "vm_name": "test",
    "template_root_folder": "c:\\test",
    "admin_username": "Administrator",
    "admin_password": "Password"
  },

  "builders": [
    {
      "boot_command": [
        "a<wait>a<wait>a"
      ],
      "boot_wait": "0s",
      "communicator":"winrm",
      "cpus": 4,
      "disk_size": 130048,
      "secondary_iso_images": [
      "{{user `template_root_folder`}}/answer.iso"
      ],
      "generation": 2,
      "iso_checksum": "",
      "iso_checksum_type": "none",
      "iso_url": "{{user `iso_url`}}",
      "output_directory": "{{user `template_root_folder`}}\\{{user `vm_name`}}",
      "memory": 4096,
      "switch_name":"VmInterconnectSwitch",
      "type": "hyperv-iso",
      "winrm_username": "{{user `admin_username`}}",
      "winrm_password": "{{user `admin_password`}}",
      "winrm_timeout" : "12h",
      "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
      "vm_name": "{{user `vm_name`}}"
    }
  ],
  "provisioners": []
}

Looks like we introduced this bug here: https://github.com/hashicorp/packer/pull/7800 Sorry about that. I'll see if I can repro and fix it.

Meanwhile, do you think you can share logs from your 1.3.3 passing run so that I can compare?

Sorry, but we have a very short log rotation. Now I use symbolic links.

Here are the log from 1.3.5 passing run:

...\packer_1.3.5_windows_amd64\packer" build -force -on-error=abort test_1.3.5/packer.json
...
==> vmware-iso: Retrieving ISO
2020/01/17 16:57:13 packer.exe: 2020/01/17 16:57:13 Acquiring lock to download: smb://<UncHost>/<UncShare>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso
2020/01/17 16:57:13 packer.exe: 2020/01/17 16:57:13 Parsed URL: &url.URL{Scheme:"smb", Opaque:"", User:(*url.Userinfo)(nil), Host:"<UncHost", Path:"/<UncShare>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso", RawPath:"", ForceQuery:false, RawQuery:"", Fragment:""}
2020/01/17 16:57:13 packer.exe: 2020/01/17 16:57:13 [DEBUG] Using local file: \\<UncHost>/<UncPath>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso
2020/01/17 16:57:13 packer.exe: 2020/01/17 16:57:13 Verifying checksum of \\<UncHost>/<UncPath>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso
    vmware-iso: Using file in-place: smb://<UncHost>/<UncPath>/<UncPath>/CentOS-7-x86_64-DVD-1804.iso
2020/01/17 16:58:07 packer.exe: 2020/01/17 16:58:07 [DEBUG] Opening new ssh session
2020/01/17 16:58:07 packer.exe: 2020/01/17 16:58:07 [DEBUG] starting remote command: test -e "/vmfs/volumes/<datastore>/<VmName>"
==> vmware-iso: Deleting previous output directory...
...

Hello there! I've implemented a solution for this. Could you please test it and let me know if it works for you?
Here the binaries you can use: https://circleci.com/gh/hashicorp/packer/41568#artifacts/containers/0

Hello there! I've implemented a solution for this. Could you please test it and let me know if it works for you?
Here the binaries you can use: https://circleci.com/gh/hashicorp/packer/41568#artifacts/containers/0

Ive tested and it works to get the file thrue smb but seems longer then usual to do download/cksum even after a second time test because of there is no cache anymore.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings