28

Host OS: Windows 7 Guest OS: Ubuntu 11.04

Say if I won't need to work on the guest OS for 1 hour, while having a lot of programs running and don't want to close them. What is the best way to pause my work on the guest OS? Ubuntu has suspend and hibernate. I found that hibernate won't work as it always fails to boot up after hibernate. For suspend, should I couple it with Virtualbox pause to release the host OS resources. Would this cause any issue once resume the work? Since I found sometimes the guest OS becomes slower resume from pause VM.

4 Answers 4

40

For Virtual Box it is not recommended to use the power saving features of the guest OS as this will all be handled by the host. Therefore first thing when having installed my guest OS I disable this (including disabling the screen saver).

The appropriate way to save a virtual machines state (and resume later) is to coose Save the machine state when closing the machine from virtual box manager (here depicted for Windows XP).

enter image description here

This will free all ressources from the virtual machine. Next time we start the machine we will resume exactly at the same state where we saved it (like in suspend/hibernate from a real machine).

From command line this can also be done by

VBoxManage controlvm <name_of_machine>  savestate

Note on security: Mind that resuming from a saved state does not ask for authentication for the guest OS. In case we work with confidential data we therefore need to log out (or switch user) from the guest OS before saving.

1
  • Just a tip: If someone gets stuck in Sleep/Hibernate mode on the Guest OS, the keyboard and mouse clicks stop working. All you have to do is press HOST+H. Apr 13, 2020 at 10:53
5

Create a script called 90_virtualbox in /etc/pm/sleep.d:

#!/bin/sh
#
# 90virtualbox: scan for active virtual machines and pause them on host suspend

VBoxManage list runningvms | while read line; do VBoxManage controlvm "$(expr match "$line" '"\(.*\)"')" pause; done
1
  • Good one. Paused VMs do survive a system suspend or hibernate. Just take into account this should be run with user id that started the VMs (in most cases it won't be root). In my case (LUbuntu 20.4, VirtualBox 6.1) I put that line in a separate script and run that script using sudo -c scriptName userName Jun 29, 2021 at 20:52
0

Full agree :) so in conclusion, we can use the sleep option on the host and GO ^^ However, carreful if we hadn't saved the vm's status in case of issue with the wake up of the host

Because of our exchanges and thanks to Bruno I will now click on the host sleep mode with no more worry :) Have a nice week-end, Christophe FR

PS:I update this post to tell to Bruno that host and guest additions are updated.

1
-1

Did you install Vbox additions correctly on the guest OS?

I don't see a problem with of the options here. If you can make Ubuntu hibernate it would be great but a suspend + pause option will work the same.

Hibernation can be simply described as: all content in memory save in disk file which is read again on boot up. (Memory>temp file in disk>power off:::power on>read temp file to memory> restore session>read new times, dates of other hardware info that might have changed in the meanwhile>ready)

Suspend can be simply described as: all content of memory will not be touched, most of your hardware will be powered down, once you start up again the memory session will be restored. (memory stays the same, static>most hardware powers off, memory is not turned off:::power back on>restore session>read new times, dates of other hardware info that might have changed in the meanwhile>ready)

So, in the end, its the same if you hibernate or suspend + pause you guest OS. The results should be the same.

Work on the hibernation part in my opinion, saves an extra "pause" click.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .