Booting Linux ISO in Hyper-V

Complete guide for booting Linux distributions in Hyper-V virtual machines, including secure boot configuration and troubleshooting.

Overview

When installing Linux in Hyper-V Generation 2 VMs, you need specific security settings to allow the Linux ISO to boot properly.

Quick Fix

After creating your VM using the wizard:

  1. Right-click the VM → Settings
  2. Go to Security section
  3. Under Secure Boot, select Microsoft UEFI Certificate Authority template
  4. Click OK

Step-by-Step Guide

Step 1: Create Virtual Machine

  1. Open Hyper-V Manager
  2. Right-click your host → NewVirtual Machine
  3. Click Next

Step 2: VM Configuration

Name:

Ubuntu-22.04-Desktop

Generation:

Memory:

Networking:

Virtual Hard Disk:

Installation Options:

Step 3: Configure Secure Boot (Critical!)

Before starting the VM:

  1. Right-click VM → Settings
  2. Navigate to Security
  3. Under Secure Boot, change template from:
    • Microsoft Windows (default)
    • Microsoft UEFI Certificate Authority
  4. Click OK

Step 4: Start VM and Install Linux

  1. Right-click VM → Connect
  2. Click Start
  3. Boot from ISO
  4. Follow Linux distribution's installation wizard

Supported Linux Distributions

Confirmed Working

Common Boot Issues

Issue 1: Black Screen / Won't Boot

Cause: Using Windows secure boot template

Solution:

Settings → Security → Secure Boot Template → Microsoft UEFI Certificate Authority

Issue 2: "Secure Boot Violation"

Solution 1: Change template (see above)

Solution 2: Disable Secure Boot entirely

Settings → Security → Uncheck "Enable Secure Boot"

Issue 3: ISO Not Detected

Check:

  1. Settings → SCSI Controller → DVD Drive
  2. Ensure ISO path is correct
  3. Try removing and re-adding the ISO

Issue 4: VM Starts in UEFI Shell

Solution:

  1. Power off VM
  2. Settings → Firmware → Boot Order
  3. Move DVD Drive to top
  4. Click OK and restart

Generation 1 vs Generation 2

Generation 2 (Recommended)

Advantages:

Disadvantages:

Generation 1 (Legacy)

Advantages:

Disadvantages:

Post-Installation Configuration

Install Linux Integration Services

Most modern Linux distributions include Hyper-V drivers built-in. For older versions:

# Ubuntu/Debian
sudo apt install linux-tools-$(uname -r) linux-cloud-tools-$(uname -r)

# RHEL/CentOS
sudo yum install hyperv-daemons

# Arch Linux
sudo pacman -S hyperv

Enable Enhanced Session Mode

For better desktop experience:

# Ubuntu/Debian
sudo apt install xrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp

Then in Hyper-V:

  1. Settings → Enhanced Session Mode Policy
  2. ✅ Allow enhanced session mode
  3. Reconnect to VM

Configure Display Resolution

# Edit GRUB
sudo nano /etc/default/grub

# Add or modify this line
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"

# Update GRUB
sudo update-grub

# Reboot
sudo reboot

Optimize Performance

# Disable IPv6 (if not needed)
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf

# Apply changes
sudo sysctl -p

Networking Configuration

NAT Network

VM gets internet through host:

  1. Settings → Network Adapter → Virtual Switch
  2. Select Default Switch (NAT)

Bridged Network

VM gets IP from your router:

  1. Create External Virtual Switch in Virtual Switch Manager
  2. Settings → Network Adapter → Select your external switch

Storage Configuration

Add Additional Disk

  1. Settings → SCSI Controller → Add → Hard Drive
  2. New → Virtual Hard Disk
  3. Specify size and location
  4. In Linux:
# List disks
lsblk

# Partition new disk
sudo fdisk /dev/sdb

# Format partition
sudo mkfs.ext4 /dev/sdb1

# Mount
sudo mkdir /mnt/data
sudo mount /dev/sdb1 /mnt/data

# Auto-mount on boot
echo '/dev/sdb1 /mnt/data ext4 defaults 0 0' | sudo tee -a /etc/fstab

Checkpoints (Snapshots)

Create VM snapshots for easy recovery:

# PowerShell on host
Checkpoint-VM -Name "Ubuntu-22.04" -SnapshotName "Fresh Install"

Or in Hyper-V Manager:

Special Distributions

Arch Linux

Requires manual partitioning. During installation:

# Check if booted in UEFI mode
ls /sys/firmware/efi/efivars  # Should have files

# Partition disk
cfdisk /dev/sda

# Create:
# 1. 512MB EFI partition
# 2. Rest for root partition

Kali Linux

Enable Hyper-V graphics:

# After install
sudo apt update
sudo apt install xserver-xorg-video-fbdev

Troubleshooting Commands

Check Hyper-V Integration

# Check loaded modules
lsmod | grep hv_

# Should see:
# hv_vmbus
# hv_storvsc
# hv_netvsc

Check Network

# View interfaces
ip addr show

# Test connectivity
ping 8.8.8.8

Check Disk

# Disk usage
df -h

# Disk performance
sudo hdparm -Tt /dev/sda

Performance Tips

  1. Allocate enough RAM - 4GB minimum for desktop Linux
  2. Enable Dynamic Memory - Let Hyper-V manage RAM
  3. Use Generation 2 - Better performance than Gen 1
  4. Install Integration Services - For optimal drivers
  5. Use SSD host storage - Much faster than HDD

Security Considerations

Secure Boot Benefits

✅ Prevents unauthorized bootloaders
✅ Protects against rootkits
✅ Validates kernel integrity

When to Disable Secure Boot

Next Steps

After successful Linux installation:

Additional Resources

User