I am trying to start a VirtualBox VM on a separate X screen (in fullscreen) so I can switch between Linux and Windows XP by doing Ctrl + Alt + F<.

I am basically trying to do something like this:

startx "VBoxManage startvm XP" -- :4 
startx "VBoxManage startvm "XP"" -- :4 (is this correct for quotes within quotes??)

I get a "bad command line option "VBoxManage" back from the startx script so obviously I am not understanding the rules for how to write "shell magic".

How can I do this correctly, or perhaps there is a better way of achieving a VirtualBox VM on a separate X screen?

link|improve this question

57% accept rate
feedback

1 Answer

up vote 1 down vote accepted

You could add something like this to your ~/.xinitrc file:

# ...
if [ "${DISPLAY}" = ":4" ]; then
  gnome-session &
  waitpid=$!
  vboxmanage startvm vmname
  wait ${waitpid}
fi
# ...

This would check if this is the display where you want to run your VM, then, start a gnome-session on background (or whatever session you want) and execute vboxmanage. The wait ${waitpid}} will keep everything running until you decide to either kill startx or exit from gnome.

link|improve this answer
Thanks a lot, I am not closing this (yet) because I would like to see if it is possible to solve this in other ways as well. :) – Waxhead Aug 30 '11 at 20:07
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.