Change Screen Resolution : Ubuntu / CentOS / RHEL / OpenSUSE on Hyper-V

Recently I was setting up a home lab comprising of Ubuntu 17.10 Desktop/Server, CentOS 7, RHEL,  and OpenSUSE VMs on a high-end Windows 10 Box through Hyper-V. Since I have three 4K and one HD monitors in my Home lab, I wanted to change screen resolution of all these Linux distros beyond the low resolution I got out-of-box when setup on Hyper-V VMs.

Now when we set up any Linux VMs on Hyper-V, we automatically get all the integration components and virtualized drivers Including the Hyper-V video driver. However, if we try to change screen resolution from inside our VMs, we are unable to do so. This is a strange limitation, which continues to persist until date.

The only way possible right now is to manually change screen resolution for Linux VMs in Hyper-V.

Let’s see this manual process to change screen resolution of an Ubuntu Desktop:

    • Open Terminal
    • Open the Grub file using nano editor: sudo nano /etc/default/grub
    • Locate the line in the file starting with GRUB_CMDLINE_LINUX_DEFAULT="quiet spalsh"
    • Add the following segment after the end of the “quiet splash” video=hyperv_fb:[your custom resolution]
    • The resolution I wanted to set was 1920×1080 (despite having three 4K Monitors). Hence my changes looked so: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"
    • Write the changes (CTRL-O) and quit nano (CTRL=X)
    • Run: sudo update-grub
    • Reboot the virtual machine

You can see the screenshot of the Grub file and the relevant section shown below:

Change Screen Resolution in GRUB

The same process as above worked for me equally well in other distros like CentOS, RHEL, and OpenSUSE. However, I believe this should work equally well on most other distros too.

Please note that the maximum resolution you can set today stands at 1920×1080, and cannot be extended beyond that threshold. This is a limitation of the Hyper-V video driver as you can see in the source for the same here: https://patchwork.kernel.org/patch/2149401/

Hope this post is useful to you. In case you have any questions, please feel free to comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *