Include pulseaudio driver

Bug #304649 reported by hackel
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
kvm (Ubuntu)
Fix Released
Wishlist
Dustin Kirkland 
qemu-kvm (Ubuntu)
Fix Released
Wishlist
Dustin Kirkland 

Bug Description

Binary package hint: kvm

QEMU now includes a pulseaudio driver (pa). As pulseaudio is used standard in Ubuntu, please include it with KVM and QEMU.

Revision history for this message
Christian Roessner (christian-roessner-net) wrote :

I can confirm this. In Jaunty OSS is not loaded at boot time anymore, so kvm does not have sound. So kvm needs to be built with pa. Why not building it with all available options? pa, alsa, oss, sdl? A bad workaround is including the snd-*oss modules into /etc/modules, but then all other apps are cut off concerning sound output.

Christian

Revision history for this message
Christian Roessner (christian-roessner-net) wrote :

Using

export QEMU_AUDIO_DRV=alsa

for kvm enables a alsa-plugin in jaunty. :-)

Revision history for this message
hackel (hackel) wrote :

I have had trouble with this method, and instead have been using SDL as a workaround:

export QEMU_AUDIO_DRV=sdl
export SDL_AUDIODRIVER=pulse

Nonetheless, a native PA driver would be ideal.

Revision history for this message
AJ Lewis (vortechs2000) wrote :

Tried that, and I still don't have audio in windows - which audio device are you using for kvm? I have the es1370 enabled.

Revision history for this message
Christian Roessner (christian-roessner-net) wrote :

I managed to get kvm to play over pulseaudio and it doing a real much better job than alsa oss and sdl.

apt-get source kvm

Change to the debian/patches folder

Edit: reenable_audio_drivers.patch

--- kvm-82+dfsg/configure.orig 2009-01-09 12:32:42.294604874 -0600
+++ kvm-82+dfsg/configure 2009-01-09 12:33:49.098787948 -0600
@@ -146,6 +146,8 @@ fi
     --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
     --kerneldir="$libkvm_kerneldir" \
     --prefix="$prefix" \
+ --audio-drv-list="pa oss alsa sdl" \
+ --audio-card-list="ac97 adlib cs4231a gus" \
     ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
     ${cross_prefix:+"--cpu=$arch"} "${qemu_opts[@]}"
 ) || usage

Put the pa before oss alsa sdl.

Edit: debian/control and modify the file like this:

[...]
Build-Depends: debhelper (>= 7.0.17ubuntu2), pkg-config, quilt (>= 0.40), autotools-dev,
 bzip2, uuid-dev, zlib1g-dev, libsdl1.2-dev, libpulse-dev, libasound2-dev, libgnutls-dev,
 libncurses5-dev, nasm, texi2html, bcc, iasl, device-tree-compiler [powerpc],
 sysv-rc (>= 2.86.ds1-14.1ubuntu2), libx11-dev
[...]

I have put libpulse-dev in this block as shown above.

Simply rebuild the package. I have done this with pbuilder. Using pdebuild --use-pdebuild-internal

Install new package (Mine is amd64) with dpkg -i kvm_83+dfsg-0ubuntu1_amd64.deb

After this your kvm is doing fine with pulse. So please devs! compile kvm with pa, as it is really simple!

[...]
Available drivers:
Name: pa
Description: http://www.pulseaudio.org/
Theoretically supports many playback voices
Theoretically supports many capture voices
Options:
  QEMU_PA_SAMPLES: integer, default = 1024
    buffer size in samples
  QEMU_PA_DIVISOR: integer, default = 2
    threshold divisor
  QEMU_PA_SERVER: string, default = (not set)
    server address
  QEMU_PA_SINK: string, default = (not set)
    sink device name
  QEMU_PA_SOURCE: string, default = (not set)
    source device name
[...]

See the result here: http://www.roessner-net.com/bilder/Bildschirmfoto4.png

Thanks

Revision history for this message
AJ Lewis (vortechs2000) wrote :

Tried the recompiled kvm with the pa driver included. I managed to get sound briefly with other clients connected to the PA server, but then it locked up (the pa server) which also locked up my Gnome desktop. I couldn't do anything until I logged into the console and killed the pulse audio daemon.

I think I'm going to stick to the SDL hack for now.

Revision history for this message
Christian Roessner (christian-roessner-net) wrote : Re: [Bug 304649] Re: Include pulseaudio driver

AJ Lewis schrieb:
> Tried the recompiled kvm with the pa driver included. I managed to get
> sound briefly with other clients connected to the PA server, but then it
> locked up (the pa server) which also locked up my Gnome desktop. I
> couldn't do anything until I logged into the console and killed the
> pulse audio daemon.

I have two questions on that:

1) Do you think it is a kvm or a pulseaudio problem?

2) Is your user running kvm in the pulse-rt group and have you modified
the daemon.conf to have real-time priority? (See the
/usr/share/doce/pulseaudio/README.Debian file)

Maybe it is pulseaudio related??

I am not a developer, so just my thoughts.

Revision history for this message
AJ Lewis (vortechs2000) wrote :

I tried updating things via step 2, and it didn't help. I don't know where the problem is, but since nothing else is locking up PA, it certainly seems like kvm is to blame.

Again, my setup is:

Ubuntu 8.10 w/PA
Firefox running various audio-based things (Pandora, etc)
KVM running winXP with the es1370 audio driver

The windows audio works (though it has a fair bit of static) the first couple times, then the PA daemon locks up and there's an infinite loop of a half second clip and X locks hard until the pa daemon is killed. My AP daemon.conf looks like this:

daemonize = yes
; fail = yes
; disallow-module-loading = no
; use-pid-file = yes
; system-instance = no
; disable-shm = no

high-priority = yes
; nice-level = -11

realtime-scheduling = yes
realtime-priority = 5

; exit-idle-time = -1
; module-idle-time = 20
; scache-idle-time = 20

; dl-search-path = (depends on architecture)

; default-script-file =

; log-target = auto
; log-level = notice

resample-method = speex-float-1
; disable-remixing = no

; no-cpu-limit = no

; rlimit-as = -1
; rlimit-core = -1
; rlimit-data = -1
; rlimit-fsize = -1
; rlimit-nofile = 256
; rlimit-stack = -1
; rlimit-nproc = -1
; rlimit-memlock = -1
; rlimit-nice = 31
; rlimit-rtprio = 9

; default-sample-format = s16le
; default-sample-rate = 44100
; default-sample-channels = 2

default-fragments = 8
default-fragment-size-msec = 10

Revision history for this message
Christian Roessner (christian-roessner-net) wrote :

AJ Lewis schrieb:
...
> Ubuntu 8.10 w/PA

So this might be the difference. I am on jaunty.

dpkg -l pulseaudio kvm
...
||/ Name Version
Beschreibung
+++-===============================-===============================-==============================================================================
hi kvm 1:83+dfsg-0ubuntu1 Full
virtualization on i386 and amd64 hardware
ii pulseaudio 0.9.14-0ubuntu1
PulseAudio sound server

Concerning the daemon.conf, I do have the same settings.

I use WinXP with iTunes inside a guest and have played music several
times and had running firefox, etc. No stability problems. So this must
be the difference between intrepid and jaunty.

Can someone confirm this problem on jaunty?

Revision history for this message
hackel (hackel) wrote :

This is not a support forum, it's a big report. I realize shouldn't have contributed to this myself. The maintainers are well aware of HOW to enable the pa driver, as Christian Roessner described. It's simply a matter of when this makes it into the Debian package file. Until that happens, there is no need for any further bugspam. Thanks.

Revision history for this message
Christian Roessner (christian-roessner-net) wrote :

It´s interesting how people like you treat the attempt to simply help on such problems as bugspam. Thanks for your arrogance and showing how friendly the Ubuntu community really is.

Revision history for this message
Christian Roessner (christian-roessner-net) wrote :

Sorry for my last comment. I take one argument and have started a forum thread. For those of us who are intrested in why I had posted the build stuff, they might like to look there.

http://ubuntuforums.org/showthread.php?p=6624960#post6624960

Revision history for this message
Christian Roessner (christian-roessner-net) wrote :

Has there been any discussion between the developers, yet, if pulseaudio will do it into kvm? Could please someone from the developers give a short information? I fear that the time is running away and pulseaudio will not be included into jaunty, also it would have been so easy including it.

Revision history for this message
hackel (hackel) wrote :

Looks like pa is included in Debian experimental 84+dfsg-2. I hope these changes get migrated here.

Changed in kvm:
importance: Undecided → Wishlist
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

I'll take a look at doing this.

For me, the value would be in allowing our desktop developer to test Pulse Audio.

I'd like to find a way to enable it if it's available, but not make kvm depend on it. I'll have a look at the debian packaging...

:-Dustin

Changed in kvm:
status: New → Confirmed
assignee: nobody → kirkland
status: Confirmed → Triaged
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

I found the commit from Debian here:
 * http://git.debian.org/?p=collab-maint/kvm.git;a=commitdiff;h=9fb481f646ef91b41c16eaf511b70e2a36192343

Let me give this a quick sniff test, and see if it works for me.

:-Dustin

Changed in kvm:
status: Triaged → In Progress
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Christian-

Thanks for the information so far. I have built a new kvm package, and I'm trying to test it.

What is the command line invocation of kvm that I can use to verify that pulse-audio is working?

:-Dustin

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Okay, I was able to get sound in the kvm guest using the following:

$ export QEMU_AUDIO_DRV=alsa
$ export SDL_AUDIODRIVER=pulse
$ kvm -m 1024 -hda jaunty-desktop.img -soundhw all

:-Dustin

Changed in kvm:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kvm - 1:84+dfsg-0ubuntu8

---------------
kvm (1:84+dfsg-0ubuntu8) jaunty; urgency=low

  * debian/patches/dkmsify.patch: handle i686 arch properly, LP: #333632
  * debian/control: kvm-source needs kernel headers
  * debian/kvm-source.postinst: check if necessary headers are installed;
    if not, print a handy error message with instructions, LP: #341159
  * debian/kvm.init: use proper lsb begin/end message logging for cleaner
    usplash interaction, LP: #275009
  * debian/rules, debian/control: Enable pulseaudio audio driver, LP: #304649

 -- Dustin Kirkland <email address hidden> Thu, 12 Mar 2009 00:17:04 -0500

Changed in kvm:
status: Fix Committed → Fix Released
Changed in qemu-kvm (Ubuntu):
status: New → In Progress
importance: Undecided → Wishlist
assignee: nobody → Dustin Kirkland (kirkland)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu-kvm - 0.11.0-0ubuntu2

---------------
qemu-kvm (0.11.0-0ubuntu2) karmic; urgency=low

  * debian/patches/09_qemu-fix-qcow2-backing-file-with-virtio.patch:
    cherry-pick patch from Fedora, fix virtio/qcow2 issues, LP: #420423
  * debian/patches/10_qemu-allow-pulseaudio-to-be-the-default.patch:
    needed to complete the fix for LP: #304649
  * debian/control: improve description of qemu-kvm-extras, LP: #448655

 -- Dustin Kirkland <email address hidden> Sun, 11 Oct 2009 13:16:11 -0500

Changed in qemu-kvm (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Arie Skliarouk (skliarie) wrote :

The latests qemu-kvm (version 0.11.0-0ubuntu6) in karmic still uses ALSA instead of pulseaudio.
This is described in my latests post to another bug over here: https://bugs.launchpad.net/ubuntu/+source/kvm/+bug/393430 (#393430)

Are these two issues duplicates?
Will the bug be fixed in time for karmic?

Revision history for this message
Arie Skliarouk (skliarie) wrote :

As I wrote here: https://bugs.launchpad.net/ubuntu/+source/kvm/+bug/393430
The PA is not working well from KVM:

I added "export QEMU_AUDIO_DRV=pa" to the /etc/default/libvirt-bin and looks like that the parameter is passed to the KVM, as the KVM does not use the /dev/snd/* directly. But then audio from KVM works for couple of seconds only (enough to hear the startup audio from windows, but not much more than that)! Also, in this case the KVM does not appear in list of the pulse-audio configuration applet (under Running applications).

If I use "export QEMU_AUDIO_DRV=alsa" in /etc/default/libvirt-bin, then KVM uses the /dev/snd/* devices and audio from the KVM works (with all the known limitations).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.