Microsoft and Canonical have been working for some time to make Ubuntu and Windows play nice with each other. Ubuntu was the first distribution supported in the Windows Subsystem for Linux, and now an Ubuntu image is available through Hyper-V Quick Create, which offers three-click creation of Virtual Machines.
The system image has Ubuntu Desktop 18.04 LTS configured and ready to go, and this showcases some of the other Linux integration work that Microsoft has been doing. The Hyper-V virtual machine client, Virtual Machine Connection, has two ways of working. The normal way is to display the output of the virtual video card that the virtual machine uses and, similarly, to emulate PS/2 mouse and keyboard input, as if the client were the physical hardware. This works with any operating system (the virtual video card supports rudimentary modes like VGA and the text mode used by DOS; it can also support high-resolution graphics modes when used with a suitable display driver). But it is relatively slow and inflexible.
The other way, used automatically with modern Windows VMs, is “Enhanced Session Mode.” In an Enhanced Session, the virtual machine transmits a variation of RDP (Remote Desktop Protocol, Microsoft’s protocol for Windows’ Remote Desktop features) directly to the hypervisor, which then delivers it to the Hyper-V client. Enhanced Sessions have a number of advantages: you can resize the client window, and the VM is notified of the change of resolution; you can copy and paste between the virtual machine and the host; there’s automatic sharing of folders between guest and host; and the mouse doesn’t get trapped inside the client window.
The drawback to Enhanced Sessions is that they need the guest operating system to understand them. Even with Windows VMs, the early parts of the boot process don’t use RDP, because the Hyper-V UEFI firmware and Windows boot loader don’t support RDP, they only support (virtual) VGA graphics. Windows loads and switches to RDP shortly before showing the login screen.
Traditionally, Linux virtual machines have not supported Hyper-V’s RDP Enhanced Sessions at all. But that’s no longer the case today: Microsoft worked with the XRDP open source project to bring Hyper-V RDP support to Linux. When used with the right kernel—it needs to have support for Hyper-V’s communications channel, VMBus, to send data between the guest and the host—Linux machines can get the same Enhanced Session experience.
The Ubuntu Desktop system image is already set up and configured to support RDP and Enhanced Sessions. It includes both a kernel and version of XRDP with the additional Hyper-V support built-in, and it offers all the same Enhanced Session benefits as Windows has enjoyed. The result is a much more pleasant desktop experience within the Linux environment.