[Closed]Force delete snapshot when file is lost.

This is for discussing general topics about how to use VirtualBox.
Post Reply
Mskvaer
Posts: 4
Joined: 3. Sep 2016, 21:09

[Closed]Force delete snapshot when file is lost.

Post by Mskvaer »

version 5.1.6 on a window 7 64bit. Occasionally on shutdown I "loose" a disk snap shot file. That in itself is a bug, but I have not had time to submit that. Fortunatly in most cases I can drop the machine - or rather, that is what I have ended up doing.

Now I do not want to do that anymore. So here I have a machine (a snapshot clone). Current State. I take a snapshot, I do some stuff. I kill the machine (some stuff in it is hung anyhow) and I am in a hurry so I do other stuff on windows. I get some popup error when closing VM - somthing about not being able to set a GUI key.

Next start of VirtualBox I am told a disk is missing. Sure enough, it is one of the snapshots of the machine I closed in such a hurry, and it is the lowest section of the snapshot chain (I presume but do know) that it contains the disk changes done after the snap shot was takensnapshot is the older fileset). Well, I want to drop the snapshot so surley it doesnt matter the file is gone. I restore to the snapshot - that works fine,

But then dropping the snapshot fails. Whet is the "drop snapshot FORCE (ie ignore a missing file, that is to be deleted anyhow)

I tried in the GUI and the CLI - the latter gives the full error message

Code: Select all

Progress state: E_FAIL
VBoxManage.exe: error: Snapshot operation failed
VBoxManage.exe: error: Cannot lock hard disk 'C:\VirtualBox\Ora 12 SE DGD\Snapshots\{cfae24c7-c3e3-4517-afa3-03596709f602}.vdi' when deleting a snapshot
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component SessionMachine, interface IMachine
VBoxManage.exe: error: --------
VBoxManage.exe: error: Could not open the medium 'C:\VirtualBox\Ora 12 SE DGD\Snapshots\{fcf0a267-7197-440f-8283-4b7c8b8fae97}.vdi'.
VBoxManage.exe: error: VD: error VERR_FILE_NOT_FOUND opening image file 'C:\VirtualBox\Ora 12 SE DGD\Snapshots\{fcf0a267-7197-440f-8283-4b7c8b8fae97}.vdi' (VERR_FILE_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleSnapshot(struct HandlerArg *)" at line 533 of file VBoxManageSnapshot.cpp
Last edited by Mskvaer on 16. Jan 2017, 11:00, edited 2 times in total.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Force delete snapshot when file is lost.

Post by scottgus1 »

What you're saying is unclear. This post will take some debugging...
Mskvaer wrote:I have a machine (a snapshot clone)
Which one is it, a snapshot or a clone?
Mskvaer wrote:I kill the machine
Gracefully, inside the guest OS Shutdown routine? More firmly, via the guest Virtualbox window's Close box? Mercilessly, via host Task Manager?
Mskvaer wrote:I get some popup error when closing VM - somthing about not being able to set a GUI key.
Be more specific. What exactly does the error say? There is usually a "Copy" button in the error box that allows copying the error message into the Clipboard then into you next post as searchable text.
Mskvaer wrote:I want to drop the snapshot
In the different things Virtualbox allows to do with a snapshot, there's taking, restoring and deleting, but no "dropping". Which of the officially-named actions are you trying to do when you "drop" a snapshot?

Occasionally you lose the last snapshot in your chain for some reason. There's been rather a few folks that manipulate the snapshot files in a guest outside of Virtualbox and thus destroy their guest, but I haven't heard of Virtualbox failing to taking, restore, or delete snapshot, not to say that such a thing can't crop up. But there haven't been a mass of reports of losing the last disk in the snapshot chain that I remember. Could be there's something wrong on your host PC.

In fact the "not being able to set a GUI key" thing may be a bit of an indication, as a vague first-off guess that the real issue may be that Virtualbox is having problems writing to your host hard disk.

Please be more specific in the above questions and in the report of the issue when it happens again and we'll see what we can do.
Mskvaer
Posts: 4
Joined: 3. Sep 2016, 21:09

Re: Force delete snapshot when file is lost.

Post by Mskvaer »

Thanks for a quick reply. Appreciated. Onwards with "debugging the post":
"Snapshot clone".-> Linked Clone
"kill machine" -> Cross in top-right, then answer the question with Restore previous snapshot.
"Some GUI key" -> sorry, I'll have to reproduce the error. I took note of "GUI" and assumed it was nonvital.
"Drop snapshot" .> Delete snapshot (non Sequir: Drop, Delete, Remove, Erase, Wipe, Destroy, ... synonyms galore! ;-) )

More info:
I do not manipulate VB files in anyway, only through the graphic GUI. I do not tweak the configuration files. The closest I've come to "reverse engineering" VBox is to observre the modify date of the snapshot files, and having worked with some virtualisation products (Desktop and Industry grade). Thus my theory is that when I create a snapshot, the new blocks are stored in the new files, and the original is only read from. Deleting the last snapshot thus is only to delete these "latest" files, (or truncate if restoring to the snapshot) and the snapshot is there again.

This VBox machine is a linked clone from a full clon, a point in time where it was a few snapshots deep. Some screen shots that describe the current state sufficiently I hope.
The manager to find the problematic file. It says "file not found", on mouseover
The manager to find the problematic file. It says "file not found", on mouseover
Capture1.PNG (29.1 KiB) Viewed 5054 times
Snaphot directory
Snaphot directory
Capture2.PNG (11.65 KiB) Viewed 5054 times
The snapshot tree.
The snapshot tree.
Capture3.PNG (6.82 KiB) Viewed 5054 times
The host machine is my laptop. No other application has had problems with files, writing or loosing them, on the C:drive which is a SSD disk. Admittedly, the Vbox VMs are the largest flies, and when I use the application that loads the laptop more than others.

Now, this post is not about submiting the bug why the file is lost (When I do that I'll have a proper scenario description), but *IF* I have a lost "snapshot file" (meaning the file used for storing the new blocks of the current disk state), and the system has no problems restore to previous snapshot (which means stop using the "currrent" files, and return to previous set) - it works I can start the machine. Now I really do not need a snapshot at all, I just want the version before I started a snapshot.

How do I "delete snapshot" when it has a missing file?
Mskvaer
Posts: 4
Joined: 3. Sep 2016, 21:09

Re: Force delete snapshot when file is lost.

Post by Mskvaer »

It occurred to me to take a full clone of the initial state ... i.e. I did a restore Snapshot, Full Clone. Then I could Remove the machine with the partial snapshot.
A workaround, uses (too much) diskspace, but OK for now.

Case closed. (But not solved. Next time I loose a snapshot file I'll get better diag info.)
Post Reply