VirtualBox Convenient switching between Host and Guest

    Those who work as an administrator and provide technical support for users in large offices often face the need to keep Windows on their working machine along with their favorite OS - in this case, Debian GNU / Linux. The tasks that force Windows to be installed can be different. Means too: someone puts VMWare, someone qemu, I use VirtualBox. In general, virtual machines do not surprise anyone now. I want to share with people a small but very convenient feint.

    VirtualBox, like most modern VMs, can work in the so-called headless mode, that is, without a graphical shell. In this case, the VRDP protocol is used to access the guest OS console.
    What I don't like about the default virtual machine usage scheme. In the process, sometimes you have to restart X. And, as a result of this, the virtual machine dies. Then it is needed again, we launch it again, we wait when the Windows boots up - rather dreary. To solve this problem, I did the following. I added the following lines to the /etc/rc.local file: What do these lines do. First, VirtualBox itself starts in headless mode with a WinXP image. At the same time, VRDP only binds to the local address - so that it is impossible to connect to the mirt.mashina's face from the outside. Then the second copy of the X-server is launched on the eighth console. And finally, surrounded by the just launched X-server, the VRDP client starts in full-screen mode and connects to the already running machine. What in the end I got.

    su rigid -c "VBoxHeadless -a -s WinXP" &
    X :1 vt08 &
    DISPLAY=":1" rdesktop-vrdp -f localhost &

    • The virtual machine is not tied to my working X-session, you can restart the x as you like without interrupting the operation of the virtual machine.
    • The muzzle of Windows is drawn on a separate console in full screen mode. It is possible to quickly switch between Windows and Dwarf sessions with standard combinations: Ctrl-Alt-F7 and Ctrl-Alt-F8

    Thus, you can start not one but several guest systems and hang their faces on different consoles (VBoxHeadless can change the port to which it is bind). In addition, in the same way, you can run guest systems on a separate powerful server, and on your workstation only draw muzzles to them. In general, how much fantasy is enough.

    PS. Published from the sandbox, please do not kick strongly. But healthy criticism, of course, is always welcome;)

    Also popular now: