Ubuntu Hyper-V Guest Display Resolution

Good afternoon,

I am trying to set up an Ubuntu guest on a Hyper-V server. I am relatively new to Linux so please bear with me, the VM is a test machine to get the hang of things and give Ubuntu a try. One of the new features of Server 2012 R2 is the improved display capabilities as mentioned here at blogs.technet.com

I don't think I am alone in finding this doesn't "just work". Some advice found online suggests updating the kernel, which I have done to 3.11.6 as described in one post, and to the latest 3.12.1. In both cases I could only see resolutions listed under the display options up to 1152x864, which is what Linux has always been limited to under Hyper-V.

Another clue was found in the next link (in Japanese) - the poster has added "video=hyperv_fb:1920x1080" to /boot/grub2/grub.cfg. When I went to repeat this I noted the message about not editing /boot/grub2/grub.cfg directly so I have added the line in /etc/default/grub instead.

yamanxworld.blogspot.co.uk

This has not given the option for the full 1920x1080 resolution either, and at this point I have run out of things to try and would not know if this is now a Hyper-V issue or something more fundamental and this would not have worked on a physical or other hypervisor machine.

If anyone can shed some light I would be most grateful.


Solution 1:

I had the same issue and when I was looking for help I remember seeing your post. Now when I finally got it to work I might as well document it here:

  1. Upgraded linux-image and headers sudo apt-get install linux-image-3.11.0-15-generic linux-headers-3.11.0-15-generic (Perhaps virtual would work just as well as the generic one.):

  2. Installed linux-image-extras with the hyperv-drivers: sudo apt-get install linux-image-extra-virtual

  3. Set video mode (Pretty much what you already did):
    Set GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1680x1050" in /etc/default/grub.

  4. Update grub: sudo update-grub
  5. Reboot

I guess the critical part was installing the updated hyperv-drivers with linux-image-extra-virtual. Also make sure they are loaded.

Solution 2:

copat's answer worked for me, but only after I changed my resolution down from 1920x1200 to 1920x1080.

Looking in the Linux source file hyperv_fb.c there is the comment: "This is the driver for the Hyper-V Synthetic Video, which supports screen resolution up to Full HD 1920x1080 with 32 bit color on Windows Server 2012, and 1600x1200 with 16 bit color on Windows Server 2008 R2 or earlier."

Solution 3:

I did all this without success, and then I tried fiddling with the Hyper-V settings.

I increased the RAM for video to 512K and also deleted the 3D driver.
This worked for me.

Solution 4:

Since this question was asked (in 2013) things have progressed significantly with regards to Hyper-V & Ubuntu 18.04.1 with regards to ‘Enhanced Session Mode’.

There are two approaches currently:

A) New System

Optimized Ubuntu Desktop images available in Microsoft Hyper-V gallery

B) Existing System

Manually configure xRDP to support ‘Enhanced Session Mode


Here are the details:

Option A)

  1. In Hyper-V, on your server & select [Quick Create]
  2. In the [Create Virtual Machine] dialog, select [Ubuntu 18.04.1 LTS] && then [Create Virtual Machine]
  3. Then complete the standard Ubuntu installation options
  4. ‘Enhanced Session Mode’ will prompt you to setup screen resolution, local resources, etc.
  5. Note/Caution ~ if you have problems using drives, then you may want to de-select the [Printers]

Here are the links to where I sourced the information:

○ Optimised Ubuntu Desktop images available in Microsoft Hyper-V gallery

○ Run Ubuntu virtual machines made even easier with Hyper-V Quick Create

Option B)

  1. Modify Ubuntu 18.04 to use xrdp

    1.1 Get the scripts from GitHub

    sudo apt-get update
    sudo add-apt-repository ppa:git-core/ppa
    sudo apt update; sudo apt install git
    git clone https://github.com/jterry75/xrdp-init.git ~/xrdp-init
    

    1.2 Make the scripts executable and run them...

    cd ~/xrdp-init/ubuntu/18.04/
    sudo chmod +x install.sh
    sudo ./install.sh
    reboot
    

    1.3 <After Reboot> Run script again to finish setting up VM

    cd ~/xrdp-init/ubuntu/18.04/
    sudo ./install.sh
    
  2. Shutdown Ubuntu VM

  3. Register Ubuntu Session ~ run this command on host PC using powershell with admin rights:

    Set-VM -VMName YourUbuntuVMNameHere -EnhancedSessionTransportType HvSocket
    
  4. Restart VM

  5. Connect/Login to XRDP from Hyper-V (note ~ enter username - must be lowercase)

  6. Note/Caution ~ if you have problems using drives, then you may want to de-select the [Printers]


Here is the link to where I sourced the information:

  • Windows 10: A guide how to run Ubuntu 18.04 in Enhanced Mode in Hyper-V