VirtualBox 4 equivalent of openmedium.

This is for discussing general topics about how to use VirtualBox.
Post Reply
rage
Posts: 6
Joined: 12. May 2011, 07:49
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 8.04, Ubuntu 10.04, Windows 2008/R2, Windows 7, Windows XP, Oracle Trusted Linux, CentOS 5

VirtualBox 4 equivalent of openmedium.

Post 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 :-)
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: VirtualBox 4 equivalent of openmedium.

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
rage
Posts: 6
Joined: 12. May 2011, 07:49
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 8.04, Ubuntu 10.04, Windows 2008/R2, Windows 7, Windows XP, Oracle Trusted Linux, CentOS 5

Re: VirtualBox 4 equivalent of openmedium.

Post 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.
rage
Posts: 6
Joined: 12. May 2011, 07:49
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 8.04, Ubuntu 10.04, Windows 2008/R2, Windows 7, Windows XP, Oracle Trusted Linux, CentOS 5

Re: VirtualBox 4 equivalent of openmedium.

Post 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.
Danny
Posts: 1
Joined: 19. Aug 2011, 01:55
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: WS, XP, Ubuntu

Re: VirtualBox 4 equivalent of openmedium.

Post 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
Post Reply