How to safely shutdown Guest OS in VirtualBox using command line

If you open up Gnome Power management preferences, you can set what actions to take when the power button. If you set it to shut down, it will shut down gracefully when you press the virtual power button with the VBoxManage controlvm Ubuntu acpipowerbutton command.


To safe shutdown vm use this command:

vboxmanage controlvm Ubuntu poweroff soft

Don't do this:

VBoxManage controlvm Ubuntu poweroff

It is equivalent to pulling the power plug on a real computer. You don't want to do this!

Use the ACPI shutdown method (check the power management setting like Egil suggests) or maybe give the save state method (savestate) a try.