Adjust the Screen Resolution of an Ubuntu Hyper-V Virtual Machine

I use Ubuntu for a lot of the courses I teach, due to its popularity. While I have some computers running it “bare metal” as they say, in order to test different scenarios, as well as record my Pluralsight courses, I also setup virtual machines within Hyper-V.

It’s a bit annoying though, as it doesn’t seem to allow the guest extensions to easily resize the VM. (I create my VMs from the downloaded ISOs as opposed to using the pre-built images in the Hyper-V store). But it can be done! All you need is a few quick edits to the grub file.

Start by opening up a terminal window. Then you can use your favorite editor to open the grub file. I’m using VIM in this example, but you could substitute nano or another text editor of your choice. (I’ll assume you know how to use your editor to edit and save changes.)

sudo vim /etc/default/grub

Now scroll down and find the line that begins with GRUB_CMDLINE_LINUX_DEFAULT. To the end of it, append the following string:

video=hyperv_fb:1280x720

Or use 1920×1080, 2560×1440, or whatever resolution you prefer. The line should look something like the following, all on one line without any wrapping.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1280x720"

Looking good, but you’re not quite done yet. You’ll need to append the same to the next line so it looks similar to the following, again all on one line with no wrapping.

GRUB_CMDLINE_LINUX="quiet splash video=hyperv_fb:1280x720"

Of course, you’ll want to make sure the resolution you select matches on both lines, 1920×1080, etc.

Now save the contents and exit your editor.

Next, and this is an important step, you have to update grub using the following command:

sudo update-grub

If you skip this step, you won’t see your resolution updated.

Finally, you’ll need to reboot. I’ve not had great success with doing a reboot of Ubuntu running in Hyper-V, it frequently hangs, so I suggest doing a power off, then start Ubuntu again in Hyper-V.

When it does reboot, you should be running at your new resolution.

4 thoughts on “Adjust the Screen Resolution of an Ubuntu Hyper-V Virtual Machine

  1. I’ve tried this, it doesn’t appear to work anymore. After changing grub all you get is a black screen, the VM is dead. You’re not even able to switch to a command line interface. This was after 3 attempts (2 installs and 1 return to checkpoint).

    1. I have found that rebooting the VM after the change doesn’t work. Actually, it’s not just this change, rebooting in general doesn’t seem to work with current Ubuntu versions in Hyper-V.

      You must do a full shutdown, then restart the VM. Then it should work. It seems to be a quirk in Hyper-V.

  2. This worked for me although I had to use nedit since vim either wasn’t’ installed or on the path.
    It still seems pretty archaic that a Hyper-V VM only allows one fixed display resolution when every other VM I use allows for dynamically changing the display resolution.

    1. I agree, I wish it were something Microsoft would work on. Dynamically changing works in some OS’s, but not Ubuntu apparently. You’d think with as much love as Microsoft is showing for Linux these days it’s something they could make a priority out of.

Leave a comment