Estou tentando fazer com que meu domínio do Windows 10 trabalhe com o qemu usando o virt-manager.
Tudo parece funcionar bem (passagem da GPU, CPU), exceto quando estou executando o console de temperos para ouvir o som. O som está estalando e, ao usar o console gráfico, o mouse está atrasado (e o uso da CPU sobe de 10 a 15%) e parece que eu tenho framedrops.
Estou usando o Synergy agora, então não preciso usar o console gráfico do Spice. O mouse está funcionando bem agora. Mas enquanto não estou usando o console de temperos, não tenho som.
Então, eu mudei o driver de áudio para ac97 (usando os drivers do Windows Vista / 7 da Realtek), o que resolve o estalo um pouco, mas eu ainda tenho quedas de quadro, porque estou usando Spice.
Eu li on-line, deve haver uma maneira de fazê-lo funcionar com o ALSA ou o Pulseaudio e sem um console gráfico como o Spice. Por isso, alterei o arquivo /etc/libvirt/qemu.conf
para ativar vnc_allow_host_audio
/ nographics_allow_host_audio
e agora estou executando o domínio com a variável de ambiente QEMU_AUDIO_DRV=alsa
ou QEMU_AUDIO_DRV=pa
.
Isso produz os erros mostrados no log anexado ( /var/log/libvirt/qemu/win10-gaming.log
).
Como posso fazê-lo funcionar com ALSA / Pulseaudio ou, mais importante, sem Spice?
Atualizar
Nos últimos dias, experimentei algumas coisas, que agora produzem os seguintes erros:
2017-02-24 01:40:15.016+0000: starting up libvirt version: 1.3.1, package: 1ubuntu10.8 (Christian Ehrhardt <[email protected]> Mon, 06 Feb 2017 14:30:46 +0100), qemu version: 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.8), hostname: lindesktop
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin QEMU_AUDIO_DRV=pa /usr/bin/kvm-spice -name win10-gaming -S -machine pc-i440fx-xenial,accel=kvm,usb=off -cpu host,kvm=off -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on -drive file=/var/lib/libvirt/qemu/nvram/win10-gaming_VARS.fd,if=pflash,format=raw,unit=1 -m 8192 -mem-prealloc -mem-path /dev/hugepages/libvirt/qemu -realtime mlock=off -smp 6,sockets=1,cores=2,threads=3 -uuid eb48ea95-aa76-4dad-80c9-1902547899b0 -nographic -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-win10-gaming/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,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 menu=on,strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x6.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x6 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x6.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x6.0x2 -device ahci,id=sata0,bus=pci.0,addr=0x5 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -drive file=/home/michael/Downloads/virtio-win-0.1.126.iso,format=raw,if=none,media=cdrom,id=drive-sata0-0-0,readonly=on -device ide-cd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0 -drive file=/home/michael/Downloads/Windows.iso,format=raw,if=none,media=cdrom,id=drive-sata0-0-1,readonly=on -device ide-cd,bus=sata0.1,drive=drive-sata0-0-1,id=sata0-0-1,bootindex=2 -drive file=/media/michael/0f5fc26f-460c-4aba-9b08-975fbb63b955/win10-gaming.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=27,id=hostnet0,vhost=on,vhostfd=29 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:50:bc:b9,bus=pci.0,addr=0x3 -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x2 -device AC97,id=sound0,bus=pci.0,addr=0x4 -device vfio-pci,host=01:00.0,id=hostdev0,bus=pci.0,addr=0xa -device vfio-pci,host=01:00.1,id=hostdev1,bus=pci.0,addr=0xb -device usb-host,hostbus=1,hostaddr=3,id=hostdev2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9 -msg timestamp=on
Domain id=4 is tainted: custom-argv
Domain id=4 is tainted: host-cpu
shm_open() failed: Permission denied
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init 'pa' audio driver
shm_open() failed: Permission denied
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init 'pa' audio driver
shm_open() failed: Permission denied
Failed to create secure directory (/home/michael/.pulse): Permission denied
Eu segui principalmente, o que o usuário DarthRevan13 aqui ( link ) sugeriu e o que está escrito aqui: link
Meu XML é assim:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>win10-gaming</name>
<uuid>eb48ea95-aa76-4dad-80c9-1902547899b0</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>8388608</currentMemory>
<memoryBacking>
<hugepages/>
</memoryBacking>
<vcpu placement='static'>6</vcpu>
<cputune>
<vcpupin vcpu='0' cpuset='1'/>
<vcpupin vcpu='1' cpuset='2'/>
<vcpupin vcpu='2' cpuset='3'/>
<vcpupin vcpu='3' cpuset='5'/>
<vcpupin vcpu='4' cpuset='6'/>
<vcpupin vcpu='5' cpuset='7'/>
</cputune>
<os>
<type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<nvram>/var/lib/libvirt/qemu/nvram/win10-gaming_VARS.fd</nvram>
<bootmenu enable='yes'/>
</os>
<features>
<acpi/>
<apic/>
<kvm>
<hidden state='on'/>
</kvm>
</features>
<cpu mode='host-passthrough'>
<topology sockets='1' cores='2' threads='3'/>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/home/michael/Downloads/virtio-win-0.1.126.iso'/>
<target dev='sda' bus='sata'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/home/michael/Downloads/Windows.iso'/>
<target dev='sdb' bus='sata'/>
<readonly/>
<boot order='2'/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/media/michael/0f5fc26f-460c-4aba-9b08-975fbb63b955/win10-gaming.qcow2'/>
<target dev='vda' bus='virtio'/>
<boot order='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</controller>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:50:bc:b9'/>
<source bridge='xenbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<sound model='ac97'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</hostdev>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
</hostdev>
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x046d'/>
<product id='0xc24e'/>
</source>
</hostdev>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</memballoon>
</devices>
<qemu:commandline>
<qemu:env name='QEMU_AUDIO_DRV' value='alsa'/>
<qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>
</qemu:commandline>
</domain>
As alterações notáveis incluem:
<qemu:commandline>
<qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
<qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>
</qemu:commandline>
e alterando <emulator>/usr/bin/kvm-spice</emulator>
para <emulator>/usr/bin/kvm</emulator>
no arquivo XML.
Além disso, adicionar
@{HOME}/.pulse/** rw,
em /etc/apparmor.d/abstractions/libvirt-qemu
e recarregando os perfis do apparmor com:
sudo invoke-rc.d apparmor reload
Então, agora posso ouvir o som, mas o áudio do meu host não funciona durante a execução do domínio.