This is an old question, but people are still struggling with this me things. I am not sure why its so dang hard. I've seen the first answer. Didn't work. (add the line to /etc/default/grub/). I tried the video card thing, first without. Then with. Nah didnt. work. Then I found the below. To be frank- still didnt work. Im on 18.04. But I throw it here for completeness. These are the 3 most common answers I've seen. Some of these must work for each person.
Source https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/supported-ubuntu-virtual-machines-on-hyper-v
Static IP injection may not work if Network Manager has been configured for a given Hyper-V-specific network adapter on the virtual machine. To ensure smooth functioning of static IP injection please ensure that Network Manager is turned off completely or has been turned off for a specific network adapter through its ifcfg-ethX file.
While using virtual fiber channel devices, ensure that logical unit number 0 (LUN 0) has been populated. If LUN 0 has not been populated, a Linux virtual machine might not be able to mount fiber channel devices natively.
If there are open file handles during a live virtual machine backup operation, then in some corner cases, the backed-up VHDs might have to undergo a file system consistency check (fsck) on restore.
Live backup operations can fail silently if the virtual machine has an attached iSCSI device or direct-attached storage (also known as a pass-through disk).
On long term support (LTS) releases use latest virtual Hardware Enablement (HWE) kernel for up to date Linux Integration Services.
To install the virtual HWE kernel on 16.04, run the following commands as root (or sudo
):
bash
apt-get update
apt-get install linux-virtual-lts-xenial
To install the virtual HWE kernel on 14.04, run the following commands as root (or sudo
):
bash
apt-get update
apt-get install linux-virtual-lts-xenial
12.04 ** does not have a separate virtual kernel. To install the generic HWE kernel on **12.04, run the following commands as root (or sudo):
bash
apt-get update
apt-get install linux-generic-lts-trusty
On Ubuntu ** 12.04, 14.04, and 16.04 **the following Hyper-V daemons are in a separately installed package:
VSS Snapshot daemon
- This daemon is required to create live Linux virtual machine backups.
KVP daemon
- This daemon allows setting and querying intrinsic and extrinsic key value pairs.
fcopy daemon
- This daemon implements a file copying service between the host and guest.
To install these Hyper-V daemons on 16.04, run the following commands as root (or sudo):
bash
apt-get install linux-tools-virtual-lts-xenial linux-cloud-tools-virtual-lts-xenial
To install these Hyper-V daemons on 14.04, run the following commands as root (or sudo).
bash
apt-get install hv-kvp-daemon-init linux-tools-virtual-lts-xenial linux-cloud-tools-virtual-lts-xenial
To install the KVP daemon on **12.04, ** run the following commands as root (or sudo).
bash
apt-get install hv-kvp-daemon-init linux-tools-lts-trusty linux-cloud-tools-generic-lts-trusty
Whenever the kernel is updated, the virtual machine must be rebooted to use it.
On Ubuntu 17.04 and 16.10, use the latest virtual kernel to have up-to-date Hyper-V capabilities.
To install the virtual kernel on **17.04 and 16.10, **run the following commands as root (or sudo
):
bash
apt-get update
apt-get install linux-image-virtual
On Ubuntu **17.04 and 16.10 **the following Hyper-V daemons are in a separately installed package:
VSS Snapshot daemon
- This daemon is required to create live Linux virtual machine backups.
KVP daemon
- This daemon allows setting and querying intrinsic and extrinsic key value pairs.
fcopy daemon
- This daemon implements a file copying service between the host and guest.
To install these Hyper-V daemons on 17.04 and 16.10, run the following commands as root (or sudo
):
bash
apt-get install linux-tools-virtual linux-cloud-tools-virtual
Whenever the kernel is updated, the virtual machine must be rebooted to use it.
[...]
On Windows Server 2012 R2, Generation 2 virtual machines have secure boot enabled by default and some Linux virtual machines will not boot unless the secure boot option is disabled. You can disable secure boot in the Firmware section of the settings for the virtual machine in Hyper-V Manager or you can disable it using Powershell:
Powershell
Set-VMFirmware -VMName "VMname" -EnableSecureBoot Off
Before attempting to copy the VHD of an existing Generation 2 VHD virtual machine to create new Generation 2 virtual machines, follow these steps:
Log in to the existing Generation 2 virtual machine.
Change directory to the boot EFI directory:
bash
cd /boot/efi/EFI
Copy the ubuntu directory in to a new directory named boot:
bash
sudo cp -r ubuntu/ boot
Change directory to the newly created boot directory:
bash
cd boot
Rename the shimx64.efi file:
bash
sudo mv shimx64.efi bootx64.efi
There is also this: https://www.altaro.com/hyper-v/remotefx-windows-10-client-hyper-v/ that I found useful.
Update
New sources, check out these links:
Discussion with Linux Kernel Developer
https://github.com/LIS/lis-next/issues/318
https://github.com/dcui/linux/commit/c031eec626cd2c41ae1c0e70f51c03284017edf9
https://github.com/dcui/linux/blob/master/drivers/video/fbdev/hyperv_fb.c
Set VM-Video in PowerShell
https://github.com/MicrosoftDocs/windows-powershell-docs/blob/master/docset/windows/hyper-v/set-vmvideo.md
https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmvideo?view=win10-ps
I think I tried the above without benefit though
What I currently recommend is just using an RDP - remote desktop connection to connect. It is much easier.
- Use
Sudo Apt-get search RDP
to find a package that might work. Install what works for your system.
- Get the IP from within the VM, or from the network status box in the Hyper-VM dashboard on the Host.
- Connect, using RDP on the machine you want to use.
Win+R and type "RDP"
to open the Remote Desktop app on a Windows Machine, use the IP that you collected.
- Finally log in with your Linux Login and Password.
That said, to the above commands, I have these recommendations for settings on the HOST.
These are detailed on the links above.
In PowerShell
Try the following
Set-VMVideo -VMName "<VM name>" -HorizontalResolution 1920 -VerticalResolution 1200 -ResolutionType Maximum
sudo update-grub
as suggested here? blogs.msdn.microsoft.com/virtual_pc_guy/2014/09/19/…