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 Answers3

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.

xsgordon
  • 121
  • 3
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 yoichi101@virtualbox.mydomain.com
yoichi101@virtualbox.mydomain.com's password: 
Last login: Wed Jun 22 19:57:31 2011
Falcon Momot
  • 24,975
  • 13
  • 61
  • 92
  • @Daniele did this work? – hookenz Jun 23 '11 at 03:38
  • Yes, it worked. The manual says that using VBoxHeadless is better for dealing with error messages etc. – Yoichi Takayama Jun 26 '11 at 05: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!) – Yoichi Takayama Jun 26 '11 at 06:39
0

Perhaps use screen instead.

mr-euro
  • 838
  • 3
  • 14
  • 31