📜 ⬆️ ⬇️

VirtualBox. Convenient switching between Host and Guest

Those who work as an admin and are engaged in tech support for users in large offices often face the need to keep their Windows machine along with their favorite OS - in this case Debian GNU / Linux. Tasks forcing to install Windows can be different. Means too: someone puts VMWare, someone qemu, I use VirtualBox. In general, virtual machines now surprise no one. I want to share with people a small, but very comfortable trick.

VirtualBox, like most modern VMs, can work in the so-called headless mode, that is, without a graphical shell. In this case, VRDP is used to access the guest OS console.
What I do not like in the default scheme of using a virtual machine. In the process, sometimes you have to restart the X. And, as a result of this, the virtual machine is dying. Then it is needed again, we are launching it again, waiting for the Windows to boot up - rather dreary. To solve this problem, I did the following. I added the following lines to the /etc/rc.local file:

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


What are these lines doing? First, VirtualBox itself starts up in headless mode with a WinXP image. At the same time, VRDP is only binded to the local address 127.0.0.1 - so that it was impossible to connect to the face of the myrtle machine from the outside. Then the second copy of the X server on the eighth console starts. And finally, in the environment of the X-server just launched, the VRDP client is launched in full-screen mode and connected to the already running machine.

What I got in the end.

')
Thus, you can run not one but several guest systems and hang their muzzles on different consoles (VBoxHeadless can change the port to which it is bound). 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.

Ps. Published from the sandbox, please do not kick with your feet. But healthy criticism, of course, is always welcome;)

Source: https://habr.com/ru/post/63728/


All Articles