How can I enable Wayland on Gnome?

I installed Endevour a couple of days ago and I noticed that my gnome session is using X11, how can I switch to Wayland?
P.S. I have an nvidia gpu
EDIT: if @_mk 's solution don’t work, try to run sudo -s /dev/null /etc/udev/rules.d/61-gdm.rules (thanks to @joekamprad for this); here’s the Arch Wiki reference.

as far as I remember when I scratched my head on it, three major points:
a. enable early KMS in your initramfs of choice, reference here
b. for a reason beyond my understanding, GDM requires the nvidia-suspend.service , nvidia-hibernate.service and nvidia-resume.service to be enabled in order to switch to Wayland session, reference here in ArchWiki plus the issue explained in Gnome’s gitlab
c. from the same link pointing to ArchWiki, enable NVreg_PreserveVideoMemoryAllocations and set NVreg_TemporaryFilePath options of the nvidia kernel module, via a modprobe file; this is necessary to handle (more or less) properly the suspension/hibernation.

After all this, Gnome should offer you Wayland as default session, with Xorg as an option selectable on login.
Bear in mind this does not guarantee hibernation/suspension will work flawlessly; I can only bring my personal experience to the table, but very often resume from suspension is accompanied with graphical artifacts (I called them GDM listening to Cerrone :rofl:), while hibernation doesn’t work at all, and I still have to understand the problem.
Good luck with it, and let us know if something’s missing :grinning:

https://wiki.archlinux.org/title/GDM#Wayland_and_the_proprietary_NVIDIA_driver

hardly depending on the GPU you have if it is a current supported one using latest Drivers/Modules you should be able to run wayland by default if kernel drm modesetting is enabled (will be the case if choosing Nvidia option on initial install, or using EndeavourOS nvidia-inst tool)

Looks like not in all cases i had nothing setup aside from drm modesetting…
inxi -Gaz

Graphics:
  Device-1: NVIDIA GA106 [GeForce RTX 3060 Lite Hash Rate] driver: nvidia
    v: 535.104.05 alternate: nouveau,nvidia_drm non-free: 535.xx+
    status: current (as of 2023-08) arch: Ampere code: GAxxx
    process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 1 speed: 2.5 GT/s
    lanes: 16 link-max: gen: 4 speed: 16 GT/s ports: active: none
    off: DP-1,DP-2 empty: DP-3,HDMI-A-1 bus-ID: 06:00.0 chip-ID: 10de:2504
    class-ID: 0300
  Display: wayland server: X.org v: 1.21.1.8 with: Xwayland v: 23.2.0
    compositor: gnome-shell v: 44.4 driver: X: loaded: nvidia
    gpu: nvidia,nvidia-nvswitch display-ID: 0
  Monitor-1: DP-1 model: BenQ G2420HD serial: <filter> built: 2010
    res: 1920x1080 dpi: 92 gamma: 1.2 size: 531x299mm (20.91x11.77")
    diag: 609mm (24") ratio: 16:9 modes: max: 1920x1080 min: 640x480
  Monitor-2: DP-2 model: Dell D2721H serial: <filter> built: 2020
    res: 1920x1080 dpi: 82 gamma: 1.2 size: 598x336mm (23.54x13.23")
    diag: 686mm (27") ratio: 16:9 modes: max: 1920x1080 min: 640x480
  API: OpenGL v: 4.6.0 NVIDIA 535.104.05 renderer: NVIDIA GeForce RTX
    3060/PCIe/SSE2 direct-render: Yes


in my case I had the previous generation card 20xx and in spite of the early mode setting, I wasn’t able to get wayland without enabling those three pesky services.
@orgia_draconica, considering Der Doktor @joekamprad experience, I’d say go ahead and enable KMS and check whether it works before messing up with services :smiley:

and btw, welcome to the purple side, @orgia_draconica :enos:

Just to back up a second, are you able to select a different session type from the GDM login screen? There should be a little cog wheel in the corner where you can toggle between the available choices after you enter the username (but before you sign in).

This is obviously a picture from some other distribution, but illustrates the idea well enough:

I enabled the drm modeset but still no wayland session in gnome.
Here’s my output of inxi -Gaz

Graphics:
Device-1: NVIDIA GA104M [GeForce RTX 3070 Mobile / Max-Q] vendor: Lenovo
driver: nvidia v: 535.104.05 alternate: nouveau,nvidia_drm non-free: 535.xx+
status: current (as of 2023-08) arch: Ampere code: GAxxx
process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 2 speed: 5 GT/s lanes: 8
link-max: gen: 4 speed: 16 GT/s lanes: 16 ports: active: none
off: DP-2,eDP-1 empty: DP-1,HDMI-A-1 bus-ID: 01:00.0 chip-ID: 10de:24dd
class-ID: 0300
Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.2.0
compositor: gnome-shell v: 44.4 driver: X: loaded: nvidia
gpu: nvidia,nvidia-nvswitch display-ID: :1 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x286mm (20.00x11.26")
s-diag: 583mm (22.95")
Monitor-1: DP-2 note: disabled pos: primary model: Samsung C27FG70
serial: built: 2015 res: 1920x1080 hz: 144 dpi: 82 gamma: 1.2
size: 598x337mm (23.54x13.27") diag: 686mm (27") ratio: 16:9 modes:
max: 1920x1080 min: 640x480
Monitor-2: eDP-1 mapped: DP-4 note: disabled model-id: CSO 0x1609
built: 2021 res: 1920x1080 dpi: 188 gamma: 1.2 size: 345x215mm (13.58x8.46")
diag: 407mm (16") ratio: 16:10 modes: 2560x1600
API: OpenGL v: 4.6.0 NVIDIA 535.104.05 renderer: NVIDIA GeForce RTX 3070
Laptop GPU/PCIe/SSE2 direct-render: Yes

Yes, but I have only “Gnome” and “Gnome classic” options.

Are both of those options X11 sessions? That seems odd…:thinking:

Check in /etc/gdm/custom.conf that the line WaylandEnable=false is commented out. It should look like this:

#WaylandEnable=false

Check if you have any Nvidia-related lines in /usr/lib/udev/rules.d/61-gdm.rules. If you do, comment them out with a #. They will look something like this:

# disable Wayland on Hi1710 chipsets
ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="/usr/lib/gdm-runtime-config set daemon WaylandEnable false"
# disable Wayland when using the proprietary nvidia driver
DRIVER=="nvidia", RUN+="/usr/lib/gdm-runtime-config set daemon WaylandEnable false"
# disable Wayland if modesetting is disabled
IMPORT{cmdline}="nomodeset", RUN+="/usr/lib/gdm-runtime-config set daemon WaylandEnable false"

Yours might look a little different but I would comment out any line that references disabling Wayland.

ln -s /dev/null /etc/udev/rules.d/61-gdm.rules

As root… as arch wiki is suggesting will force Wayland to be used

https://wiki.archlinux.org/title/GDM#Wayland_and_the_proprietary_NVIDIA_driver

I think that will solve @orgia_draconica issue.
I’ve always considered that as the last solution to try before throwing the card out of the window…but now I wonder whether it’s a more straightforward way that might have the positive effect of solving the issues with suspend/hibernate, something I’m going to try it later.
thanks @joekamprad :+1:

I followed both @_mk 's and @joekamprad 's solutions and now I can finally boot in Wayland by default; I don’t know if the first solution was enough, so maybe I’ll mark that as the solution but I’ll specify in my main post that I ran also -s /dev/null /etc/udev/rules.d/61-gdm.rules as root.
Thanks to all.

I have a little problem now, I can’t get the fan speed from various application (like auto-cpufreq and psensor), maybe because I deleted the gdm rules file. How can I restore that file?

the original should be in usr/lib/udev/rules.d/61-gdm.rules, as @BluishHumility pointed out in his post.
about your solution, I think that if you redirect gdm udev rules to null, you don’t need the services to have Wayland, as those conditions aren’t parsed anymore…just my 2c :grinning:

edit: as an afterthought, I think (read not 100% sure) that gdm might naturally fall back to default in /usr if the rules in /etc are not present; hence you might want just to delete the link created in /etc to restore default behavior. since I’m not sure 100%, let’s wait those with more experience than me…@joekamprad, may you chime in?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

sudo rm /etc/udev/rules.d/61-gdm.rules
will remove the symlink…

1 Like