Virtualbox: Howto start a new machine on boot and then stop it on halt
Hello all,
As an environmentally conscious programmer, I decided to retire my old development box and virtualize it instead. So now, I have a GUEST Debian instance running in VirtualBox on top of my linux HOST. I find the setup much better - saves energy, and it's easier to back up and administer. So, I would like to do the following: I want my GUEST to start when the host boots up. This is not an issue. I will just VBoxHeadless -startvm Debian somewhere on boot. However, I am a bit fuzzy on how to best go about shutting the GUEST down when the HOST halts. The problem here is that the script that does this must be blocking - i.e. HOST must not halt before the GUEST does shuts down. Now, I'm not too familiar with writing init scripts, especially upstart scripts that my distribution now uses. I suppose they are blocking, but unless I have to deal with them, I'd rather take a less manual labor approach. How would I go about this the easiest way? Any suggestions? Any ready-made scripts? Thanks |
My knowledge is of Slackware not ubuntu but nobody else has answered in more than 24 hours ...
VirtualBox installs a boot/shutdown script that has the VM shutdown capability you ask for. On Slackware it is rc.vboxdrv so it is probably vboxdrv within the upstart directories. rc.vboxdrv can be configured using /etc/default/virtualbox. This usage not described in the VirtualBox 3.2.8 User Manual but is mentioned in a comment in the rc.vboxdrv script. Unfortunately it does not work for me as described in this VirtualBox forum thread. It should be possible to script around this problem but it makes sense to explore the mechanism provided by VirtualBox first. |
Quote:
Thanks again, very helpful. |
Quote:
|
Quote:
If there is a virtual machine running, it works perfectly fine. However, when there are no virtual machines running, sometimes (and only sometimes!) it fails with this: Code:
ERROR: failed to create the VirtualBox object! |
Quote:
|
Reported as a defect at http://www.virtualbox.org/ticket/7844
|
All times are GMT -5. The time now is 10:52 AM. |