Bug 1692047 - alsa audio initialization fails causing QEMU to fail to startup
Summary: alsa audio initialization fails causing QEMU to fail to startup
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: TRACKER-bugs-affecting-libguestfs
TreeView+ depends on / blocked
 
Reported: 2019-03-23 17:57 UTC by Richard W.M. Jones
Modified: 2019-08-13 19:29 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Richard W.M. Jones 2019-03-23 17:57:17 UTC
Description of problem:

$ echo '{ "execute": "qmp_capabilities" }' '{ "execute": "query-qmp-schema" }' '{ "execute": "quit" }' |
  qemu-system-x86_64 -display none -machine "accel=kvm:tcg" -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 90, "minor": 1, "major": 3}, "package": "qemu-4.0.0-0.2.rc0.fc31"}, "capabilities": ["oob"]}}
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM default
sdl: SDL_OpenAudio failed
sdl: Reason: ALSA: Couldn't open audio device: No such file or directory
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM default
sdl: SDL_OpenAudio failed
sdl: Reason: ALSA: Couldn't open audio device: No such file or directory
audio: Failed to create voice `pcspk'
qemu-system-x86_64: Initialization of device isa-pcspk failed: Initializing audio voice failed

and then qemu exits with code 1.

There are several problems here:

(1) All the ALSA error messages and exiting with non-zero code.
Seems like audio is screwed up somehow.

(2) More importantly the normal output from the QMP command
(ie. the "return" statements) is missing.

Version-Release number of selected component (if applicable):

qemu-4.0.0-0.2.rc0.fc31.x86_64

How reproducible:

100%

Steps to Reproduce:
1. See above.

Comment 1 Richard W.M. Jones 2019-03-23 17:59:52 UTC
I see that libvirt sets an environment variable (QEMU_AUDIO_DRV=none) which
indeed suppresses these errors.  Is that the current advice when running qemu
to query QMP?

Comment 2 Richard W.M. Jones 2019-03-23 18:12:00 UTC
I think this is a bug in qemu, but I have suggested a workaround for libguestfs:
https://www.redhat.com/archives/libguestfs/2019-March/msg00128.html

Comment 3 Daniel Berrangé 2019-03-25 10:04:00 UTC
Historically QEMU upstream defaulted to

    --audio-drv-list=oss

This is awful so Fedora has for a long time built QEMU with

    --audio-drv-list=pa,sdl,alsa,oss

Upstream recently tried to change its default to

    --audio-drv-list=pa,alsa,sdl,oss

but it turns out this was bad because both the alsa and sdl audio drivers in QEMU have completely broken probing logic. This causes them to claim they can support audio even when no audio hardware exists on the host. This results in problems like the huge pile of errors shown above which often casues QEMU to fail to start:

  https://bugs.launchpad.net/qemu/+bug/1816052

Thus upstream finally decided on

    --audio-drv-list=pa,oss

None of this explains why you would see a regression in libguestfs though as Fedora has been enabling the broken audio drivers for ages.

I wonder if we should drop  sdl & alsa from Fedora builds though. PulseAudio is good enough for desktop virt under the normal user session. For server virt running as root, spice audio tunnelling is better bet.

There could some people relying on alsa or sdl, but it is problematic as shown above.

Comment 4 Gerd Hoffmann 2019-03-25 14:33:27 UTC
> I wonder if we should drop  sdl & alsa from Fedora builds though. PulseAudio
> is good enough for desktop virt under the normal user session. For server
> virt running as root, spice audio tunnelling is better bet.

> There could some people relying on alsa or sdl, but it is problematic as
> shown above.

All four audio drivers (pa, alsa, sdl, oss) are built as module on modular builds,
so there also is the option to move sdl + alsa to sub-rpms (and not install them
by default) instead of disabling them completely.

Comment 5 Cole Robinson 2019-03-28 22:26:02 UTC
(In reply to Gerd Hoffmann from comment #4)
> 
> All four audio drivers (pa, alsa, sdl, oss) are built as module on modular
> builds,
> so there also is the option to move sdl + alsa to sub-rpms (and not install
> them
> by default) instead of disabling them completely.

fedora qemu packaging has that, qemu-audio-X. qemu-system-X-core doesn't require them, but qemu-system-X does, for back compat.

But like dan says it's not clear what's causing this to pop up now

Comment 6 Ben Cotton 2019-08-13 16:51:45 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 7 Ben Cotton 2019-08-13 19:29:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.


Note You need to log in before you can comment on or make changes to this bug.