|
I've been struggling with KVM a little bit the last few days because i wanted sound in some of my graphical KVM experiments.
To make a long story short, I now hate Apparmor. It has been denying my sound for a long time, but no more.
Also i had to make these configuration changes.
File : /etc/libvirt/qemu.conf
user = "bart"
group = "bart"
vnc_allow_host_audio = 1
Here is some of the logging you can find when it is not working:
File : /var/log/kern.log
Oct 31 18:11:25 bambam kernel: [42042.152768] type=1400 audit(1320081085.115:531): apparmor="DENIED" operation="open" parent=1 profile="libvirt-edf3aaad-2508-cd6d-26cb-4833e422e44f" name="/data/ho
me/bart/.pulse-cookie" pid=24455 comm="kvm" requested_mask="rwc" denied_mask="rwc" fsuid=1000 ouid=1000
Oct 31 18:11:25 bambam kernel: [42042.152778] type=1400 audit(1320081085.115:532): apparmor="DENIED" operation="open" parent=1 profile="libvirt-edf3aaad-2508-cd6d-26cb-4833e422e44f" name="/data/home/bart/.pulse-cookie" pid=24455 comm="kvm" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Oct 31 18:11:25 bambam kernel: [42042.161602] type=1400 audit(1320081085.125:533): apparmor="DENIED" operation="open" parent=1 profile="libvirt-edf3aaad-2508-cd6d-26cb-4833e422e44f" name="/data/home/bart/.pulse/" pid=24455 comm="kvm" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Oct 31 18:11:25 bambam kernel: [42042.161612] type=1400 audit(1320081085.125:534): apparmor="DENIED" operation="rmdir" parent=1 profile="libvirt-edf3aaad-2508-cd6d-26cb-4833e422e44f" name="/data/home/bart/.pulse/" pid=24455 comm="kvm" requested_mask="d" denied_mask="d" fsuid=1000 ouid=1000
Oct 31 18:11:25 bambam kernel: [42042.383934] type=1400 audit(1320081085.345:535): apparmor="DENIED" operation="open" parent=24469 profile="libvirt-edf3aaad-2508-cd6d-26cb-4833e422e44f" name="/proc/24470/fd/" pid=24470 comm="threaded-ml" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Oct 31 18:11:25 bambam kernel: [42042.384372] type=1400 audit(1320081085.345:536): apparmor="DENIED" operation="exec" parent=24469 profile="libvirt-edf3aaad-2508-cd6d-26cb-4833e422e44f" name="/usr/bin/pulseaudio" pid=24470 comm="threaded-ml" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
Oct 31 18:11:25 bambam kernel: [42042.402881] type=1400 audit(1320081085.365:537): apparmor="DENIED" operation="open" parent=1 profile="libvirt-edf3aaad-2508-cd6d-26cb-4833e422e44f" name="/data/home/bart/.pulse-cookie" pid=24455 comm="kvm" requested_mask="rwc" denied_mask="rwc" fsuid=1000 ouid=1000
File: /var/log/libvirt/qemu/your_kvm_guest.log
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin /usr/bin/kvm -S -M pc-0.14 -enable-kvm -m 3000 -smp 2,sockets=2,cores=1,threads=1 -name win7x86oct -uuid edf3aaad-2508-cd6d-26cb-4833e422e44f -nodefconfig -nodefa
ults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/win7x86oct.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=localtime -boot c -drive file=/dev/VG0/win7x86oct,if=none,id=drive-ide0-0-0,forma
t=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/data/software/Microsoft/ISO/Win7_Enterprise_x86_SP1_2011-10_EN.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=
ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=18,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:1f:fe:dc,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -u
sb -device usb-tablet,id=input0 -vnc 127.0.0.1:1 -vga std -device AC97,id=sound0,bus=pci.0,addr=0x6 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
char device redirected to /dev/pts/2
kvm: -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:1f:fe:dc,bus=pci.0,addr=0x3: pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Internal error
Failed to create secure directory: Permission denied
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Connection refused
audio: Failed to create voice `ac97.pi'
Failed to create secure directory: Permission denied
pulseaudio: pa_simple_new for playback failed
pulseaudio: Reason: Connection refused
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for playback failed
pulseaudio: Reason: Internal error
audio: Failed to create voice `ac97.po'
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Internal error
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Internal error
audio: Failed to create voice `ac97.mc'
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Internal error
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Internal error
audio: Failed to create voice `ac97.pi'
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for playback failed
pulseaudio: Reason: Internal error
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for playback failed
pulseaudio: Reason: Internal error
audio: Failed to create voice `ac97.po'
Failed to create secure directory: Permission denied
waitpid(): No child processes
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Internal error
Failed to create secure directory: Permission denied
I now removed apparmor with the following commands and a reboot.
/etc/init.d/apparmor stop update-rc.d -f apparmor remove apt-get remove apparmor apparmor-utils
After a reboot it just works.
Here is what you should see:
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin /usr/bin/kvm -S -M pc-0.14 -enable-kvm -m 3000 -smp 2,sockets=2,cores=1,threads=1 -name win7x86oct -uuid edf3aaad-2508-cd6d-26cb-4833e422e44f -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/win7x86oct.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=localtime -boot c -drive file=/dev/VG0/win7x86oct,if=none,id=drive-ide0-0-0,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/data/software/Microsoft/ISO/Win7_Enterprise_x86_SP1_2011-10_EN.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=18,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:1f:fe:dc,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:1 -vga std -device AC97,id=sound0,bus=pci.0,addr=0x6 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
char device redirected to /dev/pts/2
kvm: -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:1f:fe:dc,bus=pci.0,addr=0x3: pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
(don't mind the pxe error, it doesn't bother me (yet))
File: /var/log/kern.log
Oct 31 18:29:30 bambam kernel: [ 725.760350] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x8
Oct 31 18:29:30 bambam kernel: [ 725.760368] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x8
Oct 31 18:29:30 bambam kernel: [ 725.761057] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x4
Oct 31 18:29:30 bambam kernel: [ 725.761065] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x6
Oct 31 18:29:30 bambam kernel: [ 725.761072] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x5
Oct 31 18:29:30 bambam kernel: [ 725.761078] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0xa
Oct 31 18:29:30 bambam kernel: [ 725.761084] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x3
Oct 31 18:29:30 bambam kernel: [ 725.761090] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x2
Oct 31 18:29:30 bambam kernel: [ 725.761096] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x2
Oct 31 18:29:30 bambam kernel: [ 725.761100] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0xb
Oct 31 18:29:30 bambam kernel: [ 725.761127] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x4
Oct 31 18:29:30 bambam kernel: [ 725.761131] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x6
Oct 31 18:29:30 bambam kernel: [ 725.761135] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x5
Oct 31 18:29:30 bambam kernel: [ 725.761139] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0xa
Oct 31 18:29:30 bambam kernel: [ 725.761143] ALSA hda_codec.c:1475 hda_codec_cleanup_stream: NID=0x3
File: /var/log/libvirt/qemu/your_kvm_guest.log
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin /usr/bin/kvm -S -M pc-0.14 -enable-kvm -m 3000 -smp 2,sockets=2,cores=1,threads=1 -name win7x86oct -uuid edf3aaad-2508-cd6d-26cb-4833e422e44f -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/win7x86oct.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=localtime -boot c -drive file=/dev/VG0/win7x86oct,if=none,id=drive-ide0-0-0,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/data/software/Microsoft/ISO/Win7_Enterprise_x86_SP1_2011-10_EN.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=18,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:1f:fe:dc,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:1 -vga std -device AC97,id=sound0,bus=pci.0,addr=0x6 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
char device redirected to /dev/pts/2
kvm: -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:1f:fe:dc,bus=pci.0,addr=0x3: pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
Have fun with the sound
|