You are not logged in.

#1 2025-07-29 09:10:24

macromal
Member
Registered: 2024-08-03
Posts: 40
Website

Audio configuration for libvirt VM

I'm currently working on configuring audio for my QEMU virtual machine using ALSA and Virt-Manager. The virtual machine recognizes the sound card, as shown in the output of the command below:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: I82801AAICH [Intel 82801AA-ICH], device 0: Intel ICH [Intel 82801AA-ICH]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

However, I'm not getting any sound output from the VM. I suspect there might be some ALSA configuration needed.

Could anyone provide guidance on what configurations I should check or set up to ensure sound works correctly in the virtual machine? Any help would be greatly appreciated!

Thank you!

Last edited by macromal (2025-07-31 17:55:30)

Offline

#2 2025-08-07 05:50:38

sipak
Member
Registered: 2019-02-03
Posts: 50

Re: Audio configuration for libvirt VM

Maybe something else is using alsa. Are you running pulseaudio? Try installing pulseaudio-alsa and qemu-audio-pa. Or pipewire-alsa and qemu-audio-pipewire.

This is on the hypervisor, not the VM. Remember to restart the services.


A problem to do what everybody else does without questioning. A danger to go against the way things are just because. Too much or too little, ivory towers of perfection or functional mess... Balance is what this world needs. Selective, not the middle ground. Objectivity and idealism, but within a pragmatic scope. - Minimalism is achieved through efficiency, not deficiency.

Offline

#3 2025-08-08 20:28:07

macromal
Member
Registered: 2024-08-03
Posts: 40
Website

Re: Audio configuration for libvirt VM

I installed the following PipeWire packages:

# pacman -S pipewire-audio pipewire-alsa wireplumber qemu-audio-pipewire

Next, I modified the virtual machine configuration to use the PipeWire backend:

    <audio id='1' type='pipewire' runtimeDir='/run/user/1000'>
      <input name='fish' streamName='food' latency='100'/>
      <output name='fish' streamName='food' latency='200'/>
    </audio>

After making these changes, QEMU was unable to connect to the PipeWire backend. To resolve this, I updated the /etc/libvirt/qemu.conf file, changing the user and group to my own. However, there may be a better solution available.

The virtual machine starts successfully now, but I'm not getting any sound. Below is the output from the WirePlumber service:

$ systemctl --user status wireplumber
● wireplumber.service
     Loaded: not-found (Reason: Unit wireplumber.service not found.)
     Active: active (running) since Fri 2025-08-08 11:56:19 CEST; 1h 1min ago
 Invocation: ea703cced60b48ea9a76907617316367
   Main PID: 19772 (wireplumber)
      Tasks: 6 (limit: 18219)
     Memory: 5.7M (peak: 6.8M)
        CPU: 968ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/wireplumber.service
             └─19772 /usr/bin/wireplumber

Aug 08 12:52:41 PC wireplumber[19772]: wp-proc-utils: failed to get cgroup for PID 1: Failed to open file “/proc/1/status”: No such file or directory
Aug 08 12:52:41 PC wireplumber[19772]: wp-proc-utils: failed to get cmdline for PID 1: No such file or directory
Aug 08 12:53:14 PC wireplumber[19772]: wp-proc-utils: failed to get status for PID 1592: Failed to open file “/proc/1592/status”: No such file or directory
Aug 08 12:53:14 PC wireplumber[19772]: GLib: GError set over the top of a previous GError or uninitialized memory.
                                       This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
                                       The overwriting error message was: Failed to open file “/proc/1592/cgroup”: No such file or directory
Aug 08 12:53:14 PC wireplumber[19772]: wp-proc-utils: failed to get cgroup for PID 1592: Failed to open file “/proc/1592/status”: No such file or directory
Aug 08 12:53:14 PC wireplumber[19772]: wp-proc-utils: failed to get cmdline for PID 1592: No such file or directory
Aug 08 12:53:18 PC wireplumber[19772]: wp-proc-utils: failed to get status for PID 1592: Failed to open file “/proc/1592/status”: No such file or directory
Aug 08 12:53:18 PC wireplumber[19772]: GLib: GError set over the top of a previous GError or uninitialized memory.
                                       This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
                                       The overwriting error message was: Failed to open file “/proc/1592/cgroup”: No such file or directory
Aug 08 12:53:18 PC wireplumber[19772]: wp-proc-utils: failed to get cgroup for PID 1592: Failed to open file “/proc/1592/status”: No such file or directory
Aug 08 12:53:18 PC wireplumber[19772]: wp-proc-utils: failed to get cmdline for PID 1592: No such file or directory

It seems that WirePlumber is facing issues with missing files in the /proc directory for certain PIDs, which could be affecting sound output.

Offline

#4 2025-08-09 03:17:55

sipak
Member
Registered: 2019-02-03
Posts: 50

Re: Audio configuration for libvirt VM

What? No need to change user. Have you changed anything else like that?
Audio works out of the box with default configuration given the necessary packages are installed and the relevant services running.
I'd revert all those changes, REBOOT, and check if qpwgraph shows any targets, and if you can see the qemu sink.

Errors such as Failed to open file “/proc/1/status”: No such file or directory suggests the problem is permissions. wireplumber should not be trying to open that root-owned proc.

Last edited by sipak (2025-08-09 03:20:24)


A problem to do what everybody else does without questioning. A danger to go against the way things are just because. Too much or too little, ivory towers of perfection or functional mess... Balance is what this world needs. Selective, not the middle ground. Objectivity and idealism, but within a pragmatic scope. - Minimalism is achieved through efficiency, not deficiency.

Offline

#5 2025-08-09 09:08:32

macromal
Member
Registered: 2024-08-03
Posts: 40
Website

Re: Audio configuration for libvirt VM

I reverted the changes related to the user and group settings and attempted to start the virtual machine. However, the following error is displayed:

Error starting domain: internal error: process exited while connecting to monitor: 2025-08-09T08:19:16.644061Z qemu-system-x86_64: Failed to connect to PipeWire instance: Host is down

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 107, in tmpcb
    callback(*args, **kwargs)
    ~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1384, in startup
    self._backend.create()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/libvirt.py", line 1390, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: process exited while connecting to monitor: 2025-08-09T08:19:16.644061Z qemu-system-x86_64: Failed to connect to PipeWire instance: Host is down

Additionally, here is the output of the services:

$ systemctl --user status pipewire wireplumber
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: active (running) since Sat 2025-08-09 10:16:02 CEST; 9min ago
 Invocation: c395421db103447c9bf0f8b4f4eb5628
TriggeredBy: ● pipewire.socket
   Main PID: 3162 (pipewire)
      Tasks: 3 (limit: 18219)
     Memory: 4.7M (peak: 5M)
        CPU: 33ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─3162 /usr/bin/pipewire

Aug 09 10:16:02 PC systemd[1718]: Started PipeWire Multimedia Service.
Aug 09 10:16:02 PC pipewire[3162]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Aug 09 10:16:02 PC pipewire[3162]: mod.rt: RTKit does not give us MaxRealtimePriority, using 1
Aug 09 10:16:02 PC pipewire[3162]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Aug 09 10:16:02 PC pipewire[3162]: mod.rt: RTKit does not give us MinNiceLevel, using 0
Aug 09 10:16:02 PC pipewire[3162]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Aug 09 10:16:02 PC pipewire[3162]: mod.rt: RTKit does not give us RTTimeUSecMax, using -1

● wireplumber.service - Multimedia Service Session Manager
     Loaded: loaded (/usr/lib/systemd/user/wireplumber.service; enabled; preset: enabled)
     Active: active (running) since Sat 2025-08-09 10:16:02 CEST; 9min ago
 Invocation: 337faae4721142df8ba797fc7c389cb3
   Main PID: 3163 (wireplumber)
      Tasks: 6 (limit: 18219)
     Memory: 6M (peak: 7.1M)
        CPU: 151ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/wireplumber.service
             └─3163 /usr/bin/wireplumber

Aug 09 10:16:02 PC wireplumber[3163]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Aug 09 10:16:02 PC wireplumber[3163]: mod.rt: RTKit does not give us MaxRealtimePriority, using 1
Aug 09 10:16:02 PC wireplumber[3163]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Aug 09 10:16:02 PC wireplumber[3163]: mod.rt: RTKit does not give us MinNiceLevel, using 0
Aug 09 10:16:02 PC wireplumber[3163]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Aug 09 10:16:02 PC wireplumber[3163]: mod.rt: RTKit does not give us RTTimeUSecMax, using -1
Aug 09 10:16:02 PC wireplumber[3163]: default: Failed to get percentage from UPower: org.freedesktop.DBus.Error.NameHasNoOwner
Aug 09 10:16:02 PC wireplumber[3163]: spa.bluez5: BlueZ system service is not available
Aug 09 10:16:02 PC wireplumber[3163]: wp-device: SPA handle 'api.libcamera.enum.manager' could not be loaded; is it installed?
Aug 09 10:16:02 PC wireplumber[3163]: s-monitors-libcamera: PipeWire's libcamera SPA plugin is missing or broken. Some camera types may not be supported.

Offline

#6 2025-09-06 23:28:31

macromal
Member
Registered: 2024-08-03
Posts: 40
Website

Re: Audio configuration for libvirt VM

I finally installed PulseAudio and followed the instructions from the wiki to get sound working. Unfortunately, I also tried PipeWire and ALSA, but neither of them worked for me.

Offline

Board footer

Powered by FluxBB