Microsoft Hyper-V is a hypervisor that runs on Windows Operating Systems including Windows 11. It allows you to run multiple operating systems on the same physical computer. Hyper-V is a type 1 hypervisor, which means that it runs directly on the hardware of the physical computer. This makes it more efficient than type 2 hypervisors like VirtualBox and VMware, which run on top of an operating system.

Hyper-V can be used to run a variety of operating systems as guests, including Windows, Linux, and FreeBSD. It can also be used to run virtual machines that are hosted on other hypervisors, such as VMware vSphere and VirtualBox. Hyper-V is a powerful tool that can be used to improve the efficiency and flexibility of your IT infrastructure, or even your laptop.

WSL2, or Windows Subsystem for Linux 2, is a new version of WSL that uses a real Linux kernel. This means that WSL2 is more compatible with Linux applications and can run them faster than WSL 1. WSL2 is accessible, however, installing a geust OS on Hyper-V is more efficient than working with WSL2, as WSL 2 a type 2 hypervisor that runs on top of Windows. However, Hyper-V is also more difficult to use than WSL2.

I have already installed several distributions with WSL 2, but I feel none of them meet my requirment in regards to the performance. Working with a WSL2 with a GUI is not an easy job! Thus, installing guests on a Hyper-V seems the very step for me.

It is straightforward to install an Oracle Linux 9 on Hyper-V, however, the option for Enhancement Session Mode was not available upon I logged on. Enhanced session mode in Hyper-V is a feature that allows you to connect to a virtual machine using the Remote Desktop Protocol (RDP) and have a more interactive experience. With enhanced session mode, the user can resize the virtual machine window, copy and paste text between the host and guest, and access local devices and resources from the guest. I found without the Enhancement Session Mode, I could hardly move my mouse cursor in Gnome, which is annoying. So, let’s do some research.

There is a Github repo that works for RHEL 8 to enable enhancement session mode. Though it is not compatible with Oracle Linux 9, I only had to do some minor adjustment. As I have already enabled the Intel VT-x and Hyper-V on my machine, the first step is to add myself to the Hyper-V Administrators group.

1net localgroup "Hyper-V Administrators" "<USERNAME>" /add

for example,

1net localgroup "Hyper-V Administrators" "user" /add

If you do not know your user name, you can query it through

1echo $env:Username

Or check out the folder under path “C://User”. Then, install some necessary packages to enable RDP.

1sudo dnf install -y hyperv-tools
3echo "hv_sock" | tee -a /etc/modules-load.d/hv_sock.conf > /dev/null
4su user
5sudo dnf install -y epel-release
6sudo dnf install -y xrdp xrdp-selinux

When loading the Hyper-V kernel module, I had to switch to root user as I could not sudo it on my machine. And after loading the kernel module, I switch back to my normal user. ONLY working as a root user when it is ABSOLUTELY NEEDED.

Then, enable the services,

1systemctl enable xrdp
2systemctl enable xrdp-sesman

After that, we configure the installed XRDP ini files. You can also use vim to edit the file “/etc/xrdp/xrdp.ini” directly, but don’t forget to create a backup in case something goes unexpected.

 1# use vsock transport.
 2sed -i_orig -e 's/port=3389/port=vsock:\/\/-1:3389/g' /etc/xrdp/xrdp.ini
 3# use rdp security.
 4sed -i_orig -e 's/security_layer=negotiate/security_layer=rdp/g' /etc/xrdp/xrdp.ini
 5# remove encryption validation.
 6sed -i_orig -e 's/crypt_level=high/crypt_level=none/g' /etc/xrdp/xrdp.ini
 7# disable bitmap compression since its local its much faster
 8sed -i_orig -e 's/bitmap_compression=true/bitmap_compression=false/g' /etc/xrdp/xrdp.ini
 9# rename the redirected drives to 'shared-drives'
10sed -i_orig -e 's/FuseMountName=thinclient_drives/FuseMountName=shared-drives/g' /etc/xrdp/sesman.ini

Then, change the “allowed_users”

1# Change the allowed_users
2echo "allowed_users=anybody" > /etc/X11/Xwrapper.config

and open port 3389 which is by-default for the RDP,

1# Open port
2firewall-cmd --add-port=3389/tcp --permanent
3firewall-cmd --reload

Then reboot the guest OS


Now, you should see the Enhancement Session Mode on the Hyper-V manager! With Enhancement Session Mode enabled, the GUI seems much better than before. This method should also work for RHEL 9. If you are working with RHEL 8 or Oracle Linux 8, you can just follow the Github repo as it gives more detailed information!