Error when using vboxmanage storageattach?

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
N00bie
Posts: 13
Joined: 8. Jul 2014, 17:00

Error when using vboxmanage storageattach?

Post by N00bie »

This command runs fine:

Code: Select all

vboxmanage storageattach testvm --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "~/VirtualBox VMs/testvm/testvm-disk01.vdi" 
However, when I try running this command:

Code: Select all

vboxmanage storageattach testvm --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "~/VirtualBox VMs/ubuntu-14.04.3-server-amd64.iso"
The following is output:
VBoxManage: error: Could not find file for the medium '/Users/nate/~/VirtualBox VMs/ubuntu-14.04.3-server-amd64.iso' (VERR_FILE_NOT_FOUND)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp
VBoxManage: error: Invalid UUID or filename "~/VirtualBox VMs/ubuntu-14.04.3-server-amd64.iso"v
Why isn't the second command working?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Error when using vboxmanage storageattach?

Post by mpack »

Well, "file not found" says that the file doesn't exist, or you got the name wrong. You don't mention having checked?

I'm not familiar with OS X path conventions: what does "~" mean? If it's some kind of relative path designation then I'd avoid that. If the file is inside the VM folder you can omit the path I believe. Otherwise I would try a complete and unambiguous path.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: Error when using vboxmanage storageattach?

Post by loukingjr »

As mpack surmised, in Linux/Unix, "~" is a shortcut meaning user directory. Should use the full path.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
N00bie
Posts: 13
Joined: 8. Jul 2014, 17:00

Re: Error when using vboxmanage storageattach?

Post by N00bie »

loukingjr wrote:As mpack surmised, in Linux/Unix, "~" is a shortcut meaning user directory. Should use the full path.
Hmm... Okay. Why wouldn't '~' work? Why does it work for the first command but not the second?

In any case, I changed it, and it worked!

Thanks!
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: Error when using vboxmanage storageattach?

Post by loukingjr »

apparently some commands will use tilde expansion, some do not. I have no idea why. :D

you're welcome.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Error when using vboxmanage storageattach?

Post by mpack »

It's because VirtualBox does its own path management, which makes paths behave the same across all platforms - but you have to adhere to the rules I already mentioned.
Post Reply