Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aont/518d2644bd73c524e8c2b2072c17b07c to your computer and use it in GitHub Desktop.

Select an option

Save aont/518d2644bd73c524e8c2b2072c17b07c to your computer and use it in GitHub Desktop.

Using Wayland on Linux in Hyper-V: How to Disable hyperv_fb on Ubuntu and Rocky Linux

When running a Linux virtual machine on Microsoft Hyper-V, you may want to use the Wayland display server for better performance and smoother graphics compared to X11. However, Wayland cannot function correctly if the Hyper-V framebuffer driver (hyperv_fb) is loaded, because it interferes with the kernel’s native framebuffer setup. To enable Wayland, you need to disable (blacklist) the hyperv_fb module. Below are two methods to do this for Ubuntu and Rocky Linux.


1. Disabling hyperv_fb via GRUB Kernel Arguments

This method edits the GRUB configuration to prevent hyperv_fb from loading at boot time.

Steps (Ubuntu & Rocky Linux):

  1. Edit the GRUB configuration file:

    sudo nano /etc/default/grub
  2. Find the line that starts with:

    GRUB_CMDLINE_LINUX_DEFAULT=
    

    or

    GRUB_CMDLINE_LINUX=
    
  3. Add the following parameter inside the quotes:

    modprobe.blacklist=hyperv_fb
    

    Example:

    GRUB_CMDLINE_LINUX_DEFAULT="verbose modprobe.blacklist=hyperv_fb"
    
  4. Update the GRUB configuration:

    • On Ubuntu:

      sudo update-grub
    • On Rocky Linux:

      sudo grub2-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline

      (If using UEFI: /boot/efi/EFI/rocky/grub.cfg)

  5. Reboot the system:

    sudo reboot

After rebooting, the hyperv_fb module should no longer be loaded, allowing Wayland to start properly.


2. Disabling hyperv_fb via Modprobe Blacklist

This method explicitly blacklists the module at the kernel level and updates the initramfs image.

Steps (Ubuntu & Rocky Linux):

  1. Create a blacklist configuration file:

    sudo nano /etc/modprobe.d/blacklist-hyperv_fb.conf
  2. Add the following line:

    blacklist hyperv_fb
    
  3. Update the initramfs (initial RAM filesystem):

    • On Ubuntu:

      sudo update-initramfs -u
    • On Rocky Linux:

      sudo dracut -f
  4. Reboot the system:

    sudo reboot

Verifying the Change

After reboot, check whether the module is still loaded:

lsmod | grep hyperv_fb

If no output appears, it means hyperv_fb has been successfully disabled.

You can then enable or switch to Wayland (for example, by choosing the Wayland session at the login screen in GNOME).


Summary

Method Configuration File Command to Apply Works On
GRUB Kernel Argument /etc/default/grub update-grub or grub2-mkconfig Ubuntu & Rocky Linux
Modprobe Blacklist /etc/modprobe.d/blacklist-hyperv_fb.conf update-initramfs or dracut -f Ubuntu & Rocky Linux

Either method will successfully disable hyperv_fb, allowing your Linux VM on Hyper-V to run Wayland-based desktop sessions smoothly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment