Ubuntu on Hyper-V sluggish/slow UI experience

17,115

Solution 1

On Ubuntu 20.04 do the following:

  1. Run:

    sudo nano /etc/modprobe.d/blacklist.conf
    
  2. Add the following line at the end of the file:

    blacklist hyperv_fb
    
  3. Save (Ctrl+X then Y)

  4. Reboot.

The refresh rate should be much better.

Solution 2

I wish I would have seen this question earlier. I'm sorry that you have been affected for a long time. :-(

This is a known issue (please refer to https://github.com/LIS/lis-next/issues/655) which has been fixed in the Linux mainline kernel since last Nov (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5f1251a48c17b54939d7477305e39679a565382c).

For Ubuntu 20.04, as I just checked, the latest linux-azure kernel Ubuntu-azure-5.4.0-1039.41 (Jan 18) still does not have the fix, but the generic 5.4 kernel Ubuntu-5.4.0-66.74 and the HWE kernel Ubuntu-hwe-5.8-5.8.0-44.50_20.04.1 already have the fix. You probably want to upgrade to either of the two kernels that have the fix.

If you can't upgrade your kernel immediately, there is a workaround: please blacklist the Hyper-V synthetic framebuffer driver (the file location can be found by "modinfo hyperv_fb"), and then Linux will automatically use the legacy vesafb driver (if it’s a Generation-1 VM) or the efifb driver (if it’s a Generation-2 VM); if it’s a Generation-1 VM, please also add the kernel parameter "video=vesafb:mtrr:3", which tells the legacy framebuffer driver "vesafb" to map the legacy framebuffer cacheable. The rationale of the workaround is that the legacy vesafb/efifb drivers are fast since they map (or can be instructed to map) the framebuffer cacheable.

Share:
17,115
Bartek
Author by

Bartek

Updated on September 18, 2022

Comments

  • Bartek
    Bartek about 1 year

    Ubuntu 20.04 LTS installed with Hyper-V Manager. I have assigned it 4 processor cores and 12GBs of RAM. I have run through several forums and tutorials and I haven't found any solution that would actually help with the issue. The performance is so sluggish, it's making usage of the VM unbearable. I'd love things to run smoothly - moving the cursor, opening windows, scrolling etc.

    i-7 8700K, 32GB, Intel UHD Graphics 630, SSD

    I'd appreciate any help.

  • George Vovos
    George Vovos over 2 years
    This seems to improve the behaviour but my screen resolution changes to 1024x768 even though I have it as 1920x1080 in GRUB_CMDLINE_LINUX_DEFAULT
  • fabpico
    fabpico almost 2 years
    When I upgrade to 5.4.0-66-generic I can't boot anymore. When I upgrade to the newest (5.4.0-91-generic) it still feels like 15 FPS, but youtube videos feel a little more performant than before. But still not berable.
  • fabpico
    fabpico almost 2 years
    This results in 5.11.0-43-generic, and still feels like 15 FPS. Any ideas why it still feels like 15 FPS?
  • Dexuan
    Dexuan almost 2 years
    Probably you can try the v5.11-based linux-azure kernel by "apt install linux-azure". I suspect the v5.4-based kernel is not so well-maintained for a Linux VM running on Hyper-V.
  • fabpico
    fabpico almost 2 years
    I did apt install linux-azure, it resulted in 5.11.0-1022-azure, but still feels like 15 FPS.
  • Admin
    Admin over 1 year
    This is like a copy and paste from the answer from May 2021...
  • Admin
    Admin over 1 year
    @George Vovos, here is a link I used to change the resolution, just wanted to be sure that the line says GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"