Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to start virtual machines in headless mode. The advantage: I can logoff from the desktop, and the machine will continue to run. However, starting the virtual machine blocks the Terminal from closing. Is there a clever solution to have everything like a service in the background? If I do 'sudo service ntp start' it will start, and then I can close the Terminal. I could do the following, but I'm not happy with it:

  • nohup VBoxHeadless -s "MyGuest" &
  • log in from a login shell (tty1-6) which is equipped with Byobu, start the VM, and instead of logging out I could detach with F6.

Better way of doing it?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Just found a solution here: Starting the the virtual machine with VBoxManage instead of VBoxHeadless solves my problem:

VBoxManage startvm <uuid|vmname> --type headless

For example, if your VM's name was Ubuntu and it had a UUID of 865b2700-471a-11e4-916c-0800200c9a66, you can run:

VBoxManage startvm Ubuntu --type headless

or

VBoxManage startvm 865b2700-471a-11e4-916c-0800200c9a66 --type headless

Note: If the name of your VM contains spaces, wrap the name in quotes (e.g. "My Ubuntu").

The machine goes nicely into the background. Now I can control the virtual machine with VBoxManage controlvm poweroff/pause/reset (section 3.3).

share|improve this answer
    
Nice trick. You can always use VBoxManage controlvm even if you started a machine VBoXHeadless. –  Javier Rivera Nov 26 '12 at 7:53
    
Great find! Here's the command for those who don't know VBoxManage startvm Crunchbang --type headless –  brettof86 Nov 18 '13 at 17:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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