1

I have this problem.

I login remotely to a machine with Virtualbox installed by launching:

ssh -Y root@virtualbox

After that, I launch a Virtual Machine:

nohup VBoxSDL --startvm vm1

or

nohup VBoxSDL --startvm vm1 &

After that, I don't have the prompt anymore.

Then, if I switch off my local machine, the virtual machine goes down (no matter whether I use & or not).

How can I keep it running after I switch off my local machine?

3 Answers 3

1

Try: (nohup VBoxSDL --startvm vm1 &) &

I believe the use of the brackets should result in a new shell being spawned to run the commands within them. This shell is then dis-associated from your own through the use of the &.

As an alternative if you use bash as your shell try running 'disown -h' after the command to start the VM. This is a shell built in function which should also dis-associate the running process from your current shell.

1
  • Alternatively: nohup VBoxSDL --startvm vm1 </dev/null >/dev/null 2>&1 &
    – jlliagre
    Sep 22, 2010 at 12:48
1

On the host of virtualbox

$ nohup VBoxHeadless --startvm centos5.6 &

or

$ nohup VBOxManage startvm centos5.6 --type headless &

Then logout.

Login again and check whether it is still running.

$ VBoxManage list runningvms
"centos5.6" {d46f4510-c95e-4000-b92e-2dc67437174e}

Now it should be running when you are not logged in. Let's say that this virtualbox is named as virtualbox.mydomain.com. Then, from a remote machine

$ ssh [email protected]
[email protected]'s password: 
Last login: Wed Jun 22 19:57:31 2011
3
  • @Daniele did this work?
    – hookenz
    Jun 23, 2011 at 3:38
  • Yes, it worked. The manual says that using VBoxHeadless is better for dealing with error messages etc. Jun 26, 2011 at 5:31
  • Sometimes it seemed to work without the nohup or &. Some commands do this by automatically doing the nohup or &. But it was more consistent with both. After the &, you mention that your prompt disapears. This is normal. Wait till nohup message says that it is appending the output to the nohup. Then, hit Return. This should give you back the prompt ($ or #), then you logout or close down the shell. (But, of course, you don't "power down" the host machine!) Jun 26, 2011 at 6:39
0

Perhaps use screen instead.

You must log in to answer this question.