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


Sunday, March 26, 2017

news on my qemu-kvm init script for gentoo

It's been a while since i mentioned my kvm init script in any of my blog post. However, it's still alive and i added a lot of new features over the time. Anyone who is still interested can download it's source on github [1] - it's been there for quite some time.

So what changed since last time i wrote about it? Well, lets see:

  • virgl support (alias -gl)
  • 9p support
  • sdl output support
  • parallel spice and vnc support (enabling spice and vnc in parallel)
  • vnc with password support
  • multiple network cards with support for different bridge devices
  • usb redirect support
  • reset virtual machines (via /etc/init.d/kvm.VM reset)
  • reboot via qemu guest agent (via /etc/init.d/kvm.VM reboot)
The init script in action

Besides that, almost everything in the configuration file changed in order to support all the new features and make it more readable. Another plus it that the init script now should be posix compliant. Furthermore i tried to keep it's dependencies low. Apart from sys-apps/coreutils everything you should need is:

  • app-emulation/qemu[pyhton]
  • net-analyzer/netcat6
  • sys-apps/iproute2
  • sys-process/lsof

I'm working with this script on a daily base and i think it's already very convenient. I also think it still has room for improvements and i'm going to continue adding features as i need them. However, please let me know if you're missing some features. I would like to know what else i could implement.


Monday, February 6, 2017

games depending on pulseaudio

I haven't posted something for quite some time. However, since every now and then I have some idea which i would like to share, I forced myself to start writing again. Hope i can keep up with new posts as new ideas come up in my mind.

Today i would like to share something about steam games which need pulseaudio. I think some of you might already experienced some issues with games when you haven't installed media-sound/pulseaudio. Most notably was probably Tomb Raider.
In that game you haven't had any audio as long as pulseaudio wasn't installed. Since there was quite some noise on the steam forums, they fixed the issue and now it works well even without pulseaudio.
However, Tomb Raider isn't the only game with pulseaudio issues. Another game which made me quite some headaches was Audiosurf 2. The Problem: Besides no audio i couldn't even play the game and it showed me that i was running only the demo. That means, for me, it wasn't clear that pulseaudio was the problem. A long time after writing a post at the steam forums i got some hint's that pulseaudio might be the problem.

Anyway, that time i already fixed the issue differently.
Since Tomb Raider came out I've searched for a way to play the game without pulseaudio. Sadly i couldn't find anything, but found a way were pulseaudio is only a unintrusive pipe to alsa.
I don't know were exactly I read it, but i found a very nice wiki entry on arch [1] , which also worked as expected on gentoo:

First of all i had to install pulseaudio. For that package is important NOT to install the alsa-plugins so first i had to remove the alsa-plugins use flag:

echo "media-sound/pulseaudio -alsa-plugin" >> /etc/portage/package.use

After emerging i it was important to make some configuration changes for pulseaudio:
/etc/pulse/daemon.conf: (everything else in this file is commented out)
exit-idle-time = 0 # Exit as soon as unneeded
flat-volumes = yes # Prevent messing with the master volume

/etc/pulse/client.conf (everything else in this file is commented out)
autospawn = yes

/etc/pulse/ (this file was completely replaced by following)

    # Set tsched=0 here if you experience glitchy playback. This will
    # revert back to interrupt-based scheduling and should fix it.
    # Replace the device= part if you want pulse to use a specific device
    # such as "dmix" and "dsnoop" so it doesn't lock an hw: device.
    load-module module-alsa-source device="default" tsched=1
    load-module module-alsa-sink device="default" tsched=1 
    # Accept clients -- very important
    load-module module-native-protocol-unix

    # Publish to X11 so the clients know how to connect to Pulse. Will
    # clear itself on unload.
    load-module module-x11-publish

With that changes it was possible to play Tomb Raider and also didn't had any problems anymore with Audiosurf 2. While of those games are already quite old, someone might find this information useful for other games.