6

I've installed a VirtualMachine to work on the background. I use SSH to control it via terminal. But, sometimes SSH service didn't work properly and I can't access the VirtualMachine outside. All I can do is power it off via VirtualBox GUI. But, I think it's not a good idea to use poweroff, since it's like I pull the power cable out. Is there anyway to show the VirtualMachine after I started it via VBoxHeadless? So, I can turn it off with shutdown command.

1
  • what about VBoxManage controlvm <machine_name> acpipowerbutton command ?
    – g_p
    Jan 29, 2015 at 15:46

2 Answers 2

5

We can not change the video output from headless to local screen after starting a Virtual Box VM in headless mode. But if not configured otherwise there will be an RDP server started automatically at default port 3389 in a headless machine. By this we will have access to that machine's GUI through any RDP-viewer.

In case SSH did not work it is very likely that your RDP server may be inaccessible too. In this case it is not recommended to poweroff or kill a running VM as this may lead to data loss.

In this case a quite convenient and secure workaround is to terminate the headless machine with saving the machine's state. This can also be done from the command line by:

VBoxManage controlvm "<Name of Machine>" savestate

After that we will be able to start the machine in non-headless mode at exactly the saved state from the Virtual Box Manager, or again from command line with:

VBoxManage startvm "<Name of Machine>"

Then we can debug the reason for any previously failed access, or safely shut down the machine.

1
  • Wow, so simple, so powerful... I wonder why I haven't think of, errr... not really a mystery. I wonder why I didn't read about this neat trick before. Jan 30, 2015 at 7:39
2

I was able to do it when I accidentally started a Saved State Normal Start in Headless. I simply saved the headless state again then did a normal start. My first inclination was to ssh into it, but this is much better.

1
  • 2
    Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on AskUbuntu.) Nov 2, 2016 at 17:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .