HyperV - yenbohuang/techNotes GitHub Wiki
- Download Ubuntu LTS version which is more stable.
- Follow this blog and create VM
- https://www.windowscentral.com/how-run-linux-distros-windows-10-using-hyper-v
- Enable "Virtualization Technology" and "Hardware Enforced Data Execution Prevention" on BIOS.
- Check pre-requirement by
systeminfo.exe
- Enable Hyper-V by "Programs and Features" on Windows setting.
- Create virtual switch.
- Create Generation 2 VM.
- Disable secure boot.
- Add both Internal Virtual Switch and External Virtual Switch
- After install
- Ubuntu
- After first reboot, Ubuntu is hang at some point and I cannot fix it by reboot. It works after disabling wayland.
- Disable Wayland https://askubuntu.com/questions/1085296/ubuntu-18-10-cosmic-not-starting-gnome-session-on-bootup
- Press "Ctrl + Alt + F2" and login
sudo vi /etc/gdm3/custom.conf
- Uncomment "#WaylandEnable=false"
- Disable Wayland https://askubuntu.com/questions/1085296/ubuntu-18-10-cosmic-not-starting-gnome-session-on-bootup
- Set IP in eth1 (I don't know how to make DHCP work yet)
- Use
ipconfig
under Windows and check "Ethernet adaptor vEthernet". - Manual assign IPv4 address in Ubuntu. For example, if IP is "169.254.141.53" for Windows, assign "169.254.141.101" for Ubuntu.
- Assign the same subnet mask. For example, "255.255.0.0".
- Use
- Enable sshd.
- After first reboot, Ubuntu is hang at some point and I cannot fix it by reboot. It works after disabling wayland.
- Install developer tools
- Google Chrome
- Java
- Zulu 8 and 11
- Eclipse IDE
- Properties editor
- Apache Maven
- Apache ActiveMQ
- Azure
- Visual Studio Code
- Dotnet Core
- Azure CLI
- Containers
- Docker CE
- Docker Compose
- Ubuntu
Option 1:
- Follow this blog and set resolution by PowerShell command with "Run as Administrator":
get-vmvideo <vm name>
set-vmvideo <vm name> -horizontalresolution:2560 -verticalresolution:1600 -resolutiontype single
Option 2:
- Follow this blog and modify GRUB:
sudo nano /etc/default/grub
- Append "video=hyperv_fb:1920x1080"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"
sudo update-grub
- Reboot
If none of them work:
- Install xRDP (since enhanced session does not work for me yet).
- https://docs.skillable.com/docs/best-practices-for-building-virtual-machines#hyper-v-integration-services
- https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/integration-services
- https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/best-practices-for-running-linux-on-hyper-v
Check if Hyper-V integration services is installed?
sudo ps -ef | grep hv
Install the following packages
sudo apt-get install linux-virtual linux-cloud-tools-virtual linux-tools-virtual
sudo reboot
Check if hv-kvp-daemon
works? If it fails, reinstall packages with the matching kernel version and remove mismatching packages.
# sudo systemctl status hv-kvp-daemon
× hv-kvp-daemon.service - Hyper-V KVP Protocol Daemon
Loaded: loaded (/usr/lib/systemd/system/hv-kvp-daemon.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Tue 2025-03-04 14:56:30 CST; 17min ago
Duration: 37ms
Main PID: 487 (code=exited, status=2)
CPU: 12ms
Mar 04 14:56:30 yenbo-ubuntu systemd[1]: Started hv-kvp-daemon.service - Hyper-V KVP Protocol Daemon.
Mar 04 14:56:30 yenbo-ubuntu hv_kvp_daemon[487]: WARNING: hv_kvp_daemon not found for kernel 6.11.0-17
Mar 04 14:56:30 yenbo-ubuntu hv_kvp_daemon[487]: You may need to install the following packages for this specific kernel:
Mar 04 14:56:30 yenbo-ubuntu hv_kvp_daemon[487]: linux-tools-6.11.0-17-generic
Mar 04 14:56:30 yenbo-ubuntu hv_kvp_daemon[487]: linux-cloud-tools-6.11.0-17-generic
Mar 04 14:56:30 yenbo-ubuntu hv_kvp_daemon[487]: You may also want to install one of the following packages to keep up to date:
Mar 04 14:56:30 yenbo-ubuntu hv_kvp_daemon[487]: linux-tools-generic
Mar 04 14:56:30 yenbo-ubuntu hv_kvp_daemon[487]: linux-cloud-tools-generic
Mar 04 14:56:30 yenbo-ubuntu systemd[1]: hv-kvp-daemon.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 04 14:56:30 yenbo-ubuntu systemd[1]: hv-kvp-daemon.service: Failed with result 'exit-code'.