Problems with path passed to VBoxManage from Packer using WSL.

49 views
Skip to first unread message

def

unread,
Jun 24, 2019, 5:54:53 PM6/24/19
to Packer
Windows: 10
WSL: Ubuntu 18.04
Packer: 1.4.1
VBox: 6.0.8

Running from Packer from WSL, my Packer fails trying to use VBox because the path is formed incorrectly by packer(?).
e.g.

My data is on my Windows drive E:\projects\tpa\packer.
Of course in WSL this is /mnt/e/projects/tpa/packer
But Packer sends the following to VBoxManage E:\mnt\e\projects\tpa\packer
e.g.

==> virtualbox-iso: Creating hard drive...
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stderr:
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 Executing VBoxManage: []string{"createhd", "--filename", "output-virtualbox-iso/packer-ubuntu-18.04-amd64.vdi", "--size", "40000", "--format", "VDI", "--variant", "Standard"}
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stdout: Medium created. UUID: dc435d75-7368-4a3b-8071-20a14766f2d9
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 Executing VBoxManage: []string{"storagectl", "packer-ubuntu-18.04-amd64", "--name", "IDE Controller", "--add", "ide"}
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stdout:
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stderr:
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 Executing VBoxManage: []string{"storageattach", "packer-ubuntu-18.04-amd64", "--storagectl", "IDE Controller", "--port", "0", "--device", "0", "--type", "hdd", "--medium", "output-virtualbox-iso/packer-ubuntu-18.04-amd64.vdi", "--nonrotational", "off", "--discard", "off"}
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stdout:
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stderr:
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 Executing VBoxManage: []string{"storageattach", "packer-ubuntu-18.04-amd64", "--storagectl", "IDE Controller", "--port", "0", "--device", "1", "--type", "dvddrive", "--medium", "/mnt/e/projects/tpa/packer/iso/ubuntu-18.04.2-live-server-amd64.iso"}
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stdout:
2019/06/24 22:43:15 packer: 2019/06/24 22:43:15 stderr: VBoxManage.exe: error: Could not get the storage format of the medium 'E:\mnt\e\projects\tpa\packer\iso\ubuntu-18.04.2-live-server-amd64.iso' (VERR_UNRESOLVED_ERROR)
==> virtualbox-iso: Error attaching ISO: VBoxManage error: VBoxManage.exe: error: Could not get the storage format of the medium 'E:\mnt\e\projects\tpa\packer\iso\ubuntu-18.04.2-live-server-amd64.iso' (VERR_UNRESOLVED_ERROR)
2019/06/24 22:43:15 packer: VBoxManage.exe: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component MediumWrap, interface IMedium, callee IUnknown
==> virtualbox-iso: VBoxManage.exe: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component MediumWrap, interface IMedium, callee IUnknown
2019/06/24 22:43:15 packer: VBoxManage.exe: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 191 of file VBoxManageDisk.cpp
==> virtualbox-iso: VBoxManage.exe: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 191 of file VBoxManageDisk.cpp
2019/06/24 22:43:15 packer: VBoxManage.exe: error: Invalid UUID or filename "/mnt/e/projects/tpa/packer/iso/ubuntu-18.04.2-live-server-amd64.iso"
==> virtualbox-iso: VBoxManage.exe: error: Invalid UUID or filename "/mnt/e/projects/tpa/packer/iso/ubuntu-18.04.2-live-server-amd64.iso"
2019/06/24 22:43:15 ui error: ==> virtualbox-iso: Error attaching ISO: VBoxManage error: VBoxManage.exe: error: Could not get the storage format of the medium 'E:\mnt\e\projects\tpa\packer\iso\ubuntu-18.04.2-live-server-amd64.iso' (VERR_UNRESOLVED_ERROR)
==> virtualbox-iso: Deregistering and deleting VM...

It need not prepend the E:\ or more correctly I guess removes the \mnt\e.

I have tried a windows shortcut and WSL symbolic link but no joy. Any recommendations?

My Template:

    "builders": [
       
{
           
"type": "virtualbox-iso",
           
"boot_command": [
           
"",
           
"",
           
"",
           
"/install/vmlinuz",
           
" auto",
           
" console-setup/ask_detect=false",
           
" console-setup/layoutcode=us",
           
" console-setup/modelcode=pc105",
           
" debconf/frontend=noninteractive",
           
" debian-installer=en_US",
           
" fb=false",
           
" initrd=/install/initrd.gz",
           
" kbd-chooser/method=us",
           
" keyboard-configuration/layout=USA",
           
" keyboard-configuration/variant=USA",
           
" locale=en_US",
           
" netcfg/get_domain=vm",
           
" netcfg/get_hostname=vagrant",
           
" grub-installer/bootdev=/dev/sda",
           
" noapic",
           
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
           
" -- ",
           
""
           
],
           
"boot_wait": "10s",
           
"disk_size": 40000,
           
"guest_os_type": "Ubuntu_64",
           
"headless": false,
           
"http_directory": "http",
           
"iso_urls": [
           
"iso/ubuntu-18.04.2-live-server-amd64.iso"
           
],
           
"iso_checksum_type": "sha256",
           
"iso_checksum": "ea6ccb5b57813908c006f42f7ac8eaa4fc603883a2d07876cf9ed74610ba2f53",
           
"ssh_username": "vagrant",
           
"ssh_password": "vagrant",
           
"ssh_port": 22,
           
"ssh_wait_timeout": "10000s",
           
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
           
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
           
"virtualbox_version_file": ".vbox_version",
           
"guest_additions_url": "iso/VBoxGuestAdditions_{{.Version}}.iso",
           
"vm_name": "packer-ubuntu-18.04-amd64",
           
"vboxmanage": [
           
[
               
"modifyvm",
               
"{{.Name}}",
               
"--memory",
               
"2048"
           
],
           
[
               
"modifyvm",
               
"{{.Name}}",
               
"--cpus",
               
"1"
           
]
           
]
       
}
   
],
   
"provisioners": [{
     
"type": "shell",
     
"scripts": [
       
"scripts/init.sh",
       
"scripts/cleanup.sh"
     
]
   
}],
   
"post-processors": [{
     
"type": "vagrant",
     
"compression_level": "8",
     
"output": "ubuntu-18.04-{{.Provider}}.box"
   
}]
 
}



deanwarrenuk

unread,
Jun 26, 2019, 4:30:29 PM6/26/19
to Packer
any one?

Megan Marsh

unread,
Jun 27, 2019, 12:02:34 PM6/27/19
to packe...@googlegroups.com
This sounds like a bug; can you open an issue in https://github.com/hashicorp/packer/issues?  I can't promise I'll get to it myself terribly soon, but maybe another community member can take a stab at the pathing. The way we've solved WSL pathing issues in the past is by having users tell the shell local provisioner explicitly to use linux pathing... perhaps we need a global config variable or an environment variable to do the same.
Reply all
Reply to author
Forward
0 new messages