How to force GNOME to use Wayland?

11,893

I had a similar problem width GDM ("Just FYI, it now works... Partially. Sometimes it starts wayland, sometimes X") and to solve my problem I had to add a driver card module to my mkinitcpio config file. Was something to do with concurrency load with systemd or something like that. Im not an expert so i really dont know. something like this (i915 for intel or nouveau for nvidia):

in /etc/mkinitcpio.conf

MODULES=(... i915 ...)

and then run:

# mkinitcpio
Share:
11,893
ForceMagic
Author by

ForceMagic

Programmer, tech enthusiast and good friend all in one!

Updated on September 18, 2022

Comments

  • ForceMagic
    ForceMagic over 1 year

    TL;DR

    gnome-shell does not want to be a Wayland compositor.

    Edit: Sometimes it does want to be, sometimes it doesn't.

    Log

    Dec 31 06:55:26 speedy-desktop gnome-shell[393]: Can't initialize KMS backend: could not find drm kms device
    Dec 31 06:55:29 speedy-desktop /usr/lib/gdm/gdm-x-session[410]: (II) [KMS] Kernel modesetting enabled.
    

    I have 2 video cards. (See LSPCI below)

    Extended Problem

    I've been told that GNOME uses Wayland by default. But for some reason, I don't know how to get them to work together. Arch wiki just mentions the usage of weston and the GDM & GNOME pages don't say anything about wayland... only the GNOME page, but that's only for manual startup.

    ⚡ loginctl show-session c6 -p Type 
    Type=x11 -- GDM
    
    ⚡ loginctl show-session c7 -p Type
    Type=x11 -- GNOME
    

    Tries

    1. Putting export XDG_SESSION_TYPE=wayland to /etc/profile => no result

    2. Reinstalling the gnome group (yaourt -S gnome) => messed up my NetworkManager, but I fixed that myself.

    3. Launching weston from an X session => works, but weston-launch from a tty hanged my PC... (I can't find logs, if you can comment their path, I'll post them, journalctl -xe doesn't seem to contain anything wayland-or-weston-related)

      The only thing I did find in journalctl -xe -b -1 is this:

      Dec 31 07:18:08 speedy-desktop kernel: radeon_dp_aux_transfer_native: 158 callbacks suppressed
      
    4. Put MUTTER_ALLOW_HYBRID_GPUS=1 to /etc/environment => no result

    Almost working...

    I was looking through the journal, and... what did I find?

    Dec 31 04:31:57 speedy-desktop /usr/lib/gdm/gdm-wayland-session[382]: /usr/lib/gio/modules/libgvfsdbus.so: file too short
    Dec 31 04:31:57 speedy-desktop /usr/lib/gdm/gdm-wayland-session[382]: Failed to load module: /usr/lib/gio/modules/libgvfsdbus.so
    

    The file wasn't simply short, it was EMPTY. How? I have no idea.

    After lots of g00gling it turned out that my pacman database was corrupt (somehow), and this one-liner (posted here) fixed it.

    LANG= pacman -Qkk 2>&1 | grep "^.*: no mtree file$" | cut -d: -f1 | sudo xargs pacman -S --force --noconfirm
    

    BUT GNOME still uses X11. I have absolutely no idea why. Here's the problem:

    Dec 31 06:55:26 speedy-desktop gnome-shell[393]: Can't initialize KMS backend: could not find drm kms device
    Dec 31 06:55:29 speedy-desktop /usr/lib/gdm/gdm-x-session[410]: (II) [KMS] Kernel modesetting enabled.
    

    X server knows that there is KMS, but gnome-shell doesn't?! What?

    Configs?

    DEFAULT. I simply haven't touched them. (Or at least I have reversed my modifications)

    LSPCI

    ⚡ lspci | grep VGA
    00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Trinity [Radeon HD 7560D]
    01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde PRO [Radeon HD 7750/8740 / R7 250E]
    

    Any help is appreciated!

    PS: Just ran yaourt -Syu a couple seconds ago.

    • stefan0xC
      stefan0xC over 6 years
      have you tried manually running XDG_SESSION_TYPE=wayland dbus-run-session gnome-session from console? does it also freeze your system?
    • ForceMagic
      ForceMagic over 6 years
      One second... Just FYI, it now works... Partially. Sometimes it starts wayland, sometimes X. I edited the question to clarify.
  • ForceMagic
    ForceMagic about 5 years
    Thank you for the suggestion CondeGil! Even though this is an old post, and this exact solution is for Intel graphics ("i915 for Intel graphics", "amdgpu for AMDGPU, or radeon when using the legacy ATI driver") it might help other people! (Since this I've already moved on to a GTX 1050Ti, which works flawlessly with KMS)