Enhanced session mode increases the integration of a guest OS with the host, thereby greatly improving the user experience. For this purpose, however, you have to configure XRDP using a shell script after installing Linux. In addition, you must prepare the virtual machine via PowerShell.

The integration services for Hyper-V have been included in several versions of Ubuntu. They support, for example, time synchronization with the host or live migration of the VM, but they are not enough to activate enhanced session mode.

In contrast to simple mode, enhanced session mode allows copy/paste between host and guest. This means that files can also be exchanged between the two systems in this way.

Another significant advantage is that you can control the resolution of the guest OS right at startup via the virtual machine. In simple mode, on the other hand, you have to adjust the screen size from within the guest OS using Linux tools.

Configure VM and install Ubuntu

Extended session mode always requires a generation 2 VM, regardless of the guest OS.

When installing Ubuntu, you should disable Secure Boot in the VM's settings; otherwise, the setup will hang. The allocation of resources such as vCPU or vRAM is the same as when installing on physical hardware.

Disable Secure Boot for the VM in the Hyper V Manager

Disable Secure Boot for the VM in the Hyper V Manager

In the Ubuntu setup, in our example of version 20.04, you should not activate the automatic login, but rather force the use of a password. If you have made the wrong selection here, you can change this later in simple session mode via the Ubuntu settings.

When installing Ubuntu you should not select automatic login

When installing Ubuntu you should not select automatic login

Install XRDP and XORGXRDP

Once you have set up Ubuntu in the VM and it boots successfully, you can start configuring enhanced session mode. This requires the RDP server xrdp as well as XORGXRDP.

The download and installation of these components can be simplified with the help of a shell script. This can be obtained via a URL based on the following pattern:

https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/<Version>/install.sh

For 20.04, this would be the address:

https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/20.04/install.sh

Normally, even the minimal installation includes a web browser so you can load and save the script there. Alternatively, wget can be used on the command line.

After downloading install.sh, you need to make it executable in the user's download folder:

chmod +x install.sh
Download prepare and run the install script

Download prepare and run the install script

Then, run this:

sudo ./install.sh

If it is successful, it will prompt the user to restart Ubuntu.

After running install.sh you have to restart Ubuntu in the VM

After running install.sh you have to restart Ubuntu in the VM

Configure host and VM

The next step is to make sure that the Hyper-V host is configured for extended session mode. You can find the corresponding option in the Hyper-V Manager in the host's settings.

Extended session mode must be enabled in the host settings

Extended session mode must be enabled in the host settings

The current status of this setting can be determined using PowerShell, as follows:

Get-VMHost | select Name, EnableEnhancedSessionMode

If required, you can enable this option with the following:

Set-VMHost -EnableEnhancedSessionMode $true

Finally, change the transport type for enhanced session mode from the standard VMBus to HvSocket.

Set-VM -VMName <Name-of-VM> -EnhancedSessionTransportType HvSocket

After executing this command, restart Ubuntu. You should then get a dialog box in the VM window to select the screen resolution. This indicates that enhanced session mode is now available.

After restarting the VM the display options for enhanced session mode should appear

After restarting the VM the display options for enhanced session mode should appear

If the font size in the guest OS is too small, you can change it in a terminal window with

gsettings set org.gnome.desktop.interface text-scaling-factor 1.5

Subscribe to 4sysops newsletter!

In this example, the scaling factor is 1.5 and can be changed as needed.

avatar
0 Comments

Leave a reply

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

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account