How-To: Resolve Attached Media Conflicts in VirtualBox
Here's another corker of an error in Oracle VirtualBox. First, you think your virtual machine is broken. Second you wonder how your storage tree got messed up.
When you move Virtual machine files around, revert machine Snapshots and update attached strage, you can get something like this:
Failed to open virtual machine located in /vm_data/machines/Quetzal-VM/Quetzal-VM.vbox.
Cannot register the DVD image '/usr/share/virtualbox/VBoxGuestAdditions.iso' {20f4b244-eb29-4082-ac34-4acf6ccb4904} because a CD/DVD image '/usr/share/virtualbox/VBoxGuestAdditions.iso' with UUID {62ebaac7-ba6d-4d7d-876b-362642de4c1b} already exists.
Result Code: NS_ERROR_INVALID_ARG (0x80070057)
Component: VirtualBox
Interface: IVirtualBox {3b2f08eb-b810-4715-bee0-bb06b9880ad2}
Which all looks a bit scary. It isn't.
While upgrading VirtualBox to 4.2, it had properly updated the .iso image of Guest Additions. Firing up a virtual machine last used under 4.1, with the 4.1 Guest Additions attached under the media tree, it then rightly complains about the conflict; two .iso's, same name, different disk ID's. VirtualBox does a double-take at this sleight of hand.
The answer? Close the VM. First make sure the guest is shut down (not saved state).Open the Preferences, go to Media Manager. See if you can release and remove the old VBoxGuestAdditions.iso from there.
If that doesn't work, you need to edit a bit of XML. Again, make sure the guest is shut down (not saved state) and the VirtualBox program itself is not running. In the VM's folder is the settings file for that VM a .vbox. You need to look for the VM by name in your designated machines folder. If the guest was created with version 4.0 or later, the file will be located in your home folder under VirtualBox VMs then the name of the guest, or wherever you specified in Preferences if you changed it. Make a backup of this file somewhere safe before you start editing.
In the .vbox file, you'll be looking for the attached media section, something like:
<DVDImages>
<Image uuid="{0fe1ba24-f623-405c-a7a9-8c157c9b0520}" location="/usr/share/virtualbox/VBoxGuestAdditions.iso"/>
</DVDImages>
Then edit the file and remove the line containing the offending image and UUID, leaving the opening and closing section tags <DVDImages> and </DVDImages> tags in place. In my case, editing from this:
<DVDImages>
<Image uuid="{20f4b244-eb29-4082-ac34-4acf6ccb4904}" location="/usr/share/virtualbox/VBoxGuestAdditions.iso"/>
<Image uuid="{4cac70c8-689d-4e2c-8b2f-4e4b21c2cdcd}" location="/vm_data/machines/software/iso/quantal-desktop-i386.iso"/>
</DVDImages>
to this:
<DVDImages>
</DVDImages>
Save the file. You should then be able to start the Guest VM and attach any media the normal way. RC
When you move Virtual machine files around, revert machine Snapshots and update attached strage, you can get something like this:
Failed to open virtual machine located in /vm_data/machines/Quetzal-VM/Quetzal-VM.vbox.
Cannot register the DVD image '/usr/share/virtualbox/VBoxGuestAdditions.iso' {20f4b244-eb29-4082-ac34-4acf6ccb4904} because a CD/DVD image '/usr/share/virtualbox/VBoxGuestAdditions.iso' with UUID {62ebaac7-ba6d-4d7d-876b-362642de4c1b} already exists.
Result Code: NS_ERROR_INVALID_ARG (0x80070057)
Component: VirtualBox
Interface: IVirtualBox {3b2f08eb-b810-4715-bee0-bb06b9880ad2}
Which all looks a bit scary. It isn't.
While upgrading VirtualBox to 4.2, it had properly updated the .iso image of Guest Additions. Firing up a virtual machine last used under 4.1, with the 4.1 Guest Additions attached under the media tree, it then rightly complains about the conflict; two .iso's, same name, different disk ID's. VirtualBox does a double-take at this sleight of hand.
The answer? Close the VM. First make sure the guest is shut down (not saved state).Open the Preferences, go to Media Manager. See if you can release and remove the old VBoxGuestAdditions.iso from there.
If that doesn't work, you need to edit a bit of XML. Again, make sure the guest is shut down (not saved state) and the VirtualBox program itself is not running. In the VM's folder is the settings file for that VM a .vbox. You need to look for the VM by name in your designated machines folder. If the guest was created with version 4.0 or later, the file will be located in your home folder under VirtualBox VMs then the name of the guest, or wherever you specified in Preferences if you changed it. Make a backup of this file somewhere safe before you start editing.
In the .vbox file, you'll be looking for the attached media section, something like:
<DVDImages>
<Image uuid="{0fe1ba24-f623-405c-a7a9-8c157c9b0520}" location="/usr/share/virtualbox/VBoxGuestAdditions.iso"/>
</DVDImages>
Then edit the file and remove the line containing the offending image and UUID, leaving the opening and closing section tags <DVDImages> and </DVDImages> tags in place. In my case, editing from this:
<DVDImages>
<Image uuid="{20f4b244-eb29-4082-ac34-4acf6ccb4904}" location="/usr/share/virtualbox/VBoxGuestAdditions.iso"/>
<Image uuid="{4cac70c8-689d-4e2c-8b2f-4e4b21c2cdcd}" location="/vm_data/machines/software/iso/quantal-desktop-i386.iso"/>
</DVDImages>
to this:
<DVDImages>
</DVDImages>
Save the file. You should then be able to start the Guest VM and attach any media the normal way. RC
Thank you, worked well for me under OpenSuse 12.2
ReplyDeleteGreat tip. This helped me out no end!
ReplyDeleteThanks again.
Steve
ThankQ
ReplyDeleteAwesome it worked ..
ReplyDeleteThank you ...
..that helped me a lot. I tried a couple of days before without luck. Thank you :-))
ReplyDeleteThank you. It worked.
ReplyDeleteThanks. It helped.
ReplyDeleteThank you a lot! :)
ReplyDeleteThank you!
ReplyDeleteBest answer...
ReplyDeletethankss
You. You. Yes. Thank you.
ReplyDeleteThanks so much!
ReplyDeleteGreat!, thank you very much!
ReplyDeleteAwesome!
ReplyDeleteI frequently reload my system and this allows me to double-click the vbox file to add it back to the VirtualBox console.
Thanks!
You saved my day! Was googling the solution for quite some time...
ReplyDeleteGreat tip, but one thing to note...I kept on getting a pop-up box to say that it couldn't mount the guest additions and asking if you wanted to force a mount, then bizarrely offering an unmounts button. After some investigation I found out that this message box meant that guest additions iso WAS ALREADY mounted, so the message box could actually be ignored.
ReplyDeleteThanks!
ReplyDeleteAlso useful to note that if you're simply in need of an immediate solution (and aren't too caught up on the vm configuration), just build a new machine and mount the old VDI...
ReplyDeleteAnon: that's also true. A bog-standard VM configuration is often quicker to recreate and re-use the disk image.
ReplyDeleteThakssssssssssssss
ReplyDeletei worked fine!.. thnks a lot!!!
ReplyDelete"First make sure the guest is shut down (not saved state)"
ReplyDeleteIf I can't load the VM (ie. it's already in saved state) how can I shut it down?
You saved me a day of work :)
ReplyDeleteMe, I'm getting:
ReplyDeleteResult Code: E_INVALIDARG (0x80070057)
Component: VirtualBox
Interface: IVirtualBox {fafa4e17-1ee2-4905-a10e-fe7c18bf5554}
.. but, IDK - whether it's because I'd updated teh Oracle VM and/or whether it's because both, the new won and the old image that I had - are both of the same (exact) name, meh.
(Tryin' 2 figure it out, ATM, but it's just a headache. :))
Err, can't edit my previous comment: "Your comment will be visible after approval."
ReplyDelete^^ By "both", I meant my old Xubuntu virtual machine and a new one that I created.. Since there's an update, of Ubuntu, just released. =)
Nostromov: yep, I understood; duplicate names of anything in VBox give it headaches, so no surprise. You have to de-register old instances before you can re-use a name.
ReplyDeleteTop tips when doing any config changes; always update VBox, matching extensions and Guest Additions before you start changing things in Media Manager. Make sure VM's are shut down and not paused or suspended.
I had a similar problem and editing the .vbox xml was the solution! Thanks
ReplyDeleteThis worked great for me. Thanks!
ReplyDeleteEditing the xml was the only thing that worked for me. I tried "VBoxManage closemedium something something" following other instructions, and all it would do is complain at me. Removing the duplicate guest additions iso in the xml (which was there because I was following Oracle's goofy instructions on how to update my GA!) solved the problem. Thanks!
ReplyDeleteSo many thanks!!!
ReplyDeletethank you very much
ReplyDeleteThanks!
ReplyDeleteThank you very much. You saved a couple of machines that didn't work, one of them with a vintage Windows98. Easy and useful tip.
ReplyDeleteThx for that really good hint...you saved my life :)
ReplyDeleteProbably you´ll have to delete another lines at the end of the file. Like I have to do.
ReplyDeleteI have to delete all lines between "AttachedDevice" that have reference to the DVD. See more above:
Me too - thanks a ton!
ReplyDeleteThanks, really works!
ReplyDeleteIt works! I spent half a day looking for the answer to this. Thanks loads
ReplyDelete