다음을 통해 공유


Changing Ubuntu Screen Resolution in a Hyper-V VM

If you install Ubuntu 14.04 inside a Hyper-V virtual machine – you automatically get all the integration components and virtualized drivers.  Including the Hyper-V video driver.  However, if you try to change the screen resolution inside your virtual machine you will notice something odd:

image

There is only one choice!

Luckily, you can change the screen resolution.  Just not here.  What you need to do is:

  1. Open Terminal
  2. Type: sudo vi /etc/default/grub
  3. Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT, and add video=hyperv_fb:[the resolution you want]. The resolution I want is 1280x720. So my line ends up looking like this: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1280x720"
  4. Write the changes and quit vi.
  5. Run: sudo update-grub
  6. Reboot the virtual machine

Now you will get the resolution that you want!

Cheers,
Ben

Comments

  • Anonymous
    September 19, 2014
    Hello, I want to know the status of all virtual machines running on Hyper-V , as well as i want to separately list down machines which are running UNIX operating system how can i do that using powershell or any other tool ?

  • Anonymous
    November 04, 2014
    Excellent, thanks, Ben. Adding "video=hyperv_fb:1920x1080" works with my RHEL 6.6 VM as well.

  • Anonymous
    November 28, 2014
    Thanks Ben, it also worked perfectly on Kubuntu 14.04

  • Anonymous
    December 07, 2014
    This works great on my desktop (1920x1080), on my Surface Pro 3 it will not go any higher than 1920x1080. Not sure if this is a linux issue (Ubuntu).

  • Anonymous
    January 14, 2015
    I am a new user so I do not know how to save, quit vi and update-grub.  Please someone help me. Ti is better with video. Thanks you all.

    • Anonymous
      February 21, 2017
      I hope you already got out of VI.. but it is not that difficult to quit it though.
  • Anonymous
    January 27, 2015
    Really thx, I was looking for this for at least a few months, You're great !!!!!

  • Anonymous
    March 01, 2015
    "4. Write the changes and quit vi." - How to quit vi?

  • Anonymous
    March 02, 2015
    "4. Write the changes and quit vi." - How to quit vi? Press ESC key, 'q' key then enter You can save and quit with wq instead of just q. Try: man vi

  • Anonymous
    March 05, 2015
    The same is the situation with CentOS and Red Had (v6 & v7). The above instructions are not applicable though; you need to use the grubby tool and pass the video argument for the Microsoft Hyper-V Synthetic Video Frame Buffer driver (hyperv_fb) with the desired resolution. The following short video demonstrates this proces: www.netometer.com/blog

  • Anonymous
    March 30, 2015
    I tried to did the same thing but still the image in same resolution :(

  • Anonymous
    May 15, 2015
    I have changed the file, but it doesn't work for me. I have two screens and just want to use one in full screen mode.

  • Anonymous
    July 23, 2015
    Trying to get my VM to run full screen on my Surface 3.  I can set a resolution of 1920x1080 just fine, but nothing larger seems to work. Definitely not the 2160x1440

  • Anonymous
    July 26, 2015
    Works great with Debian 8 as well. Thanks!

  • Anonymous
    August 01, 2015
    Thanks Ben that was very useful.

  • Anonymous
    August 02, 2015
    perfect, made my day =)

  • Anonymous
    August 06, 2015
    The comment has been removed

  • Anonymous
    August 07, 2015
    @Stefan If you don't want to use vi, use: sudo nano /etc/default/grub

  • Anonymous
    August 08, 2015
    thanks dude awesome i was looking and wondering about this forever. and it was only linux vms that did this to me. !!!!!!!!!!!!!!

  • Anonymous
    August 21, 2015
    Its a read only file, tried to change permission but this file is not editible not can change permissions.

  • Anonymous
    September 04, 2015
    The above article works, at least on Ubuntu.  Just be sure you run sudo before your editor command and enter the super user password when prompted.  IE. sudo gedit /etc/default/grub Or sudo nano /etc/default/grub The sudo will grant you admin and therefore edit privileges to the file.  As for the max resolution, it seems to be a hyper-v limitation on the 1920x1080 for Linux VMs.  Windows VMs can work just fine, but that's the max I've been able to get Linux to.  And remember to run sudo update-grub   every time after you change the grub file with the text editor.

  • Anonymous
    September 10, 2015
    @Matt: Thanks for the hint to 'nano'. This is an editor which is more usefull for me. The last time i used vi is about 20 years ago :-)

  • Anonymous
    November 05, 2015
    Interesting post bu this has to come first in order to edit the grub sudo gedit /etc/default/grub

  • Anonymous
    November 09, 2015
    Thanks!!!

  • Anonymous
    November 30, 2015
    Using a Dell 3800 with a native resolution 3840x2016 on Ubuntu 15.10,  the max I can get to work is 1920x1080. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"

  • Anonymous
    December 23, 2015
    hello Ben, I am wondering if there is any way to connect a USB Camera and use it on Ubuntu running as VM in Hyper-V. Thanks in advance !

  • Anonymous
    January 30, 2016
    Instead of using VI by the cmd : sudo vi /etc/default/grub i prefer the graphic editor GEDIT so i type: sudo gedit /etc/default/grub

  • Anonymous
    February 12, 2016
    Thanks for sharing that information. It was really annoying to have hpyer-v launch the os in such a small screen.

  • Anonymous
    March 12, 2016
    Unfortunately this is not working on Windows 10 using Hyper-V. Receive the following messages when trying to change the display to 1024x768.none of the selected modes were compatible with the possible modes:Trying modes for CRTC 619CRTC 619: trying mode 1024x768@0Hz with output at 1152x864@0Hz (pass 0)CRTC 619: trying mode 1024x768@0Hz with output at 1152x864@0Hz (pass 1)

  • Anonymous
    March 14, 2016
    Lots of people have noticed that you can't go above 1920x1080. Unfortunetly this is a limitation of the driver. If you look inside hyperv_fb.c: 18 /* 19 * Hyper-V Synthetic Video Frame Buffer Driver 20 * 21 * This is the driver for the Hyper-V Synthetic Video, which supports 22 * screen resolution up to Full HD 1920x1080 with 32 bit color on Windows 23 * Server 2012, and 1600x1200 with 16 bit color on Windows Server 2008 R2 24 * or earlier. 25 * 26 * It also solves the double mouse cursor issue of the emulated video mode. 27 * 28 * The default screen resolution is 1152x864, which may be changed by a 29 * kernel parameter: 30 * video=hyperv_fb:x 31 * For example: video=hyperv_fb:1280x1024 32 * 33 * Portrait orientation is also supported: 34 * For example: video=hyperv_fb:864x1152 35 */

  • Anonymous
    April 05, 2016
    Sweet!!!! Thanks!!!

  • Anonymous
    April 08, 2016
    Thank you, worked perfectly.

  • Anonymous
    May 05, 2016
    Merci! Ça fonctionne Ubuntu 16.04:)

  • Anonymous
    May 19, 2016
    Worked great for Ubuntu 16.04, thanks!

  • Anonymous
    May 24, 2016
    I dont get this to work at all, whit Ubuntu 16.04 inside Hyper v in Windows 10.Ubuntu only runs 800x600

  • Anonymous
    May 30, 2016
    What a joke. Every other client hypervisor on the market is able to dynamically resize the screen area, as well as maximise (although with lower "real" resolution). Hyper-V is simply not useable as a workstation hypervisor before this is fixed.

  • Anonymous
    July 05, 2016
    My notebook's resolution is 1920x1080. However, if I use anything over 1440x864 resolution, it triggers both vertical and horizontal scrollbars. Why is that? Anyway, using 1440x864 is a pretty good experience.

  • Anonymous
    July 12, 2016
    The comment has been removed

  • Anonymous
    July 13, 2016
    Hey guys, thanks for the info on updating this on hyper-V. I read though some people had trouble installing this on Windows 10 Hyper-V, but I just manage to make it work. What I had to do is create a new Virtual Machine that uses Generation 1. When I used Generation 2 I couldn't set it with this command. But on Generation 1 it worked without any problems. I have Ubuntu 16.04 LTS. Hope this helps.Thanks again.

    • Anonymous
      July 13, 2016
      HiI just tried Dusan's suggestion, created a new VM as Gen 1, and ended up with a smaller desktop than I had in Gen 2, and I still can't change it. Seems weird that people are getting different results.
      • Anonymous
        July 19, 2016
        The comment has been removed
  • Anonymous
    July 13, 2016
    Wow, you can't dynamically resize the rsolution? What a disappointment. Downloading virtualbox instead.

  • Anonymous
    July 20, 2016
    Thanks for the suggestion. I did this to 1366x768. It shows up full screen but now I can see only black screen and I think Ubuntu is not booting up. I don't know how to undo this setting.

  • Anonymous
    November 08, 2016
    The comment has been removed

  • Anonymous
    November 10, 2016
    This worked well for me Ubuntu 16.04, Windows 10 Pro 1607For those new folk like me could I suggest offering"sudu gedit /etc/default/grub"?Bit easier to use than vi?

  • Anonymous
    December 14, 2016
    The comment has been removed

  • Anonymous
    December 14, 2016
    The comment has been removed

  • Anonymous
    January 04, 2017
    The comment has been removed

  • Anonymous
    January 15, 2017
    Thank you. Good bless you! :)

  • Anonymous
    January 23, 2017
    Thank you very much :DIf you are not familiar with vi or vim in Ubuntu, you can use gedit, nano, or leafpad to edit the file. You can install them if they are not in your computer with:sudo apt-get updatesudo apt-get install nanoor sudo apt-get install leafpad

  • Anonymous
    February 10, 2017
    ok followed direction to open terminal and command, i am unable to edit or add anythingi am using hyper-v with an nvidia graphic cardneed a resolution of 1680x1050thank all

  • Anonymous
    February 24, 2017
    Works fine for me but I've another question, how can i have multiple screen resolution ? I'd like to have the 1920x1080 for full screen and the default screen resolution when using in a window ? Thanks

  • Anonymous
    May 25, 2017
    Does this work when using a remotefx card and not just the normal hyper-v frame buffer device?

    • Anonymous
      May 27, 2017
      Alan based on this "hyperv_fb" I suspect that remoteFX is not supported. But there can be also something if you are using Windows 10 Hyper-V. With remoteFx it doesnt change anything, I just goind to test standard frame buffer.
      • Anonymous
        June 30, 2017
        That was the issue with mine.
    • Anonymous
      October 29, 2017
      Thanks, I turned off remotefx card and finally it worked.
  • Anonymous
    May 30, 2017
    Ben you LEGEND!!!

    • Anonymous
      May 30, 2017
      "quiet splash" just stuff things up on my Hyper-V Ubuntu server LTS VMbut without it its running lekkerThx
  • Anonymous
    October 22, 2017
    Really helpfull, thanks!!

  • Anonymous
    November 16, 2017
    1920 x 932 if you want it to fit perfectly in a maximized window while still showing the start bar in Windows 10.

    • Anonymous
      November 16, 2017
      (On a 1920x1080 monitor of course)