在主机重新启动时安全关闭虚拟机

tak*_*hin 8 reboot virtualbox windows-7

我在 Ubuntu 11.10 上的 Virtualbox 中运行 Windows 7。一切正常。我在启动时运行它,但我在重新启动时遇到问题。

当我输入sudo reboot now虚拟 Windows 7 的状态时,没有保存。重新启动后,virtualbox 启动,但不是正在运行的 Windows,而是 Windows 的 7 崩溃启动菜单,并且 Windows 再次启动。

是否有选项可以让 Ubuntu 在主机重新启动之前向虚拟机发送一些信号以安全关闭实例?

Tak*_*kat 6

如果您确实需要在 Virtual Box 中的虚拟机运行时关闭,您可以定义自己的手动关闭脚本,您可以在其中放置命令以在关闭过程开始之前保存机器状态:

VBoxManage controlvm <name> savestate # <name> is the name of your VM
gnome-session-quit --power-off # this example displays the power-off dialog for >11.10
Run Code Online (Sandbox Code Playgroud)

或者,您也可以生成一个始终在 shutdown 时运行的脚本。