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:
contain following line:

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

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 :)


1 comment:

  1. Can not start it :(
    startplasmacompositor: Starting up...
    dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.systemd1 was not provided by any .service files
    This application failed to start because it could not find or load the Qt platform plugin "wayland-org.kde.kwin.qpa"
    in "".

    Available platform plugins are: wayland-org.kde.kwin.qpa, minimal, offscreen, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

    Reinstalling the application may fix this problem.
    /usr/bin/startplasmacompositor: строка 236: 12455 Аварийный останов /usr/bin/kwin_wayland --xwayland --libinput --exit-with-session=/usr/lib64/libexec/startplasma
    startplasmacompositor: Shutting down...
    xprop: unable to open display ''
    xprop: unable to open display ''
    startplasmacompositor: Done.