Cookie
Electronic Team uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy. Click here to learn more.

Hyper-V Enhanced Sessions Linux

Olga Weis Olga Weis Jul 8, 2021

While working with USB in Hyper-V, you may face some problems. For example, Enhanced sessions give you many options, but how to work with Enhanced sessions on linux? In the following article, we’ll discuss how to configure Hyper-V virtual machines (running Ubuntu 20.04 desktop) that have enhanced sessions enabled.

Hyper-V Windows 10 1909 Wizard supports 18.04 and 19.10 versions of Ubuntu (at the time of this article’s publication). However, these restrictions are easy enough to dismantle if the tools are installed manually.

Follow the below steps to learn how this is done...

Create The Virtual Machine (VM)

Step 1: Open “Hyper-V Manager”, and click “New” (which is found on the right panel)

Step 2: Select “Virtual Machine”

Hyper-V Manager

Step 3: Once a new window pops up, create a name (of your choice) for the Virtual Machine

Step 4: Click “Next” once a name is chosen

Virtual Machine

Step 5: On the next page that appears, ensure UEFI is enabled by selecting: “Generation 2”

Step 6: Once enabled, click “Next”.

Generation 2

Step 7: Decide on your “Startup Memory allocations”. It is recommended to use up to 8 GB of memory to ensure the user-experience is efficient and enjoyable. However, a minimum of 4 GB is required.

Step 8: Click “Next”

Startup Memory allocations

Step 9: After choosing at least one network interface (which allows Ubuntu to download updates -and/or drivers- during installation)... Click “Next”

network interface

Step 10: Decide on your preferred disk size (the installation wizard defaults at a 127 GB disk), then click “Next”

Virtual Hard Disk

Step 11: Choose the ISO downloaded from the Ubuntu website

Step 12: Click “Finish”

Instalation Options

Disabling Secure Boot

Because Ubuntu cannot support “Secure Boot”, it will need to be disabled prior to starting up a VM. Follow the steps below to disable “Secure Boot”:

Step 1: After choosing the desired VM, click “Settings” (located on the right-side panel as shown below)

Hyper-V Manager

Step 2: Click “Security” (located in the left panel)

Step 3: Ensure “Enable secure boot” is left unchecked

Step 4: Click “OK”

Enable secure boot

Step 5: After making sure to select “don’t enable auto-login”, it’s time to start up the virtual machine and run the OS setup. If “don’t enable auto-login” isn’t configured, the enhanced session won’t function.

From there, it’s time to install the Microsoft-provided “linux-tools”.

Setting Up An Enhanced Session

Step 1: Open a terminal within Ubuntu

Step 2: Download the setup script and run it

wget
https://raw.githubusercontent.com/Microsoft/linux-vm-tools/master/ubuntu/18.04/install.sh

sudo chmod +x install.sh

sudo ./install.sh
sudo chmod +x install.sh sudo ./install.sh

Step 3: If an error pops up after installing the script, open “/etc/xrdp/xrdp.ini (sudo required)” in your preferred editor.

Step 4: Once “/etc/xrdp/xrdp.ini (sudo required)” is opened in the editor, edit or add the lines shown below:

port=vsock://-1:3389
use_vsock=false


Step 5: Save the file and shutdown the VM

Step 6: From Windows, open a PowerShell prompt with admin privileges and type:

Set-VM-VMName <your_vm_name>-EnhancedSessionTransportType HvSocket

The “<your_vm_name>” = the name of the desired Virtual Machine (the name that was created during the “Create The Virtual Machine” section)

Step 7: Start up the virtual machine, and you’ll quickly redirect to the XRDP login screen

XRDP login screen
logo USB Network Gate
#1 at Networking
USB Network Gate
Share USB over Ethernet on Windows
4.7 rank based on 372 + users
Get a download link for your desktop
Submit your email address to get a link for quick download on your desktop and get started!
or