Definitive guide for enabling Hyper-V Enhanced Session mode for an Ubuntu guest?

I’m going through the motions of migrating a virtual machine of Linux Mint to a guest of Hyper-V on Windows 11. I hope the community can forgive me posting here regarding a third-party flavor of Ubuntu, but it seems with regards to my question, this is a problem shared throughout the Ubuntu (and Linux generally?) communities.

To be able to access nice features like sharing clipboard & devices and enabling audio, one has to use the VM in an Enhanced Session mode. I’ve already made sure to follow the Microsoft guide on Ubuntu guest compatibility by installing the linux-azure kernel which provides a basic level of guest services to the virtual machine, and which I believe is confirmed by the Hyper-V property Heartbeat : OkApplicationsUnknown. However, the Enhanced Session capability remains unavailable and searching seems to indicate that enabling it is largely an undocumented process.

Just as I was writing this topic, the forum software flagged this topic apparently written by a Microsoft employee in 2018 announcing Microsoft’s commitment to work more closely with Ubuntu/Canonical to bring better compatibility to Hyper-V. The blog post they linked to (original, archived) contained a link to a now-archived GitHub repository with scripts for both Ubuntu 16.04 and 18.04 that will install some (likely outdated) linux-related packages, the xrdp package, and then make several configuration changes. It seems that this script should be considered invalid for current distributions, given the archived status of the repository and the README message that recommends either using a Quick Create image from the Hyper-V gallery, or using WSL on Windows. Neither option is terribly helpful for the task of making a current Ubuntu-based virtual machine Enhanced Session-capable.

Returning to the original blog post, an update was added to the top stating that this feature (Enhanced Session mode for Linux VMs?) was considered generally available, and to see this newer blog post which essentially tells you to just use the previously-mentioned Quick Create feature to make a brand new VM.

My ultimate question is, do we have any official guide for enabling Enhanced Session capabilities for Ubuntu within Hyper-V?

Note: If anyone feels this post violates community guidelines, you’re welcome to explain below and I’ll attempt to remedy the issue.

Resources

Moved to the Lounge for two reasons:

  1. Linux Mint is off-topic here for the support category and
  2. This seems an interesting topic for a more general discussion

Thanks for sharing with the community.

2 Likes

Thank you for keeping me organized, I hope this ends up being beneficial for other people. I think I’d like to write a wiki page here at some point once I can give a more definitive overview of the process and recommended steps.

2 Likes

I want to keep this topic alive and add some additional information:

At this point in the research, I understand how the disk image for the virtual machine is built. Just now, I also found out how the Hyper-V machine configuration is defined in the QuickCreate (QC) images: this is set in the HVQC image definition files (example).

Something that still isn’t totally clear to me is what the EnhancedSessionTransportMode option does. A Microsoft blog post describing the process of enabling Enhanced Session describes it as using a socket (HvSocket) to achieve high performance and support for RDP. I did find this short description of the VMBus and how it fits into the overall architecture of Hyper-V - essentially serving as a communications channel between the host and guest. So it seems that HvSocket is the next iteration of VM communication, and therefor important to have enabled for Enhanced Session.

I can say at this point that I’ve got a very stable and performant Enhanced Session working now on my Mint system. Unfortunately, I did not take very good notes during this process and need to go over tabs, bash history and filesystem changes to reconstruct my steps. I’ll try to construct a general guide and then iterate on it with some testing.