I have Ubuntu 10.10 and using VirtualBox 3.2. As a Guest OS I have another Ubuntu in the VirtualBox.
I am starting Guest Ubuntu automatically using following command once my Host Ubuntu boots:
VBoxHeadless -startvm Ubuntu --vrdp on
Then I can access to it with ssh or tsclient.
Now I need to shutdown automatically Guest Ubuntu once I shutdown my Host Ubuntu. Does anybody know any safe method to automatically shutdown Guest Ubuntu with a command line? I have found out two ways one can shutdown Guest OS but I am not sure whether they are safe or not. Here are they:
VBoxManage controlvm Ubuntu acpipowerbutton
or
VBoxManage controlvm Ubuntu poweroff
VBoxManage controlvm <vm> savestate
. The command will save the VM state and then stop it (as opposed to a shutdown). Since this is the most upvoted answer on this very popular question, I would suggest adding this to this answer. – Etheryte Sep 30 '20 at 20:34