- How to install Group Policy ADMX templates for OneDrive - Mon, Mar 27 2023
- How to change the PowerShell prompt - Wed, Mar 22 2023
- Trim characters from strings in PowerShell - Tue, Mar 14 2023
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.
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.
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:
For 20.04, this would be the address:
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
Then, run this:
If it is successful, it will prompt the user to restart Ubuntu.
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.
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.
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.
Want to write for 4sysops? We are looking for new authors.