Fedora / Virt-manager : no sound

Hello,

I am running ubuntu as host, and using virt-manager + QEMU/KVM . I am running fedora.

in the guest VM, there is no sound. Sound works well on host.

What can i do to troubleshoot ?

This is from the guest VM:

$> aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault
    Default Audio Device
iec958
    IEC958 (S/PDIF) Digital Audio Output
pipewire
    PipeWire Sound Server
default
    Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=I82801AAICH
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Default Audio Device
front:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Front output / input
surround21:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    4.0 Surround output to Front and Rear speakers
surround41:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
iec958:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    IEC958 (S/PDIF) Digital Audio Output
$> systemctl --user status wireplumber.*
● wireplumber.service - Multimedia Service Session Manager
     Loaded: loaded (/usr/lib/systemd/user/wireplumber.service; enabled; preset: enabled)
    Drop-In: /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Mon 2024-02-19 19:52:52 CET; 16min ago
   Main PID: 1907 (wireplumber)
      Tasks: 6 (limit: 4644)
     Memory: 2.1M
        CPU: 97ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/wireplumber.service
             └─1907 /usr/bin/wireplumber

Feb 19 19:52:52 fedora systemd[1722]: Started wireplumber.service - Multimedia Service Session Manager.
Feb 19 19:52:52 fedora wireplumber[1907]: SPA handle 'api.libcamera.enum.manager' could not be loaded; is it installed?
Feb 19 19:52:52 fedora wireplumber[1907]: PipeWire's libcamera SPA missing or broken. libcamera not supported.
Feb 19 19:52:52 fedora wireplumber[1907]: GetManagedObjects() failed: org.freedesktop.DBus.Error.NameHasNoOwner

those are logs i have seen other thread asked about so here there are :slight_smile:

and i have tried AC97 and HDA(ICH9) both with the same unsuccessful result

thank you !

From the information you provided, it seems like the audio device is recognized within the guest VM, but there might be an issue with the configuration or drivers.

  1. Check Virtual Machine Settings: Ensure that the virtual machine’s audio device is properly configured. In Virt-Manager, go to the VM’s settings and verify that the audio controller is selected and properly configured (e.g., AC97 or HDA).
  2. Check Guest OS Sound Settings: Within the Fedora guest, check the sound settings to ensure the correct output device is selected and the volume is not muted. You can usually find these settings in the system settings or control panel of the guest OS.
  3. Install Guest Additions: If you haven’t already, install the Virtual Machine Guest Additions. These often include drivers that improve compatibility and performance, including for audio.

i hope By going through these steps, you should be able to identify and resolve the sound issue in your Fedora guest VM.

Hello,

thank you for your response.

  1. Yes, I have tried both the AC97 and with the HDA both without success
  2. There is only one sound output in the settings of fedora and it is selected. Also the volume is muted at startup and I was careful to always turn it up for my testing. Is there a way to keep it at the same volume it was set last time instead of always starting muted ?
  3. How could I do this step? would you have a tutorial i can follow or a few cli command i can run ?

Thank you very much

To prevent the volume from being muted at startup and retain the previous volume level in Fedora, you can use the alsactl command to save and restore the audio settings. Here’s a brief guide on how to achieve this:

  1. Save Current Audio Settings: Open a terminal in Fedora and run the following command to save the current audio settings:
sudo alsactl store
  1. Set Startup Volume: To set a specific volume level for startup, you can adjust the volume using the command line or GUI tools, then save the settings using alsactl store.
  2. Create a Startup Script: You can create a startup script that restores the audio settings during boot. Here’s a basic example of a script:
#!/bin/bash
sudo alsactl restore
  1. Make the Script Executable: Save the script to a file (e.g., audio_startup.sh) and make it executable with the following command:
chmod +x audio_startup.sh
  1. Set the Script to Run at Startup: You can add the script to the startup applications list or configure it to run during boot by placing it in the appropriate directory (/etc/init.d/ or /etc/rc.d/) or by adding it to the systemd services.

For more detailed instructions on creating startup scripts or configuring services in Fedora, you can refer to the Fedora documentation or search for tutorials online.

thank you your reponse.

and regarding my other questions ?

re-reading your message, you are talking about Virtual Machine Guest Additions. But i think this is not compatible for my setup with virt-manager and QEMU/KVM.

is it ?

the audio is now working following this Virtual machine audio setup - or how to get pulse audio working - MathiasHueber.com

I think that is just a Virtualbox thing. As he works with Virt-manager there is no need to install it.

sudo dnf list \*additions*

Last metadata expiration check: 0:00:12 ago on Tue 20 Feb 2024 09:48:21 AM -03.
Installed Packages
virtualbox-guest-additions.x86_64                                        7.0.14-1.fc39                                         @System

Thank you , it works now