Hi Michal,
I can confirm that pipewire daemon is running and configured correctly.
I am able to use it correctly on my host system. Also, if I remove
=runtimeDir=, won't that unset the =PIPEWIRE_RUNTIME_DIR= envvar for
qemu to use? To confirm, here's my output of =pactl info=:
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 73
Tile Size: 65472
Server Name: PulseAudio (on PipeWire 1.0.3)
Server Version: 15.0.0
Default Sample Specification: float32le 2ch 48000Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.pci-0000_04_00.6.analog-stereo
Default Source: alsa_input.pci-0000_04_00.6.analog-stereo
Cookie: 33a9:5803
I checked the logs and tried to find problems but it just shows me the
same error I've seen earlier. Here's the full log:
2024-09-17 12:23:59.460+0000: starting up libvirt version: 9.10.0,
qemu version: 8.2.2, kernel: 6.10.9, hostname: ...
LC_ALL=C \
PATH=/run/current-system/profile/bin:/run/current-system/profile/sbin \
HOME=/var/lib/libvirt/qemu/domain-2-win10 \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-2-win10/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-2-win10/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-2-win10/.config \
PIPEWIRE_RUNTIME_DIR=/run/user/1000 \
/run/current-system/profile/bin/qemu-system-x86_64 \
-name guest=win10,debug-threads=on \
-S \
-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-2-win10/master-key.aes"}'
\
-blockdev
'{"driver":"file","filename":"/usr/share/OVMF/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}'
\
-blockdev
'{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/win10_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}'
\
-machine
pc-q35-8.2,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,hpet=off,acpi=on
\
-accel kvm \
-cpu
host,migratable=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff
\
-m size=8388608k \
-object
'{"qom-type":"memory-backend-ram","id":"pc.ram","size":8589934592}'
\
-overcommit mem-lock=off \
-smp 4,sockets=4,cores=1,threads=1 \
-uuid 66003ed3-ac44-4dfb-ab7f-60da47efb41e \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=31,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=localtime,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
-no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device
'{"driver":"pcie-root-port","port":16,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x2"}'
\
-device
'{"driver":"pcie-root-port","port":17,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x2.0x1"}'
\
-device
'{"driver":"pcie-root-port","port":18,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x2.0x2"}'
\
-device
'{"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}'
\
-device
'{"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}'
\
-device
'{"driver":"pcie-root-port","port":21,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x2.0x5"}'
\
-device
'{"driver":"pcie-root-port","port":22,"chassis":7,"id":"pci.7","bus":"pcie.0","addr":"0x2.0x6"}'
\
-device
'{"driver":"pcie-root-port","port":23,"chassis":8,"id":"pci.8","bus":"pcie.0","addr":"0x2.0x7"}'
\
-device
'{"driver":"pcie-root-port","port":24,"chassis":9,"id":"pci.9","bus":"pcie.0","multifunction":true,"addr":"0x3"}'
\
-device
'{"driver":"pcie-root-port","port":25,"chassis":10,"id":"pci.10","bus":"pcie.0","addr":"0x3.0x1"}'
\
-device
'{"driver":"pcie-root-port","port":26,"chassis":11,"id":"pci.11","bus":"pcie.0","addr":"0x3.0x2"}'
\
-device
'{"driver":"pcie-root-port","port":27,"chassis":12,"id":"pci.12","bus":"pcie.0","addr":"0x3.0x3"}'
\
-device
'{"driver":"pcie-root-port","port":28,"chassis":13,"id":"pci.13","bus":"pcie.0","addr":"0x3.0x4"}'
\
-device
'{"driver":"pcie-root-port","port":29,"chassis":14,"id":"pci.14","bus":"pcie.0","addr":"0x3.0x5"}'
\
-device
'{"driver":"qemu-xhci","p2":15,"p3":15,"id":"usb","bus":"pci.2","addr":"0x0"}'
\
-device
'{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.3","addr":"0x0"}'
\
-blockdev
'{"driver":"file","filename":"/var/lib/libvirt/images/win10.qcow2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-2-format","read-only":false,"discard":"unmap","driver":"qcow2","file":"libvirt-2-storage","backing":null}'
\
-device
'{"driver":"ide-hd","bus":"ide.0","drive":"libvirt-2-format","id":"sata0-0-0","bootindex":1}'
\
-blockdev
'{"driver":"file","filename":"/home/.../VM/iso/Win10_22H2_English_x64v1.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}'
\
-device
'{"driver":"ide-cd","bus":"ide.1","drive":"libvirt-1-format","id":"sata0-0-1"}'
\
-netdev
'{"type":"tap","fd":"32","id":"hostnet0"}'
\
-device
'{"driver":"e1000e","netdev":"hostnet0","id":"net0","mac":"52:54:00:2a:63:ea","bus":"pci.1","addr":"0x0"}'
\
-chardev pty,id=charserial0 \
-device
'{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}'
\
-chardev spicevmc,id=charchannel0,name=vdagent \
-device
'{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"com.redhat.spice.0"}'
\
-device
'{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}'
\
-audiodev
'{"id":"audio1","driver":"pipewire"}' \
-spice
port=5900,addr=127.0.0.1,disable-ticketing=on,image-compression=off,seamless-migration=on
\
-device
'{"driver":"qxl-vga","id":"video0","max_outputs":1,"ram_size":67108864,"vram_size":67108864,"vram64_size_mb":0,"vgamem_mb":16,"bus":"pcie.0","addr":"0x1"}'
\
-device
'{"driver":"ich9-intel-hda","id":"sound0","bus":"pcie.0","addr":"0x1b"}'
\
-device
'{"driver":"hda-duplex","id":"sound0-codec0","bus":"sound0.0","cad":0,"audiodev":"audio1"}'
\
-global ICH9-LPC.noreboot=off \
-watchdog-action reset \
-chardev spicevmc,id=charredir0,name=usbredir \
-device
'{"driver":"usb-redir","chardev":"charredir0","id":"redir0","bus":"usb.0","port":"2"}'
\
-chardev spicevmc,id=charredir1,name=usbredir \
-device
'{"driver":"usb-redir","chardev":"charredir1","id":"redir1","bus":"usb.0","port":"3"}'
\
-device
'{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.4","addr":"0x0"}'
\
-sandbox
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
char device redirected to /dev/pts/1 (label charserial0)
2024-09-17T12:23:59.523098Z qemu-system-x86_64: Failed to
initialize PW context
2024-09-17 12:23:59.563+0000: shutting down, reason=failed
Karl
On 9/17/24 01:13, Michal Prívozník wrote:
> On 9/17/24 08:12, Karl Frederick Roldan wrote:
>> Hi everyone,
>>
>> I'm having trouble regarding using the pipewire backend for libvirt. My
>> OS is GNU Guix with Wayland and pipewire running with wireplumber on a
>> user session. I have the following versions:
>>
>> libvirt-9.10.0 (with pipewire enabled)
>>
>> qemu-8.2.2 (with pipewire enabled)
>>
>> libpipewire-1.0.3
>>
>> I only modified the =<audio>= configuration in the xml file using =sudo
>> virsh edit win10= as follows:
>>
>> <audio id='1' type='pipewire'
runtimeDir='/run/user/1000'/>
>>
>> I can confirm that pipewire is running and that I have pipewire sockets
>> in the directory specified. But when running the VM using virt-manager,
>> I get the following error:
>>
>> Error starting domain: internal error: process exited while
>> connecting to monitor: 2024-09-17T05:54:03.785811Z qemu-system-x86_64:
>> Failed to initialize PW context
>>
>> Traceback (most recent call last):
>> File
>>
"/gnu/store/nxpr6npj618pqmlanqqh7ks9a92jgm98-virt-manager-4.1.0/share/virt-manager/virtManager/asyncjob.py",
line 72, in cb_wrapper
>> callback(asyncjob, *args, **kwargs)
>> File
>>
"/gnu/store/nxpr6npj618pqmlanqqh7ks9a92jgm98-virt-manager-4.1.0/share/virt-manager/virtManager/asyncjob.py",
line 108, in tmpcb
>> callback(*args, **kwargs)
>> File
>>
"/gnu/store/nxpr6npj618pqmlanqqh7ks9a92jgm98-virt-manager-4.1.0/share/virt-manager/virtManager/object/libvirtobject.py",
line 57, in newfn
>> ret = fn(self, *args, **kwargs)
>> File
>>
"/gnu/store/nxpr6npj618pqmlanqqh7ks9a92jgm98-virt-manager-4.1.0/share/virt-manager/virtManager/object/domain.py",
line 1402, in startup
>> self._backend.create()
>> File
>>
"/gnu/store/yaqxaja0ckyf6fm7gnd9iqlrijz6qcqy-python-libvirt-10.6.0/lib/python3.10/site-packages/libvirt.py",
line 1362, in create
>> raise libvirtError('virDomainCreate() failed')
>> libvirt.libvirtError: internal error: process exited while
>> connecting to monitor: 2024-09-17T05:54:03.785811Z qemu-system-x86_64:
>> Failed to initialize PW context
>>
>> If I switch the audio backend back to =spice=, the VM will run but
>> there's no sound. I am not sure if this is a virt-manager problem or I
>> somehow misconfigured libvirt. How should I proceed about this problem?
>>
> Is pipewire daemon running? Also, if you run QEMU under different user
> than UID 1000 then I guess QEMU can't connect to the pipewire socket
> under runtimeDir.
>
> There might be some more info why QEMU was unable to init PW under
> /var/log/libvirt/qemu/$dom.log
>
> Michal
>