我想将 audiodev 传递给虚拟机,但 libvirt 退出并出现此错误
error: internal error: process exited while connecting to monitor: 2024-03-17T23:29:37.725695Z qemu-system-x86_64: XDG_RUNTIME_DIR not set
这些是 vm 的行
<qemu:arg value="-device"/>
<qemu:arg value="usb-audio,audiodev=my_audiodev"/>
<qemu:arg value="-audiodev"/>
<qemu:arg value="pa,id=my_audiodev"/>
我知道可以直接在 xml 中插入声卡,但我想知道为什么会出现此错误,还要尝试“virtio-sound”然后
<qemu:arg value="-device"/>
<qemu:arg value="virtio-sound,audiodev=my_audiodev"/>
<qemu:arg value="-audiodev"/>
<qemu:arg value="pa,id=my_audiodev"/>
当然,如果没有这些行,虚拟机就会运行
qemu-版本是8.2.2 libvirt版本是10.0.0 系统是Slackware 15
该错误来自使用pulseaudio的qemu
qemu-system-x86_64 -audiodev pa,id=hda,out.mixing-engine=off -audiodev pa,id=usb,out.mixing-engine=off
qemu-system-x86_64: XDG_RUNTIME_DIR not set
尝试设置 xdg-runtime-dir..
export XDG_RUNTIME_DIR=$TMPDIR
qemu-system-x86_64 -device usb-audio -audiodev alsa,id=hda,out.mixing-engine=off -audiodev pa,id=usb,out.mixing-engine=off
qemu-system-x86_64: could not stat pidfile /pulse/pid: No such file or directory