Categories: Virtualization

Ubuntu Guest Screen Resolution on Hyper-V Host

In Ubuntu VM Setup for OpenJDK Development, I configured the Ubuntu guest to use a 1680×1050 resolution by editing the /etc/default/grub file, running update-grub and then rebooting. 1680 horizontal pixels now seems restrictive given that I want to look at side-by-side diffs in VSCode. I updated the grub file to 1920×1440 and rebooted but ended up with a 1024×768 window (I think, it was small). I suspected that 1920×1440 was not a supported resolution. My search for supported resolutions for hyperv ubuntu led me to a great solution posted in How to adjust virtual machine display resolution to adapt to full screen – Microsoft Q&A using the Set-VMVideo command:

Set-VMVideo -VMName "vm1ubuntu" -HorizontalResolution 1920 -VerticalResolution 1440 -ResolutionType Single

This command needs to be executed as an administrator and the virtual machine needs to be turned off to avoid this error:

C:\> Set-VMVideo -VMName "vm1ubuntu" -HorizontalResolution 1920 -VerticalResolution 1080 -ResolutionType Single
Set-VMVideo : Failed to modify device 'Synthetic Display Controller'.
'vm1ubuntu' failed to modify device 'Synthetic Display Controller'. (Virtual machine ID
1CF95D1E-C608-4B94-BA26-C73110C2B107)
The vm1ubuntu virtual machine must be turned off when setting resolution type, horizontal resolution or vertical
resolution. (Virtual machine ID 1CF95D1E-C608-4B94-BA26-C73110C2B107)
At line:1 char:1
+ Set-VMVideo -VMName "vm1ubuntu" -HorizontalResolution 1920 -VerticalR ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Set-VMVideo], VirtualizationException
    + FullyQualifiedErrorId : InvalidState,Microsoft.HyperV.PowerShell.Commands.SetVMVideo

This is much cleaner way to set the screen resolution so I’m glad the poster went back and added this solution.

Article info



Leave a Reply

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