LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Please help with qemu and pulseaudio (https://www.linuxquestions.org/questions/slackware-14/please-help-with-qemu-and-pulseaudio-4175583479/)

camerabambai 06-30-2016 04:23 PM

Please help with qemu and pulseaudio
 
I want to start a qemu machine,i use this xml

Code:

<domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>name</name>
  <uuid>1111111111111</uuid>
  <memory unit='KiB'>2264064</memory>
  <currentMemory unit='KiB'>2264064</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.6'>hvm</type>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>Opteron_G3</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback' io='threads'/>
      <source file='/var/libvirt/images/slackware.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/linux/slackware-14.2-dvd.iso'/>
      <target dev='sda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='00:00:00:00'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <input type='keyboard' bus='usb'/>
    <input type='tablet' bus='usb'/>
    <graphics type='sdl' display=':0' xauth='/home/user/.Xauthority'/>
    <video>
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='none'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-set'/>
    <qemu:arg value='device.video0.driver=virtio-vga'/>
    <qemu:arg value='-display'/>
    <qemu:arg value='gtk,gl=on'/>
    <qemu:arg value='-enable-kvm'/>
    <qemu:arg value='-soundhw'/>
    <qemu:arg value='ac97,pcspk'/>
    <qemu:env name='SDL_AUDIODRIVER' value='alsa'/>
    <qemu:env name='AUDIODEV' value='hw'/>
    <qemu:env name='QEMU_AUDIO_DRV' value='alsa'/>
    <qemu:env name='QEMU_SDL_SAMPLES' value='2048'/>
  </qemu:commandline>
</domain>

But if i run it give me this error

Code:

errore: internal error: process exited while connecting to monitor: ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: Connection refused
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: Connection refused
audio: Failed to create voice `pcspk'
pcspk: Could not open voice
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: Connection refused
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: Connection refused
audio: Failed to create voice `ac97.pi'
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

alsa: Could not initialize DAC
alsa: Failed to o

Any suggestion?
If i remove soundhw works but no audio,even if i add audiocard
with virt-manager

camerabambai 06-30-2016 04:24 PM

I'm on slackware current/14.2

notKlaatu 06-30-2016 04:26 PM

I don't use virt manager, but I'll take a guess: Is the qemu or libvert user a member of the audio group?

camerabambai 06-30-2016 04:44 PM

Yes,using the qemu app pure without libvirt
works fine,audio and video.
The problem is libvirt.

chris.willing 06-30-2016 05:00 PM

Quote:

Originally Posted by camerabambai (Post 5568634)
Yes,using the qemu app pure without libvirt
works fine,audio and video.
The problem is libvirt.

In your xml, try manually removing the reference to pcspk. I don't use libvirt either and in my "pure" qemu script I have '-soundhw ac97' for audio which works fine.

chris

camerabambai 07-01-2016 12:15 PM

Without Libvirt works fine also for me
Fast and nice.
Solution: for this machine i use pure qemu without libvirt.


All times are GMT -5. The time now is 05:40 AM.