qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot get sound in Qemu/KVM vm


From: Ken Moffat
Subject: Re: Cannot get sound in Qemu/KVM vm
Date: Wed, 10 May 2023 05:29:10 +0100
User-agent: Mutt/2.2.10 (2023-03-25)

On Tue, May 09, 2023 at 03:14:14PM -0700, Unknown wrote:
> Hello. I have a Parabola linux x64 host and a Parabola Linux 32-bit
> guest. Parabola is an Arch-based distro. I also have a Windows 7 x64
> guest that lacks audio. 
> 
> lspci in the
> host tells me that I have an Intel 100 Series/C230 Series Chipset
> Family HD Audio Controller and an NVIDIA GM107 High Def Audio
> Controller.
> 

Perhaps it will clarify things if you use the following command in
the host system to see which of them you are actually using:

pactl list short sinks

Ideally, do that for both headphones and whatever else you are using
to hear the audio.  My point is that you seem to have at least two
HDMI audio output devices, and perhaps one or two analogue outputs.

> The host always has sound. The guest used to have sound, but I'd
> continually lose sound after a few days until I restarted the VM. Then
> the guest lost sound completely; I don't know why. Media players,
> youtube videos, etc. seem to play normally, but I simply cannot hear
> anything, with or without headphones. Alsa and pulseaudio are installed
> in the guest.
> 

I note that 'headphones' usually means the sort you plug in to a
2.5mm (described as 1/8" in America) socket, but there are
variations.  And 'without headphones' *could* be a different output
(e.g. analogue audio to headphones, HDMI audio to a TV).

Now please try thati pactl command in the linux guest (*with*
pulseaudio installed).  You can select a specific sink from the
available sinks with

pacmd set-default-sink <sink #>

> I've tried setting QEMU_AUDIO_DRV (to alsa) on the host. I've tried
> all of the sound device settings in libvirt (ICH6, ICH9, and AC97).
> I've tried deleting pulseaudio from the guest. I've tried maxing out the
> volume on both the guest (with alsamixer and pavucontrol) and the host
> (with alsamixer).
> 

Alsa tends to be problematic because it can "own" the audio and
prevent other applications producing sound.  From time to time on a
non-qemu host I've recently lost audio after suspend, but listing
and setting the sinks has restored it.  Worst case it may be
necessary to stop and start an application (killall -HUP whatever).

> Any suggestions? I have read that audio is some sort of ongoing problem
> with KVM. Is this true?
> 

It certainly used to be, but I've been too busy on other things (and
short of disk space) to try recent versions of qemu.  I think I had
working audio with pulse in host and client a year or so ago, but
I'm not 100% sure.

The AC97 controller on real hardware was ancient, seems unlikely to
be what is needed unless the guest is really old linux.  For variants
of HDMI (ICH6, ICH9 I suppose) I tend to enable *all* of the kernel
HDMI variations in a linux guest.

I will suggest that getting sound working in the linux guest is the
first step (you might need to compile your own kernel).  For a
Windows 7 64-bit guest I'm afraid I have no idea what would be
required.

ĸen
-- 
ARTHUR: I am your king!
WOMAN: Well, I didn't vote for you.
 -- Monty Python and The Holy Grail



reply via email to

[Prev in Thread] Current Thread [Next in Thread]