Page 1 of 1

How to fix my VirtualBox.xml file?

Posted: 25. Jul 2011, 05:38
by jguerrero
Hi Everyone,

In 4.0.12 on MacOSX 10.6.8, I was restoring a snapshot, when VBoxSVC died and left my VM "inaccessible".

Digging in, I found that vbox had created 5 new files in the machine's Snapshot directory, which all matched the UUIDs at the bottom of the machine's xml file. One of these matched the UUID listed in the error message. However, these 5 UUIDs do not exist in VirtualBox.xml.

Is there any documentation that describes how to fix the xml file to recognize these 5 UUIDs?

I found this enhancement request, but have not seen anything that can directly help:
http://www.virtualbox.org/ticket/3351

FWIW, here is the stack trace where VBoxSVC crashed:

Code: Select all

Thread 12 Crashed:
0   VBoxSVC                       	0x000d9a3b std::list<ComObjPtr<MediumAttachment>, std::allocator<ComObjPtr<MediumAttachment> > >::remove(ComObjPtr<MediumAttachment> const&) + 11
1   VBoxSVC                       	0x0013810c SessionMachine::restoreSnapshotHandler(SessionMachine::RestoreSnapshotTask&) + 1196
2   VBoxSVC                       	0x0013d678 SessionMachine::RestoreSnapshotTask::handler() + 24
3   VBoxSVC                       	0x0012eba8 SessionMachine::taskHandler(RTTHREADINT*, void*) + 40
4   VBoxRT.dylib                  	0x003b0160 rtThreadMain + 64
5   VBoxRT.dylib                  	0x003ffd7e rtThreadNativeMain(void*) + 142
6   libSystem.B.dylib             	0x9a811259 _pthread_start + 345
7   libSystem.B.dylib             	0x9a8110de thread_start + 34
And the error messages said:
VBoxManage: error: Could not find an open hard disk with UUID {....}
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb001), component VirtualBox, interface IVirtualBox, callee

Any tips, documents or search terms that anyone can suggest? Seems like any search with "snapshot" in it gets a lot of hits.

Re: How to fix my VirtualBox.xml file?

Posted: 26. Jul 2011, 19:25
by Sasquatch
If you haven't started VB a second time, then you should have a virtualbox.xml-prev file. That is the backup of a previous run and should have everything you need. Of course, if you started VB after you changed it and failed, then the backup file is overwritten and you cannot fix it easily. Then all you can do is try to do it manually, looking careful at the syntax.

Re: How to fix my VirtualBox.xml file?

Posted: 26. Jul 2011, 20:05
by jguerrero
Hi Sasquatch, thanks for the suggestion. At that time, I found VirtualBox.xml-prev, but it was identical to the master except for one minor value which I do not remember.

However, I suspect (but cannot prove) that neither the -prev nor the master ever had a version of the file that included the 5 new UUIDs inserted into the correct location. I think VBoxSVC crashed before it could make that change, so it updated the machine's .vbox file but not VirtualBox.xml. Meanwhile, the machine's .vbox-prev file was identical as well (by the time I found it), so I could not backout. I suppose the lesson learned is to backup both files before creating or restoring a snapshot.

I will gladly examine and make changes to either VirtualBox.xml to add the 5 new UUIDs to the correct location, or else to back out the change to the machine's .vbox file. But I have about 30 snapshots in about 5 branches, with 4-5 disks in most of those configurations, so it is not easy for me to see what is the proper structure.

Is there a document that explains the before and after state of both files when restoring a snapshot? Or can anyone advise where the new UUIDs should go in VirtualBox.xml when an older snapshot is restored? It seems like a simple enough change for someone who knows what to expect in the "after" state. I have a backup and no fear of hacking at the .xml file, but could use some guidance.

Or is there a way to import back a machine's .vbox file with 30 snapshots and retain the history? I was able to create a new VM which pointed at specific snapshot files (by using file dates and the UUIDs in the machine's .vbox file to determine which go with which), but I lose the history.

Thanks

Re: How to fix my VirtualBox.xml file?

Posted: 26. Jul 2011, 21:27
by Sasquatch
What I did with a VM when I didn't have the main xml any more, was to drag and drop all the snapshot files into the media manager. That registered the files, temporarily, and I was able to start the VM. Now I'm not sure if your situation will give the same result as I got, because the snapshot was registered in my machine xml file. For you, you might have to hack it so that there is no invalid mention in it, then dnd the snapshots in the MM and pick the VDI from the file picker in the VM settings. Hopefully, that will get the whole snapshot tree in the VM xml file. Then you can hack the main xml file to include the snapshots, in the same way I had to do. In the end, I had to ditch the most recent state though, it was unrecoverable (VB just wouldn't start the VM or it crashed itself, don't remember which).

Re: How to fix my VirtualBox.xml file?

Posted: 26. Jul 2011, 21:57
by jguerrero
Thanks for the tip about drag and drop registering the snapshots. I will try that and report back.

Hopefully the snapshots are smart enough to know their own parent. If so, then maybe when I drop in the newly created 5 snapshots, they will automatically go where they need to go in VirtualBox.xml.

Thanks

Re: How to fix my VirtualBox.xml file?

Posted: 26. Jul 2011, 22:10
by Sasquatch
They will probably not be registered in the virtualbox.xml file. I had that myself with a VM with two (or three, forgot) snapshots. They were listed in the correct order of parent/child in the media manager after the dnd, but that was it. It was stored for that session only. The main xml was not updated. That's when I had to hack the file myself to fix the missing snapshot error. Thankfully, the UUIDs are shown in the MM, so you can create the tree from that.