Page 1 of 1

SOLVED Snapshot canceling busts VM? Snapshot Cancel harmful?

Posted: 16. Sep 2010, 22:43
by odakoda
I've been using VBox 3.2.8 to run a Linux/Ubuntu guest under a Windows 7 host.
It was all working ok. The Linux guest was being accessed as a VMDK image.

One day last week, I decided to try making a snapshot in the GUI. The snapshot was taking a very, very long time (over 10 minutes and counting...) and I could not wait any longer, so I decided to hit the Cancel button before the snapshot was finished.

Now the Linux VM is broken. Whenever I try restarting the Linux guest, it always fails with the same fatal error:

Code: Select all

{hard disk} cannot be directly attached to the virtual machine because it has 1 differencing child hard disks.
I searched for advice and found this:
http://that-matt.com/2009/11/virtualbox ... ard-disks/
So, I deleted the Linux guest VM using the GUI, and recreated it in the GUI (using the "New" button).
Then I used the Virtual Media Manager to try to find the original Linux VMDK and attach it to the VM, but it could not find a VMDK at all! This is the only action I have taken to try to recover the VM - I have not used VBoxManage.

From the command-line, I searched for the original Linux VMDK file in my .VirtualBox directory. The only VMDK was a file inside the Snapshots subdirectory, and I'm not sure if it is safe to use it if it is incomplete (because I interrupted the snapshot process).

I read the manual completely, especially the sections on VMDKs and the command-line tool VBoxManage, but I still have no idea what to do.

I am asking for advice now, rather than experimenting any further and possibly making the situation irrecoverable.

Can anybody explain what has happened to the original Linux VMDK, how can I recover it, and how can I get my VBox working again?

Is taking a snapshot and canceling it midway something you're not meant to do?

Is the snapshot dialog's Cancel button dangerous to use?

Is it a bug?

I found somebody else apparently had the same problem when running a Windows guest under a Linux host, which is the opposite of my Windows host/Linux guest. They wrote a bug report which is open and unconfirmed for the last 4 months:

http://www.virtualbox.org/ticket/6877 "(Broken if cancel creation snapshot) - VirtualBox"

I would be grateful for any advice.

BobO

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 16. Sep 2010, 23:35
by Perryg
Well it looks like canceling is not a good thing.
Open the media manager and try removing the snapshot from there first then see if it will attach. If not I don't know what you would need to do. BACK it all up first!

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 10:44
by odakoda
Perryg wrote:Open the media manager and try removing the snapshot from there first then see if it will attach. If not I don't know what you would need to do. BACK it all up first!
Thanks for the suggestion. Do you know if the action of removing the snapshot from within the Virtual Media Manager is actually reversible, i.e. can it be undone later using the GUI? The amount of time it takes to make and restore backups on my storage media is very long, so I would like to try any other alternatives that have lower risk of having to go through a full restore cycle if at all possible.

By the way, I just reproduced the problem on three fresh VBox 3.2.8 installations on a different PC. If it is a bug, I think it is an extremely serious one. I hope the VBox dev team will be able to resolve it quickly, and meanwhile acknowledge the bug report #6877:
http://www.virtualbox.org/ticket/6877

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 11:24
by odakoda
In my original report at the top of the page (and in my comment above about reproducing the problem in three new VBox installations), I was running the Linux VM when I started taking the snapshot. I don't know whether taking a snapshot of a running VM is ok; the snapshot dialog and the manual do not say anything about that.

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 15:00
by Perryg
I don't think it would be reversible. I (when I take snapshots) always do it while the VM is running. At this point I would not think that the guest is at all usable so only suggested this as a final thing to try. Since you did not change any data after it would not loose any information but if there are other snapshots before this they will be toast as well from what I understand.

If you backup the machine.VDI, snapshot, machine.xml and VirtualBox.xml you should be able to put it back but these things are fragile and I can not promise it will work. My suggestion is to create an account on bugtracker and post to the ticket you found. Be sure to attach the guests log file and describe what you have/are doing.

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 16:29
by odakoda
Perryg wrote:Open the media manager and try removing the snapshot from there first then see if it will attach. If not I don't know what you would need to do. BACK it all up first!
Well, there was only one VMDK visible in the Virtual Media Manager. It was called ubuntu.vmdk
There were no other VMDKs visible and particularly no VMDKs with helpful names like "snapshot.vmdk".

Removing that VMDK went like this (the words below are not correct; I can't remember the exact words of the dialogs; I guess most anybody can probably work out which dialogs I am actually referring to)

1. Remove media - Yes or No? Yes

2. Keep media so it can be re-attached - Yes or No? Yes

3. Error popup:
Failed to close the hard disk C:\Tools\ubuntu.vmdk

Cannot close medium 'C:\Tools\ubuntu.vmdk'
because it has 1 child media.

Details:

Result Code: E_FAIL (0x80004005)
Component: Medium
Interface: IMedium {1d874a-187f-7867-
c716-98acfb64f2ff}
Out of luck at this point?

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 16:33
by Perryg
I believe so. You might be able to remove the snapshot information from the xml file but I have no idea if this will allow the base file to work or not.

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 16:43
by odakoda
Thanks for your help, Perry. I appreciate it.

So, my VBox setup is entirely broken because I simply canceled a snapshot.
I have to say I think it's an extremely serious bug in VBox.

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 17:12
by Perryg
I would agree. That is why I said you should create an account and post to the ticket. They only know when someone shakes the door knob so to speak.

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 21:28
by odakoda
Solved! Thank you very much Perryg, Klaus, and MichalN.

Summary:

1. In the GUI, remove the existing guest VM,

2. Create a new guest VM (click the New button),

3. Use the wizard to set up the new VM (be careful, you should probably select Use existing image VMDK if VBox was accessing the guest via VMDK / raw partition),

4. Change the Settings (it can be found under the Machine menu) per your requirements,

5. Quit VBox,

6. Restart VBox,

7. Run the guest VM.

Do not do anything to VBox on the command-line; especially, do not edit the VBox XML files by hand, do not use VBoxManage, and do not delete either the snapshot or the base VMDK files. That's all!

I have copied the same to the bug report. I hope this will help somebody else who hits the same bug with Snapshot Cancel.

Re: Snapshot canceling busts VM? Snapshot Cancel is harmful?

Posted: 17. Sep 2010, 21:53
by odakoda
As a footnote, Klaus confirmed this is a bug in Snapshot Cancel; when you hit Cancel, it should remove the differencing child media, but it doesn't. As requested, I also filed a new bug report asking for a progress indicator for snapshot to make it easier to track the slow progress of making a live snapshot on large VMs that use at least 5GB RAM:
http://www.virtualbox.org/ticket/7492