You are not logged in.
EDIT: Solution
It looks like the issue is due to an interface change between spice-gtk3 0.24-2 and 0.24-3. spice-gtk 0.24-3 changed the audio back-end from pulseaudio to gstreamer.
--------------------------
Hello.
I am trying to run a win7 guest with qemu-kvm and virt-manager.
Everything works well, from VGA passthrough to mouse capture. However, I am unable to play any sound on my pulse audio server.
From the command line, I can see that QEMU_AUDIO_DRV is set to "spice".
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/sbin/qemu-system-x86_64
-name win7test -S -machine pc-i440fx-2.0,accel=kvm,usb=off -cpu Haswell -m 8000 -realtime mlock=off
-smp 3,sockets=3,cores=1,threads=1 -uuid a8c14df6-1af1-45c0-8afe-f9117ad863ac -no-user-config
-nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/win7test.monitor,server,nowait
-mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -global
kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global
PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -device
ahci,id=ahci0,bus=pci.0,addr=0xa -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6
-drive file=/home/username/VirtualMachines/windowsTest.img,if=none,id=drive-ide0-0-0,format=raw
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -fsdev
local,security_model=passthrough,id=fsdev-fs0,path=/home/username/shared_test,readonly -device
virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=test_share,bus=pci.0,addr=0x9 -netdev tap,fd=21,id=hostnet0
-device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:e8:7c:85,bus=pci.0,addr=0x3 -chardev pty,id=charserial0
-device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0
-spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device
qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device
intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0
-chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0
-chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1
-chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2
-chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3 -device
vfio-pci,host=01:00.0,id=hostdev0,bus=pci.0,addr=0x8,rombar=1 -device usb-host,hostbus=1,hostaddr=7,id=hostdev1
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on
The odd part is that the sound used to work, and according to the logs, QEMU_AUDIO_DRV=spice was set since day 1.
It stopped after the following actions:
1. moved the whole arch installation to a new hard drive.
2. upgraded my user to administrator
3. system upgrade
I have googled around, but I was unable to find a way to let spice to connect to pulse audio server. I could not even find how to set QEMU_AUDIO_DRV with virt-manager.
I also tried changing the qemu user from root to my own, to no avail.
Best regards.
--
Calsir
Last edited by calsir (2014-08-28 16:27:33)
Offline
Does QEMU_AUDIO_DRV also accept 'alsa' as value? If so, with pulseaudio-alsa and without any ~/.asoundrc, you should get sound from them vm through alsa through pulseaudio to alsa.
Offline
Does QEMU_AUDIO_DRV also accept 'alsa' as value? If so, with pulseaudio-alsa and without any ~/.asoundrc, you should get sound from them vm through alsa through pulseaudio to alsa.
Hello.
It does, when I call qemu from command line I am able to set the variable as I like. However, calling from cli plays odd with my other video card (Intel HD). I have not found a way to add the environment variable to libvirt or qemu configuration files.
Also, the sounds gets out slowly, but I think this might be solvable, as I found something about it on the web.
Last edited by calsir (2014-08-24 11:51:37)
Offline
Have you tried exporting the variable in ~/.*profile? I am guessing, since I do not use qemu that often and certainly not for audio, but there are some older threads suggesting that. Should you find something relevant, please post it here.
Offline
Have you tried exporting the variable in ~/.*profile? I am guessing, since I do not use qemu that often and certainly not for audio, but there are some older threads suggesting that. Should you find something relevant, please post it here.
I tried adding the variable to my .zprofile,, but libvirt explicitly calls qemu with QEMU_AUDIO_DRV=spice
Offline
Then you have to look into getting pulseaudio to work with spice, where I have absolutely no experience. Maybe it has to do with pulseaudio permissions/networking aspects. Could it be that spice needs additional packages? Does dmesg or journalctl output anything relevant, qemu should have its own logs.
Offline
Then you have to look into getting pulseaudio to work with spice, where I have absolutely no experience. Maybe it has to do with pulseaudio permissions/networking aspects. Could it be that spice needs additional packages? Does dmesg or journalctl output anything relevant, qemu should have its own logs.
dmesg:
[ 2603.494812] device vnet0 entered promiscuous mode
[ 2603.521451] virbr2: port 2(vnet0) entered listening state
[ 2603.521455] virbr2: port 2(vnet0) entered listening state
[ 2604.343380] vfio-pci 0000:01:00.0: enabling device (0400 -> 0403)
[ 2604.367107] vfio_ecap_init: 0000:01:00.0 hiding ecap 0x19@0x270
[ 2604.367114] vfio_ecap_init: 0000:01:00.0 hiding ecap 0x1b@0x2d0
[ 2605.525495] virbr2: port 2(vnet0) entered learning state
[ 2607.529606] virbr2: topology change detected, propagating
[ 2607.529612] virbr2: port 2(vnet0) entered forwarding state
[ 2621.662202] vfio-pci 0000:01:00.0: irq 47 for MSI/MSI-X
Journalctl:
Aug 24 19:04:14 _hostname_ libvirtd[509]: Domain id=4 name='win7base' uuid=7af838de-2750-46f3-8f27-aa609f263158 is tainted: high-privileges
Aug 24 19:04:14 _hostname_ dbus[249]: [system] Activating via systemd: service name='org.freedesktop.machine1' unit='dbus-org.freedesktop.machine1.service'
Aug 24 19:04:14 _hostname_ systemd[1]: Starting Virtual Machine and Container Registration Service...
Aug 24 19:04:15 _hostname_ dbus[249]: [system] Successfully activated service 'org.freedesktop.machine1'
Aug 24 19:04:15 _hostname_ systemd[1]: Started Virtual Machine and Container Registration Service.
Aug 24 19:04:15 _hostname_ systemd[1]: Starting Virtual Machine qemu-win7base.
Aug 24 19:04:15 _hostname_ systemd-machined[1771]: New machine qemu-win7base.
Aug 24 19:04:15 _hostname_ systemd[1]: Started Virtual Machine qemu-win7base.
Aug 24 19:04:15 _hostname_ kernel: vfio-pci 0000:01:00.0: enabling device (0400 -> 0403)
Aug 24 19:04:15 _hostname_ kernel: vfio_ecap_init: 0000:01:00.0 hiding ecap 0x19@0x270
Aug 24 19:04:15 _hostname_ kernel: vfio_ecap_init: 0000:01:00.0 hiding ecap 0x1b@0x2d0
Aug 24 19:04:16 _hostname_ kernel: virbr2: port 2(vnet0) entered learning state
Aug 24 19:04:17 _hostname_ gdm-Xorg-:0[274]: The XKEYBOARD keymap compiler (xkbcomp) reports:
Aug 24 19:04:17 _hostname_ gdm-Xorg-:0[274]: > Warning: Compat map for group 2 redefined
Aug 24 19:04:17 _hostname_ gdm-Xorg-:0[274]: > Using new definition
Aug 24 19:04:17 _hostname_ gdm-Xorg-:0[274]: > Warning: Compat map for group 3 redefined
Aug 24 19:04:17 _hostname_ gdm-Xorg-:0[274]: > Using new definition
Aug 24 19:04:17 _hostname_ gdm-Xorg-:0[274]: > Warning: Compat map for group 4 redefined
Aug 24 19:04:17 _hostname_ gdm-Xorg-:0[274]: > Using new definition
Aug 24 19:04:17 _hostname_ gdm-Xorg-:0[274]: Errors from xkbcomp are not fatal to the X server
Aug 24 19:04:18 _hostname_ gdm-Xorg-:0[274]: The XKEYBOARD keymap compiler (xkbcomp) reports:
Aug 24 19:04:18 _hostname_ gdm-Xorg-:0[274]: > Warning: Compat map for group 2 redefined
Aug 24 19:04:18 _hostname_ gdm-Xorg-:0[274]: > Using new definition
Aug 24 19:04:18 _hostname_ gdm-Xorg-:0[274]: > Warning: Compat map for group 3 redefined
Aug 24 19:04:18 _hostname_ gdm-Xorg-:0[274]: > Using new definition
Aug 24 19:04:18 _hostname_ gdm-Xorg-:0[274]: > Warning: Compat map for group 4 redefined
Aug 24 19:04:18 _hostname_ gdm-Xorg-:0[274]: > Using new definition
Aug 24 19:04:18 _hostname_ gdm-Xorg-:0[274]: Errors from xkbcomp are not fatal to the X server
Aug 24 19:04:18 _hostname_ kernel: virbr2: topology change detected, propagating
Aug 24 19:04:18 _hostname_ kernel: virbr2: port 2(vnet0) entered forwarding state
Aug 24 19:04:33 _hostname_ kernel: vfio-pci 0000:01:00.0: irq 47 for MSI/MSI-X
Aug 24 19:04:35 _hostname_ dnsmasq-dhcp[590]: DHCPREQUEST(virbr2) 192.168.100.157 52:54:00:8f:24:18
Aug 24 19:04:35 _hostname_ dnsmasq-dhcp[590]: DHCPACK(virbr2) 192.168.100.157 52:54:00:8f:24:18 winName
Aug 24 19:04:38 _hostname_ dnsmasq-dhcp[590]: DHCPINFORM(virbr2) 192.168.100.157 52:54:00:8f:24:18
Aug 24 19:04:38 _hostname_ dnsmasq-dhcp[590]: DHCPACK(virbr2) 192.168.100.157 52:54:00:8f:24:18 winName
qemu log:
2014-08-24 16:27:12.956+0000: shutting down
2014-08-24 17:04:14.969+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/sbin/qemu-system-x86_64 -name [snipped]
Domain id=4 is tainted: high-privileges
char device redirected to /dev/pts/1 (label charserial0)
main_channel_link: add main channel client
main_channel_handle_parsed: net test: latency 0.560000 ms, bitrate 81920000000 bps (78125.000000 Mbps)
red_dispatcher_set_cursor_peer:
inputs_connect: inputs channel client create
qemu: terminating on signal 15 from pid 509
red_channel_client_disconnect_dummy: rcc=0x7f2c9096d110 (channel=0x7f2c90828a50 type=5 id=0)
snd_channel_put: SndChannel=0x7f2c90999c90 freed
red_channel_client_disconnect_dummy: rcc=0x7f2c909b3e40 (channel=0x7f2c90863180 type=6 id=0)
snd_channel_put: SndChannel=0x7f2c909a3600 freed
2014-08-24 17:07:14.107+0000: shutting down
I'll take a look into the interaction between spice and pulseaudio.
Besides, the tainting of the domain is odd: the process is run as my own user.
Thanks again for the help.
Offline
Thanks again for the help.
I do not think that I helped yet. Maybe Rasi or V1del can have a look here. One workaround that just came to me, would be sed'ing libvirt to replace spice with alsa*. Maybe it would work, but be prepared to reinstall the library afterwards.
Edit: *Only the relevant part of course.
Last edited by emeres (2014-08-24 17:42:02)
Offline
Using spice everything seems to work fine on my side. Did you install Spice guest tools on the guest?
Offline
Using spice everything seems to work fine on my side. Did you install Spice guest tools on the guest?
I tried, but it had no effect.
I think that there is something wrong between spice and pulseaudio.
Offline
In my case, it required no special settings (using pulseaudio + spice). How is pulseaudio started in your case? Through the DE session I take it? I run qemu through libvirtd as user 'nobody' (pulse running as my user) and it works. Did you add the Spice channel in the VM settings?
Offline
In my case, it required no special settings (using pulseaudio + spice). How is pulseaudio started in your case? Through the DE session I take it? I run qemu through libvirtd as user 'nobody' (pulse running as my user) and it works. Did you add the Spice channel in the VM settings?
Hello.
PulseAudio is started twice, once by gdm and once by my user:
% ps aux | grep pulse
gdm 410 0.0 0.0 436880 11576 ? S<l 08:12 0:00 /usr/bin/pulseaudio --start --log-target=syslog
gdm 424 0.0 0.0 76720 5272 ? S 08:12 0:00 /usr/lib/pulse/gconf-helper
myuser 750 1.1 0.0 373900 10932 ? S<l 08:15 0:14 /usr/bin/pulseaudio --start
myuser 762 0.0 0.0 76588 3084 ? S 08:15 0:00 /usr/lib/pulse/gconf-helper
Spice channel was added by virt-manager when I created the vm:
Device type: spicevmc
Target type: virtio
Target name: com.redhat.spice.0
Edit: I tried killing both pulseaudio processes (sequentially): killing the one started by my user just causes its respawn. The one started by gdm stays killed, but the issue with the vm is not solved.
Last edited by calsir (2014-08-25 06:52:45)
Offline
Edit: I tried killing both pulseaudio processes (sequentially): killing the one started by my user just causes its respawn. The one started by gdm stays killed, but the issue with the vm is not solved.
To prevent from re-spawning configure:
autospawn = no
Offline
calsir wrote:Edit: I tried killing both pulseaudio processes (sequentially): killing the one started by my user just causes its respawn. The one started by gdm stays killed, but the issue with the vm is not solved.
To prevent from re-spawning configure:
autospawn = no
So, witout autospawn only my own user process is launched and gdm launches none. It does not change the situation.
In the meantime, I found this email exchange: http://lists.freedesktop.org/archives/s … 08079.html
So I performed a test:
using spicec -h localhost -p 5900 I get audio (though with poor quality) [spicec interfaces with alsa]
using spicy -h localhost -p 5900 I get no audio. [spicy interfaces with pulseaudio]
It looks like the issue is really with the interaction between pulseaudio and spice-gtk3.
Offline
Symlinking spicec to spicy probably does not work. What are you trying to run within win7 that needs sound?
Offline
Symlinking spicec to spicy probably does not work. What are you trying to run within win7 that needs sound?
games
Offline
I have downgraded from spice-gtk3 0.24-3 to 0.24-2 and I have the sound back on my guests.
It seems that 0.24-3 uses gstreamer while 0.24-2 uses pulseaudio.
Does anyone know why the back-end changed between these versions?
Offline
If there has been a regression caused by build settings, you should probably notify the maintainer of spice-gtk3 (through the mailing list or the bug tracker).
Last edited by Pse (2014-08-27 02:27:03)
Offline