Page 1 of 1
Autostart VM at boot
Posted: 17. Mar 2011, 19:27
by rollingo
Hello, I'm running a Headless Ubuntu 10.04 Server and trying to run a VM at boot.
Tried vbooxtool without success.
vboxtool autostart works great via ssh but fails to start at boot.
Also I tried other approaches like adding in /etc/rc.local
Code: Select all
nohup exec /bin/su -c 'VBoxManage startvm --type headless XP' user >/dev/null 2>&1
And finally creating a vboxbootXP.sh file with
Code: Select all
nohup VBoxHeadless --startvm "XP" --vrdp=config &
and adding it to the crontab
I'm running out of ideas, please help me with this one with an easy way to start a headless vm in ubuntu.
Many thanks in advance
Re: Autostart VM at boot
Posted: 17. Mar 2011, 19:52
by Perryg
Starting the guest is no problem. Create a script that has VBoxHeadless --startvm "XP" and then call it from the /etc/rc.local.
The real trick is to create a script that starts and stops the guest. If not then shutting down the host will look like you pulled the plug on the guest. Windows is especially unhappy when you do this and so is VBox. You could end up with a dead guest.
I know that such a script exists on the Ubuntu forum, but could not locate it quickly. Search the Ubuntu forums and you should find you answer.
Re: Autostart VM at boot
Posted: 17. Mar 2011, 20:07
by rollingo
Thanks for the assistance but even creating the script and call in it from /etc/rc.local wont work
I have no idea why this is happening, any ideas on how to check why the vboxheadless is failing to start when is booting up the server?
I know that if server is going down VM could be damaged, but at this point I don't care, just need to make this work. Here are the files.
Code: Select all
cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/home/user/vboxbootXP.sh &
exit 0
Code: Select all
cat /home/user/vboxbootXP.sh
nohup VBoxHeadless --startvm "XP"
Re: Autostart VM at boot
Posted: 17. Mar 2011, 20:15
by Perryg
Is /etc/rc.local executable?
These are really Linux questions and you can actually find them all at
Ubuntu