Create Ubuntu 24.04.2 VM in Hyper-V, with "Enhanced Session" RDP support (Windows 11, xrdp, development)

To setup an Ubuntu 24.04.2 development Hyper-V VM, with built-in "Enhanced Session" + Remote Desktop Protocol (RDP) support (until it's available in Hyper-V's "Quck Create"): Create Hyper-V VM Configure VM for "Enhanced Session", allow nested virtualisation Start VM, install Ubuntu XRDP Setup Optional, but really useful setup Fix Xrdp slow performance Connect to VM Create Hyper-V VM Create VM ("New" > "Virtual Machine"): # Specify Name and Location Name: Ubuntu 24.04 [Next] # Specify Generation Generation: 2 [Next] # Assign Memory Startup memory: 4096 [Next] # Configure Networking Connection: Default Switch [Next] # Connect Virtual Hard Disk Create a virtual hard disk: Name: Ubuntu 24.04.vhdx Size: 256GB [Next] # Installation Options Install an operating system from a from bootable CD/DVD-ROM: Image file: ubuntu-24.04.2-desktop-amd64.iso [Finish] DO NOT START VM YET Configure VM (Right-click "Ubuntu 24.04" > "Settings..."): # Change boot order (boot from HDD before Network) Firmware DVD Drive HDD Network # Necessary to boot Ubuntu Security Enable Secure Boot Template: Microsoft UEFI Certificate Authority # Optional Integration Services (Check all) # Optional Checkpoints (Uncheck) Use automatic checkpoints # Optional Automatic Stop Action Shut down the guest operating system [OK] DO NOT START VM YET Configure VM for "Enhanced Session", allow nested virtualisation From admin PowerShell (Right-click "Windows PowerShell" > "Run as administrator..."): # Connect with Enhanced Session Set-VM -VMName 'Ubuntu 24.04' -EnhancedSessionTransportType HvSocket # Allow nested virtualisation (optional) Set-VMProcessor -VMName 'Ubuntu 24.04' -ExposeVirtualizationExtensions $true # Verify - expect 'True' (Get-VMProcessor -VMName 'Ubuntu 24.04').ExposeVirtualizationExtensions Start VM, install Ubuntu Start VM, install with default options, using the latest installer (Update installer if promoted). Note: ❗ Make sure Require my password to log in is checked (this is needed for xrdp) Example Default installation options: Interactive installation Default selection Erase disk and install Ubuntu Restart - Hard-reset VM if you get error: SQUASHFS error: Failed to read block XRDP Setup Install Xrdp + apply Ubuntu 24.04 specific fixes:

Mar 7, 2025 - 08:53
 0
Create Ubuntu 24.04.2 VM in Hyper-V, with "Enhanced Session" RDP support (Windows 11, xrdp, development)

To setup an Ubuntu 24.04.2 development Hyper-V VM, with built-in "Enhanced Session" + Remote Desktop Protocol (RDP) support (until it's available in Hyper-V's "Quck Create"):

  1. Create Hyper-V VM
  2. Configure VM for "Enhanced Session", allow nested virtualisation
  3. Start VM, install Ubuntu
  4. XRDP Setup
  5. Optional, but really useful setup
  6. Fix Xrdp slow performance
  7. Connect to VM

Create Hyper-V VM

Create VM ("New" > "Virtual Machine"):

# Specify Name and Location
Name: Ubuntu 24.04
[Next]

# Specify Generation
Generation: 2
[Next]

# Assign Memory
Startup memory: 4096
[Next]

# Configure Networking
Connection: Default Switch
[Next]

# Connect Virtual Hard Disk
Create a virtual hard disk:
  Name: Ubuntu 24.04.vhdx
  Size: 256GB
[Next]

# Installation Options
Install an operating system from a from bootable CD/DVD-ROM:
  Image file: ubuntu-24.04.2-desktop-amd64.iso

[Finish]

DO NOT START VM YET

Configure VM (Right-click "Ubuntu 24.04" > "Settings..."):

# Change boot order (boot from HDD before Network)
Firmware
  DVD Drive
  HDD
  Network

# Necessary to boot Ubuntu
Security
  Enable Secure Boot
  Template: Microsoft UEFI Certificate Authority

# Optional
Integration Services
  (Check all)

# Optional
Checkpoints
  (Uncheck) Use automatic checkpoints

# Optional
Automatic Stop Action
  Shut down the guest operating system

[OK]

DO NOT START VM YET

Configure VM for "Enhanced Session", allow nested virtualisation

From admin PowerShell (Right-click "Windows PowerShell" > "Run as administrator..."):

# Connect with Enhanced Session
Set-VM -VMName 'Ubuntu 24.04' -EnhancedSessionTransportType HvSocket

# Allow nested virtualisation (optional)
Set-VMProcessor -VMName 'Ubuntu 24.04' -ExposeVirtualizationExtensions $true
# Verify - expect 'True'
(Get-VMProcessor -VMName 'Ubuntu 24.04').ExposeVirtualizationExtensions

Start VM, install Ubuntu

  1. Start VM, install with default options, using the latest installer (Update installer if promoted).

    Note:

    1. ❗ Make sure Require my password to log in is checked (this is needed for xrdp)
    2. Example Default installation options:
      Interactive installation
      Default selection
      Erase disk and install Ubuntu
    
  2. Restart - Hard-reset VM if you get error: SQUASHFS error: Failed to read block

XRDP Setup

Install Xrdp + apply Ubuntu 24.04 specific fixes: