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:
- Right-click the VM → Settings
- Go to Security section
- Under Secure Boot, select Microsoft UEFI Certificate Authority template
- Click OK
Step-by-Step Guide
Step 1: Create Virtual Machine
- Open Hyper-V Manager
- Right-click your host → New → Virtual Machine
- Click Next
Step 2: VM Configuration
Name:
Ubuntu-22.04-Desktop
Generation:
- ✅ Choose Generation 2 (recommended for modern Linux)
- ⚠️ Generation 1 works but is legacy
Memory:
- Minimum: 2048 MB
- Recommended: 4096 MB or more
- ✅ Enable Dynamic Memory
Networking:
- Select your virtual switch
Virtual Hard Disk:
- Size: 20 GB minimum (50 GB+ recommended)
- Location: Default or custom
Installation Options:
- Select Install an operating system from a bootable image file
- Browse to your Linux ISO
Step 3: Configure Secure Boot (Critical!)
Before starting the VM:
- Right-click VM → Settings
- Navigate to Security
- Under Secure Boot, change template from:
- ❌ Microsoft Windows (default)
- ✅ Microsoft UEFI Certificate Authority
- Click OK
Step 4: Start VM and Install Linux
- Right-click VM → Connect
- Click Start
- Boot from ISO
- Follow Linux distribution's installation wizard
Supported Linux Distributions
Confirmed Working
- Ubuntu (18.04, 20.04, 22.04, 24.04)
- Debian (10, 11, 12)
- Fedora (all recent versions)
- CentOS / Rocky Linux / AlmaLinux
- openSUSE / SUSE Enterprise
- Linux Mint
- Pop!_OS
- Manjaro
- Arch Linux
- Kali Linux
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:
- Settings → SCSI Controller → DVD Drive
- Ensure ISO path is correct
- Try removing and re-adding the ISO
Issue 4: VM Starts in UEFI Shell
Solution:
- Power off VM
- Settings → Firmware → Boot Order
- Move DVD Drive to top
- Click OK and restart
Generation 1 vs Generation 2
Generation 2 (Recommended)
✅ Advantages:
- UEFI boot (modern)
- Secure Boot support
- Better performance
- Faster boot times
- Network boot (PXE)
❌ Disadvantages:
- Requires 64-bit OS
- Requires secure boot configuration
Generation 1 (Legacy)
✅ Advantages:
- No secure boot issues
- Works with any Linux
- Simpler setup
❌ Disadvantages:
- BIOS boot (old)
- Slower performance
- Limited features
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:
- Settings → Enhanced Session Mode Policy
- ✅ Allow enhanced session mode
- 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:
- Settings → Network Adapter → Virtual Switch
- Select Default Switch (NAT)
Bridged Network
VM gets IP from your router:
- Create External Virtual Switch in Virtual Switch Manager
- Settings → Network Adapter → Select your external switch
Storage Configuration
Add Additional Disk
- Settings → SCSI Controller → Add → Hard Drive
- New → Virtual Hard Disk
- Specify size and location
- 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:
- Right-click VM → Checkpoint
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
- Allocate enough RAM - 4GB minimum for desktop Linux
- Enable Dynamic Memory - Let Hyper-V manage RAM
- Use Generation 2 - Better performance than Gen 1
- Install Integration Services - For optimal drivers
- 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
- Custom compiled kernels
- Third-party drivers
- Some older distributions
Next Steps
After successful Linux installation:
- See "XRDP met Cinnamon Desktop" for remote desktop setup
- Check "Ubuntu 20.04 on Raspberry Pi" for ARM-based VMs
- Review "Debian 10" manual for server configuration