Packer 1.5.1 fails to load an ISO file from a local directory. The same configuration works on Packer 1.3.4
At this point Packer will fail with the error message below. It looks like it's trying to load the file from a path that contains the expected SHA of the file.
The same configuration file works fine with Packer 1.3.4
1.5.1
{
"variables": {
"admin_username": "me",
"admin_password": "myawesomepassword",
"cookbook_name": "base_linux",
"dir_cookbooks_src": "F:/vcs/github/calvinverse/base.linux/build/temp/cookbooks",
"dir_cookbooks_vendors": "F:/vcs/github/calvinverse/base.linux/berks/cookbooks",
"dir_deploy": "F:/vcs/github/calvinverse/base.linux/build/deploy",
"dir_http_user": "F:/vcs/github/calvinverse/base.linux/build/temp/ubuntu/http",
"dir_scripts_user": "F:/vcs/github/calvinverse/base.linux/build/temp/scripts",
"dir_temp": "F:/vcs/github/calvinverse/base.linux/build/temp",
"iso_checksum": "7d8e0055d663bffa27c1718685085626cb59346e7626ba3d3f476322271f573e",
"iso_url": "G:/iso/linux/ubuntu-18.04.3-server-amd64.iso",
"vm_name": "ubuntu-18-04-3",
"vm_ram_size_in_mb": "1024",
"vm_switch_name": "VM-LAN",
"vm_switch_vlan": ""
},
"builders": [
{
"boot_wait": "1s",
"boot_command": [
"<esc><wait10><esc><esc><enter><wait>",
"set gfxpayload=1024x768<enter>",
"linux /install/vmlinuz ",
"preseed/url=http://192.168.3.73:{{.HTTPPort}}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{.Name}} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false <enter>",
"initrd /install/initrd.gz<enter>",
"boot<enter>"
],
"communicator": "ssh",
"disk_block_size": "1",
"enable_dynamic_memory": false,
"enable_mac_spoofing": false,
"enable_secure_boot": false,
"enable_virtualization_extensions": false,
"generation": 2,
"guest_additions_mode": "disable",
"headless": true,
"http_directory": "{{ user `dir_http_user` }}",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "sha256",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_target_path": "{{ user `dir_temp` }}/packer",
"memory": "{{user `vm_ram_size_in_mb`}}",
"output_directory": "{{ user `dir_temp` }}/{{ user `vm_name` }}",
"secure_boot_template": "MicrosoftUEFICertificateAuthority",
"shutdown_command": "echo '{{user `admin_password`}}' | sudo -S -E shutdown -P now",
"ssh_password": "{{user `admin_password`}}",
"ssh_timeout": "4h",
"ssh_username": "{{user `admin_username`}}",
"switch_name": "{{user `vm_switch_name`}}",
"type": "hyperv-iso",
"vm_name": "{{ user `vm_name` }}"
}
],
"provisioners": [ ]
}
Windows 10, 1909 - OS Build 18363.476
Hyper-V
Building F:\vcs\github\calvinverse\base.linux\build\temp\build\packer.json ...
==> hyperv-iso: Creating build directory...
==> hyperv-iso: Retrieving ISO
==> hyperv-iso: Trying G:/iso/linux/ubuntu-18.04.3-server-amd64.iso
==> hyperv-iso: Trying file://G:/iso/linux/ubuntu-18.04.3-server-amd64.iso?checksum=sha256%3A7d8e0055d663bffa27c1718685085626cb59346e7626ba3d3f476322271f573e
==> hyperv-iso: file://G:/iso/linux/ubuntu-18.04.3-server-amd64.iso?checksum=sha256%3A7d8e0055d663bffa27c1718685085626cb59346e7626ba3d3f476322271f573e => F:/vcs/github/calvinverse/base.linux/build/temp/packer
==> hyperv-iso: Starting HTTP server on port 8226
==> hyperv-iso: Creating switch 'VM-LAN' if required...
==> hyperv-iso: switch 'VM-LAN' already exists. Will not delete on cleanup...
==> hyperv-iso: Creating virtual machine...
==> hyperv-iso: Enabling Integration Service...
==> hyperv-iso: PowerShell error: Hyper-V\Add-VMDvdDrive : The specified path for the drive is not valid. Specify a path to an .iso file or a volume
==> hyperv-iso: name of the physical drive.
==> hyperv-iso: At F:\vcs\github\calvinverse\base.linux\build\temp\powershell214333398.ps1:3 char:18
==> hyperv-iso: + ... ontroller = Hyper-V\Add-VMDvdDrive -VMName $vmName -path $isoPath -Pa ...
==> hyperv-iso: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> hyperv-iso: + CategoryInfo : InvalidArgument: (:) [Add-VMDvdDrive], VirtualizationException
==> hyperv-iso: + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.AddVMDvdDrive
==> hyperv-iso: Unregistering and deleting virtual machine...
==> hyperv-iso: Deleting output directory...
==> hyperv-iso: Deleting build directory...
Build 'hyperv-iso' errored: PowerShell error: Hyper-V\Add-VMDvdDrive : The specified path for the drive is not valid. Specify a path to an .iso file or a volume
name of the physical drive.
At F:\vcs\github\calvinverse\base.linux\build\temp\powershell214333398.ps1:3 char:18
+ ... ontroller = Hyper-V\Add-VMDvdDrive -VMName $vmName -path $isoPath -Pa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Add-VMDvdDrive], VirtualizationException
+ FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.AddVMDvdDrive
==> Some builds didn't complete successfully and had errors:
--> hyperv-iso: PowerShell error: Hyper-V\Add-VMDvdDrive : The specified path for the drive is not valid. Specify a path to an .iso file or a volume
name of the physical drive.
At F:\vcs\github\calvinverse\base.linux\build\temp\powershell214333398.ps1:3 char:18
+ ... ontroller = Hyper-V\Add-VMDvdDrive -VMName $vmName -path $isoPath -Pa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Add-VMDvdDrive], VirtualizationException
+ FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.AddVMDvdDrive
==> Builds finished but no artifacts were created.
Hi, thanks for reaching out. Can you try deleting your packer_cache directory and then rerunning? We had an issue a while back with bad symlinking causing broken builds.
I will try tonight when I'm near my machine again
@SwampDragons I've just run another build with Packer 1.5.1. I've set the packer cache directory to a temp folder in my workspace (i.e. git repository workspace at f:\myworkspace
, packer cache at f:\myworkspace\temp\packer-cache
). Made sure the packer cache directory was empty and ran packer which resulted in the same log as above.
As mentioned 1.3.4 works fine
Okay, thanks for checking for me. I'll try to reproduce soon.
Hi @pvandervelde, thanks again for reaching out and keeping us updated. I confirmed that the issue occurs when using the iso_target_path
configuration option for changing the path of the downloaded file; removing the option successfully boots the Ubuntu image and continues with the build. Can you try removing iso_target_path
from your configuration and rerunning your build?
In the meantime, I'll continue to look into why the use of iso_target_path
is failing.
Hello! I was going into this with more details and it seems that packer is expecting the iso_target_path
to contain the iso file as well, like
"iso_target_path": "{{ user `dir_temp` }}/packer/name.iso"
I tried this way it works.
Since the documentation and also the field name makes us understand that it's only the path, I will try to implement some workaround to make it accept both ways.
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.
Most helpful comment
Hello! I was going into this with more details and it seems that packer is expecting the
iso_target_path
to contain the iso file as well, likeI tried this way it works.
Since the documentation and also the field name makes us understand that it's only the path, I will try to implement some workaround to make it accept both ways.