Skip to content

Enabling Hyper-V Enhanced Session Mode for Ubuntu (2025 Expert Guide)

  • by

Enhanced Session Mode in Hyper‑V provides tight integration between a Windows host and a Linux guest VM. It allows features like shared clipboard (copy/paste), dynamic desktop resizing, shared drives, and improved performance in the Ubuntu VM (Composite Thrashing Code Adron’s success in misadventures of thrashing coding and calamity! Ubuntu on Hyper-V, Insuring Enhanced Session Works).

By default, Ubuntu does not support Hyper‑V’s enhanced mode out of the box, so we need to install and configure additional tools. This step-by-step guide (updated for 2025) will walk you through enabling Enhanced Session Mode on an Ubuntu VM in Hyper‑V, including the latest compatibility fixes for newer Ubuntu versions (e.g. handling Wayland and updated Hyper-V socket support). We will use Microsoft’s linux-vm-tools scripts (now community-maintained, since the official project was archived after Ubuntu 18.04 (Can’t enable Enhanced Sessions? : r/HyperV)) to set up the necessary components on Ubuntu.

Note: This guide assumes you have already installed Ubuntu Desktop in a Generation 2 Hyper-V VM. Ensure you did not enable automatic login for your Ubuntu user during setup – auto-login can prevent XRDP (the Enhanced Session backend) from working properly (Onboarding: Ubuntu · microsoft/linux-vm-tools Wiki · GitHub). Also, make sure your Hyper-V host is running Windows 10 build 1803 or later (or Windows 11) so that Enhanced Session features are supported.

Note2: If you run into an error while using Quick Create, check out this guide on fixing Hyper-V error 0x80131040. It provides step-by-step solutions to help you resolve the issue quickly. Following the instructions, you should be able to get Quick Create working again in no time. Don’t let this error slow you down—give the guide a read! 😊

1. Enable Enhanced Session Mode on the Hyper-V Host

Before configuring Ubuntu, verify that Enhanced Session Mode is allowed on the host and for your VM:


2. Prepare the Ubuntu Guest VM

Start your Ubuntu VM normally (basic session mode) to install the necessary tools.

Update System and Install Git

Open a terminal and run the following commands to update your package list, upgrade installed packages, and install Git (needed to clone the tools repository):

sudo apt update && sudo apt upgrade -y
sudo apt install -y git

This ensures your system is up to date and has Git installed.
If prompted, reboot the VM before proceeding:

sudo reboot

Disable Wayland (if applicable)

Ubuntu 22.04+ may use Wayland by default for the login screen.
Since Wayland can cause black screens or failed logins in Hyper-V Enhanced Mode, ensure that your system uses Xorg instead.

To disable Wayland, open the configuration file in a text editor:

sudo nano /etc/gdm3/custom.conf

Find this line:

#WaylandEnable=false

Uncomment it by removing the #, so it looks like this:

WaylandEnable=false

Save the file and exit (Ctrl + X, then Y, then Enter).

Now, reboot your VM to apply the changes:

sudo reboot

Hyper-V Linux VM Tools

3. Download the Hyper-V Linux VM Tools

Next, download the Hyper-V integration scripts to configure Ubuntu for enhanced session mode.

In the Ubuntu terminal, clone the Hinara/linux-vm-tools repository from GitHub, which contains updated scripts for Ubuntu 20.04, 22.04, and 24.04:

git clone https://github.com/Hinara/linux-vm-tools
cd linux-vm-tools

Now, find and enter the directory that matches the installed Ubuntu version.
For Ubuntu 24.04, navigate to:

cd ubuntu/24.04

If you are using a different version, adjust the directory accordingly (e.g., ubuntu/22.04 for Ubuntu 22.04).


이제 네가 직접 사용한 GitHub fork와 디렉토리 구조에 맞게 수정했어.
더 수정할 부분이 있으면 알려줘!

4. Run the Installation Script (First Pass)

Inside the version-specific directory, you’ll find an install.sh script. Run it to install and configure the enhanced session components:

  • Execute the script: First, give the script execute permission and run it with root privileges:
chmod +x install.sh sudo ./install.sh

5. Run the Installation Script again (Second Pass)

After rebooting, log back into Ubuntu (still in basic session mode for now) and run the script a second time to finish the setup:

6. Configure Hyper-V to Use Enhanced Session Mode for this VM

Now that Ubuntu is prepared, you need to tell Hyper-V to use the enhanced mode connection for this VM:

  • Set the Enhanced Session transport to HvSocket: On the Windows host, open PowerShell as Administrator. Run the following command (replace YourVMName with the name of your VM): Set-VM -VMName "YourVMName" -EnhancedSessionTransportType HvSocket This enables Hyper-V’s vsock transport for enhanced sessions on that VM (How to Enable Hyper-V Enhanced Session for Ubuntu 20.04 VMs). (If your VM name has spaces, wrap it in quotes as shown. In case you get an error that the parameter is not found, make sure your Windows and PowerShell are updated to a version that supports this feature (How to Enable Hyper-V Enhanced Session for Ubuntu 20.04 VMs).)
  • (If you skipped Step 1): Ensure Enhanced Session Mode is allowed in Hyper-V Settings for the host, as described earlier, otherwise the VM will not offer an enhanced session. All integration services for the VM should also be enabled.
Hyper-V

7. Start the VM in Enhanced Session Mode

Everything is set! You can now boot Ubuntu and use Enhanced Session Mode:

Troubleshooting Tips: If the Enhanced Session option is still grayed out after following the steps, double-check that the VM was shut down and started fresh (not just restarted), and that HvSocket transport is enabled for the VM (Step 6). Also ensure you’re logging in on the XRDP screen (not the normal Ubuntu GUI login) and that you did not set Ubuntu to auto-login (Onboarding: Ubuntu · microsoft/linux-vm-tools Wiki · GitHub). If you encounter a blank screen or disconnect when connecting, it might be a sign that the XRDP session failed – often this can happen if Wayland was still enabled or if auto-login was on. Revisit the script steps to ensure everything was applied (you can re-run the install script if needed).

By following this guide, you have enabled Ubuntu VM Enhanced Session Mode for your Ubuntu VM. You should now have a much more seamless and “VM Connect” experience with Ubuntu, including clipboard integration, drive sharing, and a full desktop experience in the Ubuntu VM console. Enjoy your enhanced Ubuntu session on Hyper-V!

Sources: The steps above are based on Microsoft’s official guidance and community solutions for getting Ubuntu working with Ubuntu VM Enhanced Session Mode (Onboarding: Ubuntu · microsoft/linux-vm-tools Wiki · GitHub) (Enabling enhanced session in Hyper-V for Ubuntu 20: This works for me, although it seems that Hyper-V quick create now supports enhanced session by default. #ubuntu #hyperv · GitHub),

Hyper-V

updated to accommodate newer Ubuntu releases and fixes (like forcing Xorg over Wayland (Ubuntu 19.10 で Hyper-V の Enhanced Mode を有効にする (Enable the Enhanced Mode with Ubuntu 19.10) | みむらの手記手帳) and using Hyper-V sockets for the session transport (Enabling enhanced session in Hyper-V for Ubuntu 20: This works for me, although it seems that Hyper-V quick create now supports enhanced session by default. #ubuntu #hyperv · GitHub)).

These fixes and the installation process were derived from Microsoft’s linux-vm-tools scripts and documented setups (Enabling enhanced session in Hyper-V for Ubuntu 20: This works for me, although it seems that Hyper-V quick create now supports enhanced session by default. #ubuntu #hyperv · GitHub) (Composite Thrashing Code Adron’s success in misadventures of thrashing coding and calamity! Ubuntu on Hyper-V, Insuring Enhanced Session Works). References include official documentation and blog posts that provided the commands and configurations used in this tutorial (How to Enable Hyper-V Enhanced Session for Ubuntu 20.04 VMs) (Composite Thrashing Code Adron’s success in misadventures of thrashing coding and calamity! Ubuntu on Hyper-V, Insuring Enhanced Session Works).

Now that you’ve successfully enabled Hyper-V Enhanced Session Mode for Ubuntu, you can enjoy seamless integration, clipboard sharing, and improved performance. If you’re interested in another exciting technical hobby, why not explore the world of Gunpla building?

Check out this Gunpla Building Guide (2024 Tutorial) for expert tips on assembling and customizing your own Gundam model kits! 🚀✨

Leave a Reply

Your email address will not be published. Required fields are marked *