packer-plugin-virtualbox
packer-plugin-virtualbox copied to clipboard
Error when using .VHD as boot device
Overview of the Issue
When using a .vhd as the iso_url
(as stated possible in the documentation, VirtualBox returns the error Error attaching ISO: VBoxManage error: VBoxManage.exe: error: The medium '<path/to/vhd>' can't be used as the requested device type (DVD, detected HDD)
.
Reproduction Steps
Put a .VHD file locaiton as the iso_url
and run packer.
Plugin and Packer version
From packer version
:
Packer v1.10.0
From packer plugins installed
:
C:\Users\<Username>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\ansible\packer-plugin-ansible_v1.1.0_x5.0_windows_amd64.exe
C:\Users\<Username>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\hyperv\packer-plugin-hyperv_v1.1.2_x5.0_windows_amd64.exe
C:\Users\<Username>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe
C:\Users\<Username>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\virtualbox\packer-plugin-virtualbox_v1.0.5_x5.0_windows_amd64.exe
C:\Users\<Username>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vmware\packer-plugin-vmware_v1.0.11_x5.0_windows_amd64.exe
Simplified Packer Buildfile
source "virtualbox-iso" "virtualbox" {
boot_command = ["a<wait>a<wait>a"]
boot_wait = "-1s"
cd_files = ["./installers"]
cpus = "4"
disk_size = "50000"
headless = "true"
iso_checksum = "none"
iso_url = "$<path/to/vhd>"
memory = "4096"
output_directory = "./output"
shutdown_command = "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\""
guest_os_type = "Windows10_64"
vm_name = "${var.vm_name}"
}
build {
sources = ["source.hyperv-iso.hyperv", "source.virtualbox-iso.virtualbox", "source.vmware-iso.vmware"]
provisioner "breakpoint" {
name = "debug"
}
}
Operating system and Environment details
Windows 10 amd64, running from Powershell.
Log Fragments and crash.log files
Link to Packer log gist
Note
When using VirtualBox GUI, I can put the .vhd as a hard drive and run my VM normally, I just don't understand how to do the same with packer.