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.

[1] https://github.com/mm1ke/qemu-init

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)
#/etc/pulse/daemon.conf
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)
#/etc/pulse/client.conf
autospawn = yes

/etc/pulse/default.pa (this file was completely replaced by following)
#/etc/pulse/default.pa

.fail
    # 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.
    
    # INPUT/RECORD
    load-module module-alsa-source device="default" tsched=1
    
    # OUTPUT/PLAYBACK
    load-module module-alsa-sink device="default" tsched=1 
    
    # Accept clients -- very important
    load-module module-native-protocol-unix

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

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.

[1] https://wiki.archlinux.org/index.php/PulseAudio/Examples#PulseAudio_as_a_minimal_unintrusive_dumb_pipe_to_ALSA