Closing GUI session while running a virtual machine - Virtual Box

How could we close GUI session in Virtual Box without shutting down the virtual machine? I have a lot of Linux instances and I only need to connect to one of them.


Solution 1:

Edit: VirtualBox keeps getting better and better! Since VirtualBox 5.0, there is now an extra dropdown menu next to the Start button with an even better option: Detachable Start! It is a hybrid start option where they run the VM process in the background, and simply display a headless VM client that you can easily close.

Screenshot of VirtualBox v5.1.6 Start Option: Detachable Start

Well, almost easily... closing the window that appears will result in the same dialog box asking you if you want to save state, send the shutdown signal, or just power it completely off... no option to just close the window. That said, there is an option in the menu above to close the window only: Machine > Detach GUI.

Screenshot of VirtualBox v5.1.6 menu: Machine > Detach GUI

Since this option is somewhat experimental (like no 3D acceleration), they may not have fully fleshed out the feature yet. We might see a keybinding + option in the close dialog once they are done!

If you still prefer the shortcut, holding SHIFT down and clicking Start will continue to work to run the VM in headless mode. Since they have developed a headless VM client, you will also be able to click Show to see the VM.

Screenshot of VirtualBox v5.1.6 toolbar: Show button


This has already been answered already, but...

With Virtualbox 4.2 and later, there is a quiet little option to start the VM in headless mode. Simply select your VM, then while holding SHIFT down, click Start. This will run the VM in headless mode. Note that there is still no way to "detach" from the VM in GUI mode, but you can suspend the VM with Save State and restart in headless mode.

Better yet, only run in headless mode and use RDP/VNC to manage. phpVirtualBox is a decent web interface to remotely manage VirtualBox instances.

Source: https://blogs.oracle.com/fatbloke/entry/creating_and_using_vm_groups

Solution 2:

As of VBox 5.0 you can close the window and it will prompt you for action including "run in background"