Repair Corrupt VirtualBox.xml

This is for discussing general topics about how to use VirtualBox.

Repair Corrupt VirtualBox.xml

Postby wbleonard » 29. Nov 2016, 20:36

Hi,

My VirtualBox machine file became corrupt. Unfortunately, I restarted VirtualBox before I could recover the previous version. I'm trying to rebuild it and this is the current error:

Error in D:\VirtualBox VMs\API_Platform_Beta_1\API_Platform_Beta_1.vbox (line 9) -- Required Machine/Hardware element is missing.
F:\tinderbox\win-5.0\src\VBox\Main\src-server\MachineImpl.cpp[740] (long __cdecl Machine::i_registeredInit(void)).
Result Code:
E_FAIL (0x80004005)
Component:
MachineWrap
Interface:
IMachine {f30138d4-e5ea-4b3a-8858-a059de4c93fd}

Is it possible to determine what element it missing?'

Here's my current file:
Code: Select all   Expand viewCollapse view
<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="" version="1.15-windows">
  <Machine uuid="{eb1f0700-4b81-4128-a859-ea124af95a48}" name="API_Platform_Beta_1" OSType="Oracle_64" currentSnapshot="{d29e5e03-d848-48ba-91a8-1b2a1a5d3930}" snapshotFolder="Snapshots" lastStateChange="2016-11-29T14:02:17Z">
    <MediaRegistry>
      <HardDisks>
        <HardDisk uuid="{94470af2-3cbe-4bd8-9f57-15859efc9d95}" location="APICS_Beta_1-disk1.vmdk" format="VMDK" type="Normal">
          <HardDisk uuid="{f0ebb646-d030-49bc-adc0-97ebf7fd0d6e}" location="Snapshots/{f0ebb646-d030-49bc-adc0-97ebf7fd0d6e}.vmdk" format="VMDK">
            <HardDisk uuid="{cf4970b5-340b-40ae-a9de-22a93eddb11e}" location="Snapshots/{cf4970b5-340b-40ae-a9de-22a93eddb11e}.vmdk" format="VMDK">
              <HardDisk uuid="{8da2e977-ad6a-428c-b0f2-6ef5561f185d}" location="Snapshots/{8da2e977-ad6a-428c-b0f2-6ef5561f185d}.vmdk" format="VMDK">
                <HardDisk uuid="{d91feeca-cd5b-4057-9a66-3101f6359491}" location="Snapshots/{d91feeca-cd5b-4057-9a66-3101f6359491}.vmdk" format="VMDK">
                  <HardDisk uuid="{64f93f90-be43-42b4-b77c-df9e93da9b88}" location="Snapshots/{64f93f90-be43-42b4-b77c-df9e93da9b88}.vmdk" format="VMDK">
                    <HardDisk uuid="{330a9e05-725e-46d4-83fb-9e945ff594c4}" location="Snapshots/{330a9e05-725e-46d4-83fb-9e945ff594c4}.vmdk" format="VMDK">
                      <HardDisk uuid="{af086f12-657c-46b3-9a59-a1a5d2479cf3}" location="Snapshots/{af086f12-657c-46b3-9a59-a1a5d2479cf3}.vmdk" format="VMDK">
                        <HardDisk uuid="{98399c67-1310-4858-8e48-83b79fa88492}" location="Snapshots/{98399c67-1310-4858-8e48-83b79fa88492}.vmdk" format="VMDK">
                          <HardDisk uuid="{09276191-5263-40c7-9a8e-e7b9f0bea174}" location="Snapshots/{09276191-5263-40c7-9a8e-e7b9f0bea174}.vmdk" format="VMDK">
                            <HardDisk uuid="{a0f1728e-50cf-4e97-892f-0d293772ae3f}" location="Snapshots/{a0f1728e-50cf-4e97-892f-0d293772ae3f}.vmdk" format="VMDK">
                              <HardDisk uuid="{eff392f8-4c74-49e1-bad6-1f69b489ad0c}" location="Snapshots/{eff392f8-4c74-49e1-bad6-1f69b489ad0c}.vmdk" format="VMDK">
                                <HardDisk uuid="{03ea2eed-9703-42a2-9193-e002503e385f}" location="Snapshots/{03ea2eed-9703-42a2-9193-e002503e385f}.vmdk" format="VMDK">
                                  <HardDisk uuid="{fd603280-8c41-426f-80e3-251450a0295f}" location="Snapshots/{fd603280-8c41-426f-80e3-251450a0295f}.vmdk" format="VMDK">
                                    <HardDisk uuid="{7591e28c-efb3-4845-aacb-e5e0f741553d}" location="Snapshots/{7591e28c-efb3-4845-aacb-e5e0f741553d}.vmdk" format="VMDK">
                                      <HardDisk uuid="{d73202d8-8132-4450-85ae-5551cd9b2070}" location="Snapshots/{d73202d8-8132-4450-85ae-5551cd9b2070}.vmdk" format="VMDK">
                                        <HardDisk uuid="{76a4d6b1-978f-4b06-a7db-bca8cce2e3b1}" location="Snapshots/{76a4d6b1-978f-4b06-a7db-bca8cce2e3b1}.vmdk" format="VMDK"/>
                                      </HardDisk>
                                    </HardDisk>
                                  </HardDisk>
                                </HardDisk>
                              </HardDisk>
                            </HardDisk>
                          </HardDisk>
                        </HardDisk>
                      </HardDisk>
                    </HardDisk>
                  </HardDisk>
                </HardDisk>
              </HardDisk>
            </HardDisk>
          </HardDisk>
        </HardDisk>
        <HardDisk uuid="{4a4a5b24-5d06-47ca-895a-2e766acca027}" location="APICS_Beta_1-disk2.vmdk" format="VMDK" type="Normal"></HardDisk>
      </HardDisks>
   </MediaRegistry>
  </Machine>
</VirtualBox>

Thanks,
Brian
Last edited by socratis on 29. Nov 2016, 21:10, edited 1 time in total.
Reason: Enclosed the information in [code] tag for better readability
wbleonard
 
Posts: 3
Joined: 29. Nov 2016, 20:29

Re: Repair Corrupt VirtualBox.xml

Postby socratis » 29. Nov 2016, 21:13

wbleonard wrote:I'm trying to rebuild it and this is the current error:

  • What exactly do you mean? You're trying to rebuild it by hand? By editing/creating the .VBOX file?
  • Is there anything else in that folder, like a ".VBOX-PREV" file or any temp files?
  • Did you manually discover the relationships between the snapshot files? If not, how?
  • Do you need all these snapshots?
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 12746
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Repair Corrupt VirtualBox.xml

Postby wbleonard » 30. Nov 2016, 23:53

Hi,

* Well, I would prefer to have the .vbox file automatically rebuilt if that's possible.

* The folder contains the following:
$ ls
API_Platform_Beta_1.vbox APICS_Beta_1-disk1.vmdk Logs/
API_Platform_Beta_1.vbox-prev APICS_Beta_1-disk2.vmdk Snapshots/

Unfortunately, the vbox-prev file I need was lost because I restarted VBox after seeing the error the 1st time.

* The file presented is what was left.

* I just need the latest snapshot.

Thanks,
Brian
wbleonard
 
Posts: 3
Joined: 29. Nov 2016, 20:29

Re: Repair Corrupt VirtualBox.xml

Postby mpack » 1. Dec 2016, 11:44

IMHO, attempts to reconstruct the old snapshot-infected VM is just wasting time. And there is no automated tool which can make up for the lack of a backup.

Put all the snapshot VMDKs in a folder, put the base VMDK in the same folder. Clone the most recent snapshot VMDM using CloneVDI. Build a new VM around the resulting (merged) VDI.
mpack
Site Moderator
 
Posts: 25501
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Repair Corrupt VirtualBox.xml

Postby socratis » 1. Dec 2016, 12:09

mpack wrote:And there is no automated tool which can make up for the lack of a backup.
I think you may have found an instance of something that there's no app for it! ;)

Actually I'm not replying just to reply, there is a valid question behind it. I know that VDIs provide UUIDs and parent UUIDs. So, if you wanted in theory you could reconstruct the .vbox. Tedious and error prone, but you could. In fact the chain of snapshots is what CloneVDI is using to reconstruct the current state, if I'm not mistaken.

Do VMDKs provide a similar "mechanism" for snapshots and chains of differencing hard disks? What about VHDs or the rest of the formats that VirtualBox supports? TIA.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 12746
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Repair Corrupt VirtualBox.xml

Postby mpack » 1. Dec 2016, 14:15

There's more to restoring a snapshot structure than just the chain of UUIDs for one drive, and, frankly, I don't see any benefit. It would be a good thing if the new VM had the same machine UUID as the original, otherwise you're better off just creating a new VM as I described.
mpack
Site Moderator
 
Posts: 25501
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

SOLVED

Postby Super Duper Strong » 21. Nov 2017, 08:13

Sorry for my poor English , I'm not a native English speaker.

I can't post URLs because I 'm a new user.So change the " dot " i used in the link to " . " before you visit the link !


Fixed this issue by adding the <Hardware> </Hardware> tag.
Let's see it in detail.

The version of my VirtualBox is 5.1.28 ,It's using .vbox file rather than a .xml file.So I just downloaded your attachment and renamed it to TEST.vbox .
This is what it showed me when adding this .vbox to VirtualBox.

[img]i.loli%20dot%20net/2017/11/21/5a13bc8c28565.png[/img]

As you described ,the error message showed :

Error in /home/TEST/TEST.vbox (line 9) -- Required Machine/Hardware element is missing.

Then I created a new VirtualMachine named "NEW",without adding a hard disk,and used a text editor to take a look at the .vbox file just created automatically with the new VM.

[img]i.loli%20dot%20net/2017/11/21/5a13bc564d341.png[/img]

[img]i.loli%20dor%20net/2017/11/21/5a13bc0c9d659.png[/img]


I compared this NEW.vbox file with the .vbox you uploaded ,and found that ,there's a tag <Hardware> </Hardware> missing in yours.

Content of my NEW.vbox


Code: Select all   Expand viewCollapse view
<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="virtualbox dot org/" version="1.16-linux">
  <Machine uuid="{ffffffff-ffff-ffff-ffff-fffffffffff2}" name="NEW" OSType="Gentoo" snapshotFolder="Snapshots" lastStateChange="20XX-XX-XXXXX:XX:XXX">
    <ExtraData>
      <ExtraDataItem name="GUI/FirstRun" value="yes"/>
    </ExtraData>
    <Hardware>
      <CPU>
        <PAE enabled="false"/>
        <LongMode enabled="false"/>
        <X2APIC enabled="true"/>
        <HardwareVirtExLargePages enabled="false"/>
      </CPU>
      <Memory RAMSize="1024"/>
      <HID Pointing="USBTablet"/>
      <Display VRAMSize="16"/>
      <USB>
        <Controllers>
          <Controller name="OHCI" type="OHCI"/>
          <Controller name="EHCI" type="EHCI"/>
        </Controllers>
      </USB>
      <Network>
        <Adapter slot="0" enabled="true" MACAddress="08002749077D" type="82540EM">
          <NAT/>
        </Adapter>
        <Adapter slot="1" type="82540EM"/>
        <Adapter slot="2" type="82540EM"/>
        <Adapter slot="3" type="82540EM"/>
        <Adapter slot="4" type="82540EM"/>
        <Adapter slot="5" type="82540EM"/>
        <Adapter slot="6" type="82540EM"/>
        <Adapter slot="7" type="82540EM"/>
      </Network>
      <AudioAdapter codec="AD1980" driver="Pulse" enabled="true"/>
      <RTC localOrUTC="UTC"/>
    </Hardware>
    <StorageControllers>
      <StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
        <AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
      </StorageController>
      <StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3"/>
    </StorageControllers>
  </Machine>
</VirtualBox>


So I copy-pasted this part to you .vbox file.

Code: Select all   Expand viewCollapse view
    <Hardware>
      <CPU>
        <PAE enabled="false"/>
        <LongMode enabled="false"/>
        <X2APIC enabled="true"/>
        <HardwareVirtExLargePages enabled="false"/>
      </CPU>
      <Memory RAMSize="1024"/>
      <HID Pointing="USBTablet"/>
      <Display VRAMSize="16"/>
      <USB>
        <Controllers>
          <Controller name="OHCI" type="OHCI"/>
          <Controller name="EHCI" type="EHCI"/>
        </Controllers>
      </USB>
      <Network>
        <Adapter slot="0" enabled="true" MACAddress="08002749077D" type="82540EM">
          <NAT/>
        </Adapter>
        <Adapter slot="1" type="82540EM"/>
        <Adapter slot="2" type="82540EM"/>
        <Adapter slot="3" type="82540EM"/>
        <Adapter slot="4" type="82540EM"/>
        <Adapter slot="5" type="82540EM"/>
        <Adapter slot="6" type="82540EM"/>
        <Adapter slot="7" type="82540EM"/>
      </Network>
      <AudioAdapter codec="AD1980" driver="Pulse" enabled="true"/>
      <RTC localOrUTC="UTC"/>
    </Hardware>



And somehow ,we can access the VM successfully now.

Your VM

[img]i.loli%20dot%20net/2017/11/21/5a13becff205f.png[/img]

But I don't have the corresponding .vmdk file,so it can not boot properly.

[img]i.loli%20dot%20net/2017/11/21/5a13bf606ec42.png[/img]


If you are using snapshots in the later versions of VirtualBox,You can fix this issue using this method I introduced , and then restore to your snapshots easily.

And of course ,you can use The VirtualBox Manager GUI to modify your VM's Hardware settings now.


By the way. I'm using VirtualBox 5.1.28.If you are using a different Version of VirtualBox , there could be some minor differences.

The attachment is the final .vbox file I'm using . You can download it if you want.


Hope this could be helpful.



Some links I found useful:
[1]losst.wordpress dot com/2011/04/07/how-to-repair-a-corrupted-virtualbox-xml-file/

[2] You can use this validator to help you find the tags that are missing . www dot w3schools dot com/xml/xml_validator.asp
Attachments
TEST-vbox-file.zip
Final vbox file
(1.61 KiB) Not downloaded yet
Super Duper Strong
 
Posts: 2
Joined: 21. Nov 2017, 06:55


Return to Using VirtualBox

Who is online

Users browsing this forum: No registered users and 12 guests