Failed to Open Virtual Machine - Medium Cannot be Closed

Discussions related to using VirtualBox on Windows hosts.

Failed to Open Virtual Machine - Medium Cannot be Closed

Postby AntonyReynolds » 17. May 2011, 20:40

I just moved to a new machine and tried to add an existing VirtualBox. I got the following error.
Failed to open virtual machine located in
D:/VirtualMachines/OEL6-x64/OEL6-x64.vbox.

Medium 'D:\VirtualMachines\OEL6-x64\OEL6-
x64.vdi' cannot be closed because it is still attached to 1
virtual machines.

The Details box contains:
Result Code:
VBOX_E_OBJECT_IN_USE (0x80BB000C)
Component:
Medium
Interface:
IMedium {9edda847-1279-4b0a-9af7-9d66251ccc18}
Callee:
IVirtualBox {d2de270c-1d4b-4c9e-843f-bbb9b47269ff}
Callee RC:
E_INVALIDARG (0x80070057)


This is VirtualBox 4.0.8. Image was created under 4.0.6 but I tested it on 4.0.8 before moving it to the new machine.
AntonyReynolds
 
Posts: 8
Joined: 17. May 2011, 18:18
Primary OS: Linux other
VBox Version: OSE Fedora
Guest OSses: Linux, Windows

Re: Failed to Open Virtual Machine - Medium Cannot be Closed

Postby AntonyReynolds » 18. May 2011, 00:45

After raising this I discovered a similar thread - Using VB image/settings from Windows host on Linux host
Follow that thread if you are interested in this issue.
AntonyReynolds
 
Posts: 8
Joined: 17. May 2011, 18:18
Primary OS: Linux other
VBox Version: OSE Fedora
Guest OSses: Linux, Windows

Re: Failed to Open Virtual Machine - Medium Cannot be Closed

Postby admin@dwaves.de » 7. May 2013, 19:30

Hello AntonyReynolds,

THIS IS CLEARLY A BUG OF VIRTUALBOX!

BECAUSE YOUR HARDDISK IS NOT REALLY OPENED BY ANY VIRTUALBOX INSTANCE.

my error was a result, of having multiple instances of the virtualbox manager open… i closed them all.

then double clicked the *.vbox file… then the damn thing imported without complains.


another idea: is there a vboxmanage / vdiclone command that allows you to clone a harddisk WITH the latest snapshot into one single vdi? (Vmdk are EVIL!)

if yes... then you could clone your vdi+snapshots -> single-vdi, import single-vdi via media-manager, create a new VM from scratch, attach single-vdi and be good 2 go.

the virtualbox guys were initially from germany…. they provide a technical quiet solid product (nothing is perfect), but it's hard to handle such copy processes, especially with 1000x snapshots, in comparison to parallels e.g…. i hope they will improve on this in the future.

some people here are not very helpful.

we should fight to help each other and make this world a better place not post "you are stupid" answers. this is a arrogance and social incompetence will lead mankind to extiction. (the easter islanders consumed all their resources for taller and taller status-symbols… and then died out)

i had the same error as you.

i know how hard it is to copy a virtualbox vm from one machine to another.

as a fist-rule: always clone your vms, before copying them.

i had to restore a backup
1. removed the existing VM (kept the files, moved to another dir)
2. copied a VM from a acronis-backup to the default VirtualBox directoy
3. double clicked .vbox file -> error

first i got
Konnte die virtuelle Maschine in C:/Users/Sigel/VirtualBox VMs/AGENDA/AGENDA.vbox nicht öffnen.

Hard disk 'C:\Users\Sigel\VirtualBox VMs\AGENDA\Snapshots/{19e71f06-e28a-45a4-837f-4ac80f0816a1}.vhd' with UUID {19e71f06-e28a-45a4-837f-4ac80f0816a1} cannot be directly attached to the virtual machine 'AGENDA' ('C:\Users\Sigel\VirtualBox VMs\AGENDA\AGENDA.vbox') because it has 1 differencing child hard disks.

fixed this by using the media manager and removing all snapshots and then the associated harddiskfile. (just remove from list, not delete)

then i got

Konnte die virtuelle Maschine in C:/Users/Sigel/VirtualBox VMs/AGENDA/AGENDA.vbox nicht öffnen.

Medium 'C:\Users\Sigel\VirtualBox VMs\AGENDA\AGENDA.vmdk' cannot be closed because it is still attached to 1 virtual machines.

Fehlercode:VBOX_E_OBJECT_IN_USE (0x80BB000C)
Komponente:Medium
Interface:IMedium {53f9cc0c-e0fd-40a5-a404-a7a5272082cd}
Callee:IVirtualBox {c28be65f-1a8f-43b4-81f1-eb60cb516e66}
Callee RC:E_FAIL (0x80004005)

which i fixed with the fix in red colors.

hope this helps somewhat.
admin@dwaves.de
 
Posts: 2
Joined: 7. May 2013, 19:28

Re: Failed to Open Virtual Machine - Medium Cannot be Closed

Postby Andy Southwell » 7. Jan 2015, 10:42

Hi,

I just came across the same error, too, after copying the files for a VirtualBox machine from a Windows host to a Linux one. The solution for me was simply to ask VirtualBox to create a fresh, new machine, but to use the existing vdi image I had copied over from the old machine (you can always use the old xml file as a reference, looking at settings in an editor, such as the MAC address etc, if you need to).

I am not sure whether or not I had any snapshots saved for the old VM, or whether this would have affected whether this solution would have worked: all I have now is the hard drive from the old Windows host, which has now gone to the land of bug-free code..

Oh...one more thing... the guest VM I moved was a Linux one. If it had been Windows, I'd imagine I'd have had much more trouble, given windows is much more sensitive to HW changing around..YMMV.

HTH anyway.
Andy
Andy Southwell
 
Posts: 1
Joined: 7. Jan 2015, 10:34

Re: Failed to Open Virtual Machine - Medium Cannot be Closed

Postby George B » 24. Mar 2016, 10:31

Hi,
I had the same issue after having changed the .vdi virtual disk's uuid (using vboxmanage internalcommands sethduuid). Consequently then I had to update the .vbox config file.
The message "Medium Cannot be Closed" was caused by me pasting the same uuid for both hard disks in the configuration. So when loading the hard drives, vbox tried to open the same .vdi file twice, thus causing the error.
My configuration looked like this:
Code: Select all   Expand viewCollapse view
  <AttachedDevice type="HardDisk" hotpluggable="true" port="1" device="0">
          <Image uuid="{5ff480fe-f34d-4f10-b438-94b7e7683305}"/>
        </AttachedDevice>
        <AttachedDevice type="HardDisk" hotpluggable="true" port="0" device="0">
          <Image uuid="{5ff480fe-f34d-4f10-b438-94b7e7683305}"/>
  </AttachedDevice>

..instead of having the two (different) vdi uuids referenced.
Hope that helps to someone else too, who got carried away with find and replace :)
Cheers,
Georgi
George B
 
Posts: 1
Joined: 24. Mar 2016, 10:06

Re: Failed to Open Virtual Machine - Medium Cannot be Closed

Postby Ali Saglam » 20. Oct 2016, 22:43

It's not problem. Cancel the error window. This process created a file such as "...-disk2.vmdk" in the director "C:\Users\'user name'\VirtualBox VMs\Ubuntu 14.04.3_".

1- Open the virtual box programme.
2- New
3- Set a machine name, next
4- Set memory size, next
5- Select "use available visrtual disk file...", and select the file stated above such as "... -disk2.vmdk" , create

That is all. Anymore, you can use your virtual machine..
Ali Saglam
 
Posts: 2
Joined: 20. Oct 2016, 22:33

Re: Failed to Open Virtual Machine - Medium Cannot be Closed

Postby admin@dwaves.de » 31. Oct 2016, 23:03

Btw. i would recommend TO ONLY USE THE DEFAULT HARDDISK FORMAT OF VIRTUALBOX which is *.vdi

It seems like it is not 100% compatible with reading and writing *.vmdk (VMWare) Harddisk Files.

So if this is not just for testing, but a critical machine with critical data, better clone it to a *.vdi before using it everyday.

but besides this... virtualbox is very cool software :)

keep it up :)
admin@dwaves.de
 
Posts: 2
Joined: 7. May 2013, 19:28

Re: Failed to Open Virtual Machine - Medium Cannot be Closed

Postby iamaro80 » 7. Nov 2016, 22:15

I resolved this issue by doing the following:
1. open virtual media manager from the file menu context or use the shortcut CTLR +D
2. select the optical disks tab
3. release the VBoxGuestAdditions.iso or any other *.iso images
4. once the iso image is released, click on remove icon to remove the iso.
5. close the virtual media manager and add your machine from the machine menu >> Add

the machine is added successfully :D
iamaro80
 
Posts: 1
Joined: 7. Nov 2016, 22:09

Re: Failed to Open Virtual Machine - Medium Cannot be Closed

Postby AdityaM » 23. Nov 2016, 10:46

Hello,
I am also getting the same error "Medium cannot be closed because it is still attached to 1 virtual machines"..I am also using a VMDK file to clone the machine. I am not able to figure out how to handle this situation programatically.
But one that (work around) that I do is -
--> Open task Manager
--> Kill the process VBoxSVC.exe
--> Retry to clone

After following these steps I am able to clone the machine.
Also if I save the handle after first time so that I can reuse the handle later on, it solves the problem to some extent. But if I close the virtual machine, I lose the handle and I am back to my issue. Any suggestions or comments to solve this.
Thanks
AdityaM
 
Posts: 8
Joined: 8. Nov 2016, 06:12


Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: No registered users and 26 guests