Save Machine State

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
joako
Posts: 6
Joined: 1. Jul 2008, 08:45

Save Machine State

Post by joako »

Is there some simple way? What I want to do is setup MacOS autologin, run VM on login. When logging out, rebooting, quit virtualbox, etc I would like the options "Save Machine State" to be taken automatically, so imagine,

1) Turn on Mac, Logs in to account & starts up VM automatically
2) Log out or shut down mac, VM "save machine state" without any further prompt or problem.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Save Machine State

Post by Sasquatch »

To get the save state when the user logs out (this happens too when you reboot or shut down), you have to find some hacks to run a script before the actual log off procedure starts. That way, VM is properly put into a saved state before anything starts to be closed by the log off procedure, as that can kill -9 a process if it takes too long to close.

I've also removed your cross-post. It's not allowed here. It was also posted in an old topic.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
abhibeckert
Posts: 9
Joined: 14. Mar 2012, 11:13

Re: Save Machine State

Post by abhibeckert »

I'd also like to have this ability.

What are you talking about with kill -9? Perhaps on other operating systems that is the case. On OS X no GUI app will never be killed by the system. Never. Only a user can kill an app, either by typing `kill -9` at a bash prompt, or with the "Force Quit" feature.

When a user logs off, it sends an event to all processes instructing it to save state and quit. After a couple seconds, if any GUI apps are still running then the log out/shut down/etc is aborted altogether and the user is instructed to close that app and try again.

The end result is, every single time I log out or reboot my mac, it fails with an "VirtualBox Canceled Log Out" alert message, I have to then go press return in virtual box, wait 30 seconds, and then repeat the log out/reboot command. It's standard practice for every OS X app to save it's state when instructed to quit, that's what all my other apps do automatically and it's annoying to have to go press an OK button every time.
Post Reply