set "Restore current snapshot" to false when closing VM

Here you can provide suggestions on how to improve the product, website, etc.
Post Reply
Andreg
Posts: 3
Joined: 19. Jun 2020, 18:02

set "Restore current snapshot" to false when closing VM

Post by Andreg »

On the "Close Virtual Machine" popup, there's checkbox "Restore current snapshot '....'" that are sometimes checked by default and it's really bad cause if we don't pay attention we could lost many hours of work...

Please remove this checkbox from the "Close Virtual Machine" or at least please don't allow it to be "checked" by default.

Thanks for this good software by the way! :)
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: set "Restore current snapshot" to false when closing VM

Post by fth0 »

I'm not sure, but I think it is only checked if the user has checked it deliberately before, so it remembers the previous wish of the user.

Note that many users (me included) have VMs for testing purposes, start them from a snapshot, and usually want to return to that after testing something. So for these users the remembered checkbox is welcome.

Also note that using Power off is inherently dangerous, since it is the equivalent of pulling the power plug on a real PC. So you already should know what you're doing when using Power off at all. ;)
Andreg
Posts: 3
Joined: 19. Jun 2020, 18:02

Re: set "Restore current snapshot" to false when closing VM

Post by Andreg »

I agree with you that it may be usefull to have this setting for some users directly in the close VM but considering the consequences of letting it checked by default if the user already use it somewhere in the past...

As an example:
I've been in a code game recently and we had a limited time to work on wonderful project(s), it was really cool.
The windows on my VM found that it was a good time to play me the "Getting windows ready... don't turn off your computer or you will die...." screen for what it seems an eternity (probably just 5-10 minutes, but I'm not really patient)
So I decided to turn off the VM in this dangerous way but I did not remember that the last time I turned it off this way (probably year(s) before), I checked the option to restore the snapshot.
You probably understand the conclusion! :)

So now, I'm kindly ask if it's possible to never checked it by default (even if I already used it in the past)
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: set "Restore current snapshot" to false when closing VM

Post by scottgus1 »

The only way that I know to change the way the box acts now is to change the source code.

Note that if Virtualbox stores the status of this checkbox (probably in Virtualbox.xml or the guest's .vbox file if it's stored anywhere) then it might be possible to have a script that resets the box (probably a vboxmanage command) then starts the guest. As the old mathematics books say, determining if this is possible is left as an exercise for the student. :lol:

Or, like fth0 says, look carefully when using Power Off. 8)
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: set "Restore current snapshot" to false when closing VM

Post by fth0 »

I took a look at the source code: The information is saved in the .vbox file in "GUI/LastCloseAction". You can use the following commands to change the current value:

Code: Select all

VBoxManage setextradata "VM name" "GUI/LastCloseAction"
removes the current value, and

Code: Select all

VBoxManage setextradata "VM name" "GUI/LastCloseAction" "PowerOff"
sets it to Power off (without restoring snapshot). Determining the other possible values is left as an exercise for the reader. :wink:
Andreg
Posts: 3
Joined: 19. Jun 2020, 18:02

Re: set "Restore current snapshot" to false when closing VM

Post by Andreg »

Thanks fth0,

I was not aware of those commands neither of where the information was stored.

As the mathematician said, I should probably read more :)

It's good to know, thanks again
Post Reply