Sunday, June 18, 2017

openrc + kde + wayland = works!

Wayland, our next gen display manager, isn't actually something new in the linux world. Even trying it out with Weston wasn't something very difficult. While Gnome on wayland usually worked out of the box, KDE on wayland wasn't that straight forward. And as far as i know, the main problem wasn't wayland support in kwin, but managing user logins.

The Status quo:

Gnome on the one hand had a hard dependency on systemd which made wayland support straight forward. (but also excluded openrc as init system)
KDE on the other hand doesn't have a hard dependency on systemd. For KDE consolekit was the equivalent for user management on KDE. However, consolekit doesn't work with wayland and thus KDE didn't work at all with wayland (on openrc).

What changed:

This changed a while ago. Gentoo got a new package called sys-auth/elogind. This package is the missing link between openrc + kde on wayland. It's basically the user manager from systemd extracted into it's own package.

I've tried it now and i can say it works! :)

Getting KDE on Wayland to work:

So how to get Wayland working? As a matter of fact, it didn't worked out of the box with just installing elogind. That's why i decided to write a small blog post to show possible pitfalls enabling elogind. Also a good help for me was following gentoo thread [0].

First of all, as you might expect, elogind replaces consolekit. Even though you can both install at the same time, i made sure not using consolekit anymore. This means:
  • make sure to remove all consolekit use flags set in your package.use file.
  • make sure to remove the consolekit use flag in your make.conf file if present.
  • many packages (like pambase or dbus) got a new use flag named elogind. Since i had consolekit already enabled globally (via make.conf) i've just replaced it with elogind. Otherwise enable the new flag in the package.use file.
  • re-emerge all packages were the useflag changed.

After updating all affected packages, make sure that consolekit is removed from your default runlevel:
rc-update del consolekit default
Also enable elogind for your runlevel:
rc-update add elogind default

A big pitfall for me were actually the pam.d files. You have to make sure that both files:
/etc/pam.d/sddm-greeter
/etc/pam.d/system-login
contain following line:
session▷▷⋅⋅⋅⋅⋅⋅⋅optional pam_elogind.so

After that, Wayland should work as expected. To really make sure elogind works correctly, just login to KDE via X and execute following command:
loginctl

This should give you a output similar to:
SESSION        UID    USER             SEAT             
            5       2000   ai                  seat0            
 
1 sessions listed.

If the output list 0 sesssions, something is wrong with elogind. In that case Wayland login won't work too.

Big thx to the developers who made this possible :)

[0] https://forums.gentoo.org/viewtopic-t-1039678-start-0.html