Page 1 of 1

VirtualBox 4 equivalent of openmedium.

Posted: 12. May 2011, 07:58
by rage
When attempting to registervm I receive this error.

Code: Select all

$ VBoxManage registervm /virtualmachines/Windows\ 7\ nfs\ test/Windows\ 7\ nfs\ test.vbox
VBoxManage: error: Could not find an open hard disk with UUID {42625a27-759b-41b2-bf6d-b3bc2d78d5c6}
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: "OpenMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 88 of file VBoxManageMisc.cpp
The machine is not registered at all as a result.

This disk it is refering to is located here:

Code: Select all

$ VBoxManage showhdinfo /virtualmachines/drives/Windows7.vdi 
UUID:                 42625a27-759b-41b2-bf6d-b3bc2d78d5c6
Accessible:           yes
Logical size:         20480 MBytes
Current size on disk: 8780 MBytes
Type:                 normal (base)
Storage format:       VDI
Format variant:       dynamic default
Location:             /virtualmachines/drives/Windows7.vdi
To fix this under VirtualBox 3.x I would have ran:

Code: Select all

$ VBoxManage openmedium /virtualmachines/drives/Windows7.vdi
What is the equivalent procedure for VirtualBox 4.x?

Thanks :-)

Re: VirtualBox 4 equivalent of openmedium.

Posted: 12. May 2011, 20:59
by Sasquatch
Well, if you have access to the GUI, you should be able to do it using Machine > Add from the main GUI. Else you have to either edit the file to include the VDI file, or remove it and add it later through the command line. The 'openmedium' option is no longer used because media isn't registered in the media manager like that. You have to use storageattach, but that only works on registered VMs, something you don't have yet, as that's what you want to accomplish. Troublesome, but solvable.

Re: VirtualBox 4 equivalent of openmedium.

Posted: 13. May 2011, 04:05
by rage
I'm trying to automate the registration of the new VM. Using the GUI is not a viable option.

My Googling and searching of the forums seem to confirm what you're saying. There is no good way to do what I want to do.

Re: VirtualBox 4 equivalent of openmedium.

Posted: 13. May 2011, 04:22
by rage
Failing a good way I must resort to a hacky way.

Code: Select all

$ VBoxManage registervm /virtualmachines/Windows\ 7\ nfs\ test/Windows\ 7\ nfs\ test.vbox
VBoxManage: error: Could not find an open hard disk with UUID {42625a27-759b-41b2-bf6d-b3bc2d78d5c6}
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: "OpenMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 88 of file VBoxManageMisc.cpp

$ VBoxManage list hdds

$ ~/VBoxManage-openmedium /virtualmachines/drives/Windows7.vdi
Virtual machine 'tempdiskattach0' is created.
UUID: b9451218-2153-46fb-a349-ec7b1d592135
Settings file: '/tmp/tempdiskattach0/tempdiskattach0.vbox'

$ VBoxManage list hdds
UUID:        42625a27-759b-41b2-bf6d-b3bc2d78d5c6
Parent UUID: base
Format:      VDI
Location:    /virtualmachines/drives/Windows7.vdi
State:       created
Type:        normal

$ VBoxManage registervm /virtualmachines/Windows\ 7\ nfs\ test/Windows\ 7\ nfs\ test.vbox

$ VBoxManage list vms
"Windows 7 nfs test" {d870b36e-4d92-47da-8d47-1862e78e1767}
Inside VBoxManage-openmedium

Code: Select all

#!/bin/bash
[[ -n "$1" ]] || (echo "Usage $0 <filename>"; exit 2)
[[ -e "$1" ]] || (echo "File not found: $1"; exit 2)

VBoxManage createvm --name tempdiskattach0 --basefolder /tmp
VBoxManage registervm /tmp/tempdiskattach0/tempdiskattach0.vbox
VBoxManage storagectl tempdiskattach0 --add ide --name "IDE"
VBoxManage storageattach tempdiskattach0 --storagectl "IDE" --port 0 --device 0 --type hdd --medium "$1"
VBoxManage unregistervm tempdiskattach0
rm -rf /tmp/tempdiskattach0/tempdiskattach0.vbox
I would love for the openmedium command to come back in a future release, this solution is less than ideal. Hopefully if anyone else encounters this problem it will give them a some semblance of a solution.

Re: VirtualBox 4 equivalent of openmedium.

Posted: 19. Aug 2011, 02:01
by Danny
I was writing a "for" loop to do this on my Windows host when I realized I could drag and drop the VDI files into the Virtual Disk Manager window (OLE). Then hitting refresh on each VM picks up the VDIs