Medium "XXX" cannot be closed because it is still attached

Discussions related to using VirtualBox on Windows hosts.
Post Reply
TROJ
Posts: 4
Joined: 20. Oct 2014, 15:51

Medium "XXX" cannot be closed because it is still attached

Post by TROJ »

Error Message:

Failed to open virtual machine located in D:/Users/.../Win2k12_SQL08R2_BIG.vbox.

Medium 'C:\Users\...\Win2k12_SQL08R2_BIG.vdi' cannot be closed because it is still attached to 1 virtual machines.

Result Code: VBOX_E_OBJECT_IN_USE (0x80BB000C)
Component: Medium
Interface: IMedium {05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac}
Callee: IVirtualBox {fafa4e17-1ee2-4905-a10e-fe7c18bf5554}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)


I had my system crash, and this VM was open and running. I had to reinstall everything on my PC. I restored the VDI file and I now need to either ...Create a new VM with this image... Or, fix the existing VM by adding it back in.

I keep getting the error above and cannot get past this message.

Any thoughts?

Thanks,

~ terry o.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Medium "XXX" cannot be closed because it is still attach

Post by mpack »

The error means that you have this VDI attached to more than one VM, one of which is still running (suspended counts as still running).
TROJ
Posts: 4
Joined: 20. Oct 2014, 15:51

Re: Medium "XXX" cannot be closed because it is still attach

Post by TROJ »

Thanks... but how do I clear that count?

I had to reinstall everything, including VirtualBox. And I need to get access to the VDI and reboot that machine.

Any thoughts?

Thanks.

~ t.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Medium "XXX" cannot be closed because it is still attach

Post by mpack »

Does the contents of Word documents change when you reinstall Office? You would hope not. Likewise the configuration of VMs is not affected by reinstalling VBox. So, you should discount any thought that reinstalling the software would repair this.

You need to find out which other VM is using that disk, and make it not use it, by shutting down the VM or simply discarding the saved state. Only registered VMs need to be considered.
TROJ
Posts: 4
Joined: 20. Oct 2014, 15:51

Re: Medium "XXX" cannot be closed because it is still attach

Post by TROJ »

mpack wrote:Does the contents of Word documents change when you reinstall Office? You would hope not. Likewise the configuration of VMs is not affected by reinstalling VBox. So, you should discount any thought that reinstalling the software would repair this.

You need to find out which other VM is using that disk, and make it not use it, by shutting down the VM or simply discarding the saved state.
Great... where would I find the saved state?

In the ".VirtualBox" folder?... In the "Logs" folder?

Currently I don't have any VMs defined with this HD. I am trying to add the old one, or create a new one.

Hence my question... what do I need to remove to make this disk available for a new VM?

Thanks!

~ t.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Medium "XXX" cannot be closed because it is still attach

Post by mpack »

You don't need to find the saved state. Just right click VM in the GUI, choose "Discard saved state". Do it to all registered VMs.
TROJ
Posts: 4
Joined: 20. Oct 2014, 15:51

Re: Medium "XXX" cannot be closed because it is still attach

Post by TROJ »

mpack wrote:You don't need to find the saved state. Just right click VM in the GUI, choose "Discard saved state". Do it to all registered VMs.
This is what I am saying... I cannot add the VM into the VB Manager. It will not allow me to create a NEW machine and attach an existing disk. It will not allow me to ADD an existing machine. Therefore I am unable to select "Machine --> Discard Saved State".

But, I was finally able to attach the VDI to another VM. When I did, I performed a CHKDSK and then created a new VM with the original (fixed) VDI.
That seemed to fix my issue.

Thanks for the guidance... talking it through helped me determine the best solution.

~ terry o.
Karim
Posts: 2
Joined: 29. Aug 2015, 10:05

Re: Medium "XXX" cannot be closed because it is still attach

Post by Karim »

Hi

Iam also facing the same issue ,

When i trun on the vb all vms are in unknow state , i had removed it , and try to add the same vm firing error

Failed to open virtual machine located in D:/Virtual Box/wls3/wls3.vbox.

Medium 'D:\Virtual Box\wls3\wls3.vdi' cannot be closed because it is still attached to 1 virtual machines.

Result Code: VBOX_E_OBJECT_IN_USE (0x80BB000C)
Component: Medium
Interface: IMedium {05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac}
Callee: IVirtualBox {fafa4e17-1ee2-4905-a10e-fe7c18bf5554}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)

VBoxManage unregistervm addie_vm --delete
VBoxManage closemedium disk addie_vm.vdi


Try from cmd also , is there any force command to register or to close it
D:\Program Files\Oracle\VirtualBox>VBoxManage.exe registervm "D:\Virtual Box"\w
ls3\wls3.vbox
VBoxManage.exe: error: Medium 'D:\Virtual Box\wls3\wls3.vdi' cannot be closed be
cause it is still attached to 1 virtual machines
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), componen
t Medium, interface IMedium, callee IUnknown
VBoxManage.exe: error: Context: "OpenMachine(Bstr(a->argv[0]).raw(), machine.asO
utParam())" at line 88 of file VBoxManageMisc.cpp


Thanks
Karim
Posts: 2
Joined: 29. Aug 2015, 10:05

Re: Medium "XXX" cannot be closed because it is still attach

Post by Karim »

Hi


issue had resolved , all it happen due to the attached disk , open the .vobx file and remove the below lines,after added in virtual box again add the existing shared disk
</AttachedDevice>
</StorageController>
<StorageController name="SCSI" type="LsiLogic" PortCount="16" useHostIOCache="false" Bootable="true">
<AttachedDevice type="HardDisk" port="0" device="0">
<Image uuid="{bc1814cc-033f-4c5d-bfbd-1ffc7c739527}"/>
</AttachedDevice>
</StorageController>

Hope this will helps

Regards
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Medium "XXX" cannot be closed because it is still attach

Post by loukingjr »

FWIW, it's not the best idea to edit .vbox files. You should be able to open "VirtualBox Media Manager (Host+D)" and release the offending .vdi from the hard disk tab. Then re-add it to the guest.

Glad you got it fixed though.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
Post Reply