27

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.

6 Answers 6

45

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.

4
  • 4
    Thank you, worked for me too. Looks like step 1 is not necessary, as step 2 installs all required dependencies automatically. Also, specific version numbers in step 1 may not work for some users.
    – alx
    Dec 21, 2014 at 20:34
  • 2
    This works, but for those on 1920x1200 monitors, you have to drop it down to 1920x1080 to get it to work (I had originally missed the answer below, so thought a comment here might be seen quicker for some).
    – Jerad Rose
    Jan 15, 2016 at 22:53
  • 4
    The given "make sure..." link is 404
    – SeveQ
    Nov 20, 2016 at 13:11
  • Don't forget to remove from your VM settings the remotefx card (If enabled for some reason)!
    – oikonomopo
    Jan 16, 2019 at 13:52
22

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."

1
  • Is this still the case with 17.04?
    – user9993
    Sep 18, 2017 at 11:26
2

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.

2

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:

1
  • Thank you! I would say option A) of your answer, using the optimized desktop images, is the best advice if you're starting with a fresh instance.
    – temarsden
    Mar 25, 2019 at 17:38
0

With the methods described, it didn't work for me. What worked was: I can leave my host screen at 1920x1200, but the text size increased to 125% then I get full screen in my Ubuntu guest session;

0

I can recommend a way of editing grub file with grubby.

First, you need to logged as a root user, just type:

sudo su

press ENTER button and enter your root password.

After that, just type the command like below:

grubby --update-kernel=ALL --args="video=hyperv_fb:1920X1080"

where 1920x1080 it's your preferred resolution.

Then just reboot your VM and new resolution must be applied.

I hope that this solution helps you. In case of questions, please contact me and I will try to help.

2
  • 2
    What exactly is 'grubby' and where did you obtain it from? There seems to be no package or file with this name in https://packages.ubuntu.com Jan 26, 2019 at 17:09
  • @CharlesGreen It seems that grubby is a tool only available to RPM-based distros (Red Hat, etc). CTRL+F "Ubuntu" here.
    – Carolus
    Dec 15, 2019 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.