Enable Wayland on Ubuntu with Nvidia

Peter
3 min readDec 1, 2021

I saw an announcement on the Ubuntu Hideout Discord channel, that Ubuntu 21.10 enables Wayland default. I heard a lot of good about Wayland so I decided I give it a chance.

I upgraded from 20.4, so it took two steps and an hour when it finished, but finally, my upgraded Ubuntu 21.10 booted up and I was very excited to see the new Ubuntu (Wayland) option in the login screen selector.

I clicked into the username input and started looking for the small gear icon in the right bottom corner of my display. It was there. I clicked on it and unfortunately, I didn’t see any Wayland options there. Bummer.

Finally, I logged in using the old Ubuntu default option, I thought maybe the new default is Wayland and I don’t need to do anything else.

After logging in, I went to check what is the situation, so I opened a terminal and typed:

echo $XDG_SESSION_TYPE

The terminal printed X11.

Duh, it’s obviously not Wayland, let’s check what’s going on.

First I made sure, I’m using the gdm3 display manager:

cat /etc/X11/default-display-manager

It printed /usr/sbin/gdm3, good.

Then, I opened /etc/gdm3/custom.conf file in an editor (using sudo), and made sure WaylandEnable is NOT false. (meaning it’s commented out with an #, or WaylandEnable=true .

I could only reboot the gdm service, but I made a complete reboot instead for sure.

After this step, the Wayland option was still missing from the login selector.

I logged in again with the default option and opened a terminal window to check the kernel parameters.

cat /proc/cmdline

It printed:

BOOT_IMAGE=/boot/vmlinuz-5.13.0–22-generic root=UUID=1eee6c8c-f057–4dbc-85e5-d04461ff83a8 ro quiet splash vt.handoff=7

Aha! The nvidia-drm.modeset=1 part is missing. Without ruining anything let’s test what is going to happen if we add the missing parameter.

I followed these steps to temporarily add a boot parameter to a kernel:

  1. Start your system and wait for the GRUB menu to show (if you don’t see a GRUB menu, press and hold the left Shift key right after starting the system).
  2. Now highlight the kernel you want to use, and press the e key. You should be able to see and edit the commands associated with the highlighted kernel.
  3. Go down to the line starting with linux and add your parameter nvidia-drm.modeset=1to its end.
  4. Now press Ctrl + x to boot.

After this step, I checked if I can log in with Wayland, and viola the new option was there, I could select it and log in.

I felt like I’m done, but then I realized, I need to make the kernel changes permanent, I followed these steps:

Open this file to edit /etc/default/grub

Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and append nvidia-drm.modeset=1 to its end. For example:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia-drm.modeset=1"

Save the file and close the editor

Open a terminal window and use this command to update your grub configuration:

sudo update-grub

On the next reboot, the kernel should be started with the boot parameter.

That’s it!

--

--