How to Get Wayland to Work on Nvidia Graphics Cards

Nvidiawayland Card

Although Nvidia has theoretically had full support for Wayland since they released their drivers in late 2021, the road hasn’t necessarily been smooth. There’s still a lot of work to be done regarding how it interacts with components most people use, like XWayland. It requires setting variables in both the user environment and the kernel to navigate your system and click on things properly.

That isn’t to say that the experience isn’t worth it once you get Wayland to work on Nvidia graphics cards. If you follow this guide, your experience in Nvidia will be nearly as smooth as it is in X.

Also Helpful: If you have other issues with your GPU, try these common graphics card fixes.

Don’t Uninstall Xorg

First, don’t uninstall Xorg or any desktop environments that use it! To make your experience easier, with minimal frustration, it’s always good to have a safe option to fall back on. Think of X now as your “safe mode” in case anything goes wrong in the process. What we will do in this guide will not affect Xorg.

1. Set Up Your Environment

There are a few environmental variables to get Wayland to work on Nvidia graphics cards. Since there is no uniform standard here, we will be very generic in setting things up to ensure that Nvidia will not scowl at you.

Nvidiawayland Environment

Follow these steps to set up the environment:

  1. Back up your environment to your home directory:
sudo cp /etc/environment ~/environment.bak
  1. Open your universal environment file:
sudo nano /etc/environment
  1. If you plan to use Qt applications (you usually will have a few), add this line anywhere on the file:
QT_QPA_PLATFORMTHEME="wayland;xcb"
  1. Add the following environmental variables so that Nvidia can be forced to use the GBM backend (compatible with the vast majority of Linux environments) and enable a few other things you might need, even if they may not yet be installed:
GBM_BACKEND=nvidia-drm
__GLX_VENDOR_LIBRARY_NAME=nvidia
ENABLE_VKBASALT=1
LIBVA_DRIVER_NAME=nvidia
  1. Since hardware cursor rendering may fail in some environments, there’s one more optional variable. This only is needed if, when you finally test Wayland, you do not see a cursor on your screen.

However, there’s nothing wrong with adding this and removing it later to test things out without it:

WLR_NO_HARDWARE_CURSORS=1

Good to Know: You can fix Wayland GDM issues in Fedora with our guide.

2. (Arch Linux) Build Your Init Ramdisk

Most popular distros will boot up with an “initial ramdisk” (initramfs) that loads a temporary file system into your RAM (hence the term “ramdisk”) to initialize the boot process and prepare the kernel to do its magic and get you up and running.

Nvidiawayland Mkinitcpio

Within this initial ramdisk, we have to load Nvidia’s various components, including a way for it to load display resolution in the kernel. This is important because Wayland simplifies the frame buffer and communicates closer to the kernel.

In popular distros like Ubuntu and Fedora, Nvidia shouldn’t encounter issues as the systems are already set up in a way that makes the initramfs less discriminating about which modules it loads. However, Arch’s very modular structure will demand that specific modules be loaded in manually.

This process is not as intimidating as it sounds. Just follow these steps carefully:

  1. Edit your initial ramdisk configuration (make sure to create a backup first):
sudo nano /etc/mkinitcpio.conf
  1. Under the MODULES=() line, between the parentheses, add the following:
nvidia nvidia_modeset nvidia_uvm nvidia_drm
Nvidiawayland Modules

If the parentheses already have other modules that aren’t listed here between them, append these modules at the end. If you already see some Nvidia modules enclosed, add what’s missing from the list.

  1. Regenerate your initial ramdisk for all initramfs images (that’s what the -P flag is for):
sudo mkinitcpio -P

You should see a ton of scary warnings about “missing firmware.” Ignore those. That usually happens and is nothing to worry about. This is only useful in niche cases where a firmware package is missing for a piece of hardware you cannot use.

Tip: Some games may overwork your processor, but you can quickly fix high CPU usage in Linux.

3. Enable Direct Rendering Manager

Linux’s Direct Rendering Manager (DRM) allows the kernel to work with GPUs. For Nvidia and Wayland to get along, we have to make sure that the kernel uses Nvidia’s DRM mode setting within your bootloader’s kernel parameters:

  1. Edit your default GRUB configuration (again, always ensure a backup exists):
sudo nano /etc/default/grub
  1. Look for a line that starts with GRUB_CMDLINE_LINUX_DEFAULT. If it doesn’t exist (it won’t in Fedora, for example), create it to look like this: GRUB_CMDLINE_LINUX_DEFAULT="".
  2. Within the quotes, append the following:
nvidia-drm.modeset=1
Nvidiawayland Modeset
  1. Update Grub’s configuration:

In everything based on Ubuntu/Debian/Mint:

sudo update-grub

In Fedora/RHEL:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

With everything based on Arch:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Once everything is done, your system will have a much easier time running Wayland on Nvidia hardware!

Next Steps: Now that Wayland works, you can stress-test your graphics card.

Wayland Support on Your Distro

In Ubuntu, Fedora, and a few other select distros, you can get Wayland to work on Nvidia graphics cards once you upgrade to the latest version of your software. Ubuntu has been shipping Wayland as the default session for its modified GNOME desktop since version 22.04, and Fedora has been doing it for much longer than that. Consider making sure you’re running the latest version of your distro.

Nvidiawayland Sddm

Others, like Linux Mint, will have trouble running Wayland because it’s not a priority to overhaul the desktop environment they ship with. However, that doesn’t stop you from installing an alternative operating system. GNOME offers support out of the box, while KDE Plasma may require extra packages.

Debian-based/Ubuntu-based Systems

If your system is running GNOME, it already has Wayland support as long as you’re up to date. To install GNOME in case you don’t have it:

sudo apt install gnome

For KDE Plasma, you have to install both the desktop environment and the Wayland compositor separately:

sudo apt install kde-standard plasma-workspace-wayland

That’s it! Wayland should be available to you in your display manager as soon as you reboot.

Arch-based Systems

As with any other distro that offers the GNOME desktop environment, installing it on Arch Linux will automatically support Wayland:

sudo pacman -S gnome

Installing KDE Plasma is also rather simple:

sudo pacman -S plasma-meta plasma-wayland-session

Either of these commands will include Wayland in your display manager (more familiarly known as the login screen).

Be sure to also install XWayland:

sudo pacman -S xorg-xwayland

When you’ve finished installing everything, reboot, and then use your login screen to select the Wayland-supported version of the desktop environment you installed.

Frequently Asked Questions

Is Wayland really worth it?

You may notice that some things won’t work correctly even after all these changes. Although many issues with Nvidia have been solved, many applications continue to have minor but annoying compatibility issues with Wayland. It’s important to note that Wayland and many of the applications you are familiar with are in continuous active development. Most, if not all, of these issues will eventually disappear.

If you get too frustrated with Wayland, switch back to X. I recommend not uninstalling your Wayland packages, though, as X is being recognized as abandonware by more application developers by the day. Once in a blue moon, check to see if your issues have begun to disappear.

What do I do if my display manager doesn't show Wayland options?

Although most display managers should display the Wayland protocol implementations of your favorite desktop environments, this doesn’t always happen. The solution to this is to try out another display manager. The ones that come with KDE Plasma (SDDM) and GNOME (GDM) will work without issues. LightDM is also known to work perfectly fine.

Image credit: Pixabay. All screenshots by Miguel Gomez.

Is this post useful?
Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Miguel Leiva-Gomez
Miguel Leiva-Gomez - Staff Writer

Miguel has been a business growth and technology expert for more than a decade and has written software for even longer. From his little castle in Romania, he presents cold and analytical perspectives to things that affect the tech world.