﻿id	summary	reporter	owner	description	type	status	component	version	resolution	keywords	cc	guest	host
16074	stateFile reference in vbox file corrupted upon moving VM	Wouter Kariboe		"When I use the VirtualBox GUI to move a VM having a live snapshot, the stateFile reference in the vbox file gets corrupted:[[BR]]

""Snapshots/''filename''.sav"" becomes ""Snapshots/''filename''.sav/Snapshots/''filename''.sav"".[[BR]]

This quickly results in the VM not starting any more.
[[BR]]

VirtualBox versions tested: 5.0.26 and 5.1.6[[BR]]

Host: Windows 7x64[[BR]]

Guest: any
[[BR]]

Steps (all done via the VirtualBox GUI (except the vbox file copies via Windows Explorer):
[[BR]]

1. Create a new VM in an existing group. For instance: a Debian 64-bit VM called Deb in a group called Microsoft, accepting all defaults.
2. Start the VM, boot from an installation iso and let the VM run for a few moments. (E.g. debian-8.6.0-amd64-kde-CD-1.iso almost instantly settles at its boot menu.)
3. Take a (live) snapshot of the VM called Snapshot 1.
4. Close the VM, selecting ""Power off the machine"" and ""Restore current snapshot 'Snapshot 1'"".
Resulting snapshot tree: ""Snapshot 1"" -> ""Current State (changed)"".[[BR]]

[Actually the creation of ""Current State (changed)"" here might be the result of another bug, but that's probably another matter.]
5. Using Windows Explorer, copy Deb.vbox to Deb1.vbox.
6. Drag the VM to another group, e.g. ""Linux"".
7. Copy Deb.vbox to Deb2.vbox.
8. Start the VM. It is restored correctly at the point it was stopped (e.g. Debian's boot menu).
9. Close the VM, again selecting ""Power off..."" and ""Restore ... 'Snapshot 1'"".
10. Copy Deb.vbox to Deb3.vbox.
11. Start the VM. The VM aborts almost immediately, and a dialog box pops up, stating:

{{{
VirtualBox - Error
Failed to open a session for the virtual machine Deb.
Details:
The VM session was closed before any attempt to power it on.
Result Code: 
E_FAIL (0x80004005)
Component: 
SessionMachine
Interface: 
ISession {7844aa05-b02e-4cdd-a04f-ade4a762e6b7}

}}}

VBox.log provides the following error messages:


{{{
ERROR [COM]: aRC=VBOX_E_FILE_ERROR (0x80bb0004) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={VM cannot start because the saved state file 'Z:\VM\VirtualBox\Machines\Linux\Deb\Snapshots\2016-10-17T12-48-59-752997200Z.sav\Snapshots\2016-10-17T12-48-59-752997200Z.sav' is invalid (VERR_PATH_NOT_FOUND). Delete the saved state prior to starting the VM}, preserve=false aResultDetail=0
GUI: Aborting startup due to power up issue detected...

}}}

Note that Deb2.vbox (which was saved immediately after the VM was moved), already contains the invalid path in the ''snapshot'' definition:

{{{
    <Snapshot uuid=""{12ae5280-3c84-409c-a9eb-03266b75b4e0}"" name=""Snapshot 1"" timeStamp=""2016-10-17T12:48:59Z"" stateFile=""Snapshots/2016-10-17T12-48-59-752997200Z.sav/Snapshots/2016-10-17T12-48-59-752997200Z.sav"">

}}}
However, the machine state's stateFile is still correct (which is why the VM can still run successfully):

{{{
  <Machine uuid=""{4091a06e-3382-47c8-a46d-3f2efa978a8d}"" name=""Deb"" OSType=""Debian_64"" stateFile=""Snapshots/2016-10-17T12-48-59-752997200Z.sav"" currentSnapshot=""{12ae5280-3c84-409c-a9eb-03266b75b4e0}"" snapshotFolder=""Snapshots"" lastStateChange=""2016-10-17T12:49:25Z"">

}}}

However, in Deb3.vbox, saved after the first (""successful"") run after the move, the machine state has ''also'' become corrupted:

{{{
  <Machine uuid=""{4091a06e-3382-47c8-a46d-3f2efa978a8d}"" name=""Deb"" OSType=""Debian_64"" stateFile=""Snapshots/2016-10-17T12-48-59-752997200Z.sav/Snapshots/2016-10-17T12-48-59-752997200Z.sav"" currentSnapshot=""{12ae5280-3c84-409c-a9eb-03266b75b4e0}"" snapshotFolder=""Snapshots"" currentStateModified=""false"" lastStateChange=""2016-10-17T12:48:59Z"">

}}}
This explains why the VM doesn't start any more.
[[BR]]

Things get even worse if I then move the VM back to its original (or any other?) location: stateFile then becomes a ''quadrupled'' path:[[BR]]

""Snapshots/''filename''.sav/Snapshots/''filename''.sav/Snapshots/''filename''.sav/Snapshots/''filename''.sav"""	defect	closed	VMM	VirtualBox 5.1.6	fixed	move;snapshot;stateFile		all	Windows
