Skip to content

How to Install Ubuntu in Hyper-V

Install Ubuntu in Hyper-V the right way: build a Generation 2 VM, handle Secure Boot with the right template, enable Enhanced Session, and fix the resolution.

SDSysadmin Desk October 18, 2026 7 min read
Photographic illustration for How to Install Ubuntu in Hyper-V: physical servers with layered virtual machine windows

Running Ubuntu in Hyper-V is a clean way to get a Linux box on a Windows machine without dual-booting or buying hardware. Modern Ubuntu boots happily as a Generation 2 VM, the integration drivers ship in the kernel, and once Enhanced Session Mode is set up you get a resizable desktop with a shared clipboard.

There’s one gotcha that catches almost everyone, and it’s worth stating up front: Hyper-V’s default Secure Boot template is built for Windows and won’t trust Ubuntu’s bootloader. Leave it on the default and your VM won’t boot. Switch it to the Microsoft UEFI Certificate Authority template and Ubuntu starts fine with Secure Boot still on.

This walks through building the VM correctly, getting past that Secure Boot issue, finishing the install, and fixing the cramped default resolution so the desktop is actually usable.

Before you start

What you need

  • Hyper-V enabled on Windows 11 Pro/Enterprise or Windows Server
  • An Ubuntu ISO (LTS release recommended for stability)
  • A virtual switch for network access (the Default Switch works for NAT/internet)
  • About 4 GB RAM and 25 GB+ disk free for a desktop install
  • Enough host CPU/RAM to spare 2 vCPUs and the VM's memory

If Hyper-V isn’t enabled yet, that’s a quick job on its own — see installing Hyper-V on Windows 11 Pro. And if you’re not sure whether to build Generation 1 or 2, the short answer below is Generation 2, but Generation 1 vs Generation 2 covers the full reasoning.

Step 1: Create a Generation 2 VM

In Hyper-V Manager, choose Action → New → Virtual Machine and walk the wizard:

  1. Name the VM (e.g. Ubuntu-LTS).
  2. Generation: choose Generation 2. This is the important one — UEFI firmware, faster boot, better device support. Generation can’t be changed after creation, so get it right now.
  3. Memory: 4096 MB for a desktop. Leave Dynamic Memory ticked so it only uses what it needs.
  4. Networking: connect to Default Switch for instant NAT-based internet, or an external switch if the VM should appear on your LAN.
  5. Disk: create a new VHDX, 25 GB or more. It’s dynamically expanding by default, so it grows as you use it.
  6. Installation: point it at your Ubuntu ISO.

Prefer PowerShell? This creates the same VM in one block:

New-VM -Name "Ubuntu-LTS" -MemoryStartupBytes 4GB -Generation 2 `
  -NewVHDPath "D:\VMs\Ubuntu-LTS.vhdx" -NewVHDSizeBytes 40GB `
  -SwitchName "Default Switch"

Add-VMDvdDrive -VMName "Ubuntu-LTS" -Path "D:\ISOs\ubuntu.iso"

Step 2: Fix Secure Boot before you start the VM

This is the step that saves you a frustrating “no bootable device” or boot failure. With the VM created but not started, open its Settings → Security.

You’ll see Secure Boot enabled with the template set to Microsoft Windows. That template only trusts Windows boot components, so Ubuntu’s signed bootloader (shim) is rejected. Change the template:

  • Set Template to Microsoft UEFI Certificate Authority.

That template includes the certificate Ubuntu’s bootloader is signed against, so the VM boots with Secure Boot still enabled. Don’t disable Secure Boot unless you have a reason to — switching the template is the correct fix.

In PowerShell, the same change is one command:

Set-VMFirmware -VMName "Ubuntu-LTS" -SecureBootTemplate "MicrosoftUEFICertificateAuthority"

To confirm the boot order points at the DVD first for installation:

Set-VMFirmware -VMName "Ubuntu-LTS" -FirstBootDevice (Get-VMDvdDrive -VMName "Ubuntu-LTS")

Step 3: Set the VM resources

While you’re in Settings, give the VM what it needs for a smooth install:

Recommended Ubuntu VM settings

Generation 2 (UEFI)
Secure Boot template Microsoft UEFI Certificate Authority
Startup RAM 4096 MB (desktop) / 2048 MB (server)
Dynamic Memory Enabled, with a sensible minimum and maximum
Virtual processors 2 or more
Disk (VHDX) Dynamically expanding, 25–40 GB
Network Default Switch (NAT) or an external switch

Two vCPUs make the installer and desktop noticeably more responsive than one. Dynamic Memory means the VM gives RAM back to the host when idle, which is handy when you’re running other things alongside it.

Step 4: Install Ubuntu

Start the VM and connect to it. The Ubuntu installer loads from the ISO. From here it’s the standard Ubuntu flow:

  1. Choose Try or Install Ubuntu.
  2. Pick your language and keyboard.
  3. Select a normal or minimal installation and choose whether to download updates during install.
  4. For disk setup, Erase disk and install Ubuntu is correct here — it only touches the VHDX, not your host.
  5. Set your region, create a user account, and let it install.
  6. When prompted, reboot. Remove the ISO so it boots from disk:
Set-VMDvdDrive -VMName "Ubuntu-LTS" -Path $null

Because modern Ubuntu kernels include the Hyper-V integration drivers, networking, storage, and basic mouse/keyboard integration work immediately after install. There’s no separate integration package to chase down the way there was on older Linux guests.

Step 5: Fix the resolution with Enhanced Session Mode

Out of the box, an Ubuntu VM often runs at a small fixed resolution and won’t resize when you stretch the window. The fix is Enhanced Session Mode, which connects over RDP via the VMBus for a resizable desktop, shared clipboard, and better display scaling. It’s automatic for Windows guests; Ubuntu needs setup inside the guest.

The common approach uses xrdp and the Hyper-V tooling. Microsoft provides a setup script, and Ubuntu’s linux-vm-tools route configures xrdp for Enhanced Session. In broad strokes, inside the Ubuntu VM you:

  1. Install and configure xrdp plus the Hyper-V Enhanced Session components.
  2. Shut the VM down.
  3. On the host, set the VM to use Enhanced Session over the HV socket transport:
Set-VM -VMName "Ubuntu-LTS" -EnhancedSessionTransportType HvSocket
  1. Start the VM and reconnect. You’ll get a resolution prompt and a resizable desktop.

If you’d rather skip xrdp and just stop the desktop from being tiny, you can hard-set a resolution in GRUB. Edit /etc/default/grub, set a video mode on the kernel line, then update GRUB:

# In /etc/default/grub, add to GRUB_CMDLINE_LINUX_DEFAULT, e.g.:
#   video=hyperv_fb:1920x1080
sudo update-grub
sudo reboot

Step 6: Snapshot the clean install

Once Ubuntu is installed, updated, and the display is sorted, take a checkpoint in Hyper-V Manager (right-click the VM → Checkpoint). If you later break something experimenting, you can roll back in seconds.

Checkpoint-VM -Name "Ubuntu-LTS" -SnapshotName "Clean install + updates"

A checkpoint is a convenience for quick rollback, not a backup of anything you can’t lose — the same caution that applies to any hypervisor’s snapshots. Keep the checkpoint chain short, since a long stack of differencing disks gets messy over time.

Wrapping up

Ubuntu runs well in Hyper-V once you get two things right: build it as Generation 2, and switch the Secure Boot template to Microsoft UEFI Certificate Authority before first boot. Miss that template change and the VM won’t start; make it and Ubuntu boots with Secure Boot fully on.

After that it’s a normal Ubuntu install. The integration drivers come with the kernel, so networking and storage just work, and Enhanced Session Mode turns the cramped default window into a proper resizable desktop with a shared clipboard. Snapshot the clean state, and you’ve got a Linux lab you can rebuild whenever you want. For more Hyper-V and Linux walkthroughs, browse the virtualization guides.

Frequently asked questions

Should I use Generation 1 or Generation 2 for an Ubuntu VM?

Generation 2 for any modern Ubuntu release. It uses UEFI firmware, boots faster, and supports more memory and modern devices. Ubuntu's current LTS releases boot fine as Generation 2 — just make sure Secure Boot uses the Microsoft UEFI Certificate Authority template, not the default Windows one.

Why won't my Ubuntu VM boot with Secure Boot enabled?

Hyper-V's default Secure Boot template is 'Microsoft Windows', which doesn't trust Ubuntu's bootloader. Switch the template to 'Microsoft UEFI Certificate Authority' in the VM's Security settings, or disable Secure Boot. With the correct template, Ubuntu boots with Secure Boot on.

How do I fix the small, fixed resolution in a Hyper-V Ubuntu VM?

Use Enhanced Session Mode, which gives a resizable desktop over RDP. Ubuntu needs the linux-vm-tools / xrdp setup configured for it. Alternatively, edit the GRUB command line to set a fixed resolution with a video parameter, then update GRUB and reboot.

What is Enhanced Session Mode in Hyper-V?

It's a connection mode that uses RDP over the VMBus to give better display scaling, shared clipboard, audio, and dynamic resolution between host and guest. It's on by default for Windows guests; for Ubuntu it requires extra setup of xrdp and the Hyper-V tools inside the guest.

Does Ubuntu need integration services in Hyper-V?

Modern Ubuntu kernels include the Hyper-V integration drivers (the linux-virtual or linux-azure kernel packages bundle them), so basic integration works out of the box. You generally don't install a separate package as you would on older systems; keep the kernel current for the best support.

How much RAM and disk should an Ubuntu VM get?

For a desktop install, 4 GB RAM and 25–40 GB disk is comfortable; a server install runs in 2 GB and 15–20 GB. Enable Dynamic Memory so the VM only uses what it needs, and use a dynamically expanding VHDX so the disk grows on demand.

Sources & further reading

Official vendor documentation referenced while writing this guide.

SD

Sysadmin Desk

Infrastructure & Cloud

Hands-on guidance for infrastructure, virtualization, and containers — Hyper-V, VMware, Docker, and the day-to-day operations work that keeps environments running.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.