Arch Linux: Gnome 3.10 on Wayland

Gnome 3.10 on Wayland

Gnome 3.10 on Wayland

Gnome 3.10 has initial Wayland support and hit the Arch Linux repositories lately, time to give it a try! The gnome packages are available with Wayland support, namely gnome-shell (which includes the gnome-shell-wayland binary) and mutter-wayland.

But I soon realized, that running Gnome on Wayland using Arch is not possible without some work: Firing up mutter-launch with the gnome-shell-wayland, lead to this error:

$ CLUTTER_BACKEND=wayland mutter-launch --verbose -- gnome-shell-wayland --wayland
...
(gnome-shell-wayland:18781): mutter-ERROR **: Spurious exit of X Wayland server

Gnome (or more specific, mutter, the Gnome window manager/compositor) needs a working XWayland version. XWayland is a X-Server running as a Wayland client. Its only used for non Wayland compatible clients, but is a mandatory requirement for mutter right now. The X-Server in the Arch repositories does not support this mode, hence another package is necessary.

Happily, the AUR has such package build instructions (PKGBUILD). Beside XWayland (see xwayland-git) a XWayland compatible graphic driver (DDX) is necessary (in my case this is the Intel driver xf86-video-intel-xwayland-git). Those package are in conflict with the packages from the official repositories. But they can also be used as a traditional X-Server, so you can run your traditional desktop beside the Wayland based desktop.

After installation, switch to a virtual terminal (e.g. Ctrl+Alt+F2), login as an user and launch a Wayland session using gnome-session:

$ gnome-session --session=gnome-wayland

You should now end up in a running Gnome session with the Gnome Shell. In order to have applications using Wayland, they have to be ready for Wayland. Most Gnome applications are since Arch provides GTK with enabled Wayland support. You still need to add an environment variable to force Wayland mode.

$ GDK_BACKEND=wayland gnome-calculator

You can check if an application is using Wayland by checking if the shared memory buffer (SHM) was communicated to the display server through a socket:

$ lsof -p `pidof gnome-calculator` | grep wayland-shm
gnome-cal 26219 sag DEL REG 0,34 241488 /tmp/wayland-shm-ZfFmJv
gnome-cal 26219 sag DEL REG 0,34 239399 /tmp/wayland-shm-wCze76
gnome-cal 26219 sag DEL REG 0,34 239398 /tmp/wayland-shm-BJvHJX
gnome-cal 26219 sag DEL REG 0,34 239397 /tmp/wayland-shm-5IkcmO
gnome-cal 26219 sag DEL REG 0,34 239396 /tmp/wayland-shm-UdkMYE

Alternatively, you can start the application with WAYLAND_DEBUG=1.

Gnome works already quite impressive on Wayland: On my desktop, most application started and are more or less usable! However, there are still lots of bugs, e.g. random crashes of applications, the mouse sometimes disappears, mouse pointer is always an arrow, resizing doesn’t work etc. (YMMV)… Also, virtual terminal change is not possible in the Mutter Wayland compositor  yet, therefor you are locked up in the virtual terminal. If you are able to start a Gnome terminal, you can switch the virtual terminal using the chvt command (or using SSH):

$ sudo chvt 1

Another reliable way of closing Gnome on Wayland is to just unplug your keyboard :-).

To see that Gnome is actually using Wayland you can look at the processes which are running:

$ ps -xfa
...
 1230 ?        Ss     0:00 login -- sag     
 1232 tty2     Ss     0:00  \_ -bash
 1290 tty2     Sl+    0:00      \_ gnome-session --session=gnome-wayland
 1299 tty2     S+     0:00          \_ /usr/bin/mutter-launch -- gnome-shell-wayland --wayland
 1301 tty2     Sl+    0:08          |   \_ gnome-shell-wayland --wayland
 1494 tty2     Sl+    0:00          \_ /usr/bin/python2 /usr/share/system-config-printer/applet.py
 1512 tty2     Sl+    0:00          \_ zeitgeist-datahub
 1523 tty2     SNl+   0:00          \_ /usr/lib/tracker/tracker-miner-fs
 3916 tty2     S+     0:00          \_ /usr/lib/gnome-settings-daemon/gnome-settings-daemon
 1293 tty2     S+     0:00 dbus-launch --exit-with-session gnome-session --session=gnome-wayland

Leave a Comment