The Freedesktop runtime reads ~/.asoundrc by default
Description
The Freedesktop runtime (18.08) comes with a /usr/share/alsa/alsa.conf
configuration file that includes the following files:
files [
"/etc/alsa/conf.d"
"/etc/asound.conf"
"~/.asoundrc"
]
If I'm not wrong in Flatpak apps the home directory is either (a) an empty tmpfs (the default) or (b) the user's home directory (if --filesystem=home
was used).
So in the former case ~/.asoundrc
does not exist, and in the latter case it can conflict with the ALSA setup inside the sandbox (see example below).
My understanding is that Flatpak runtimes come with a self-contained ALSA setup and therefore there's no use case for an external ~/.asoundrc
. Is my analysis correct? And if so, shouldn't we stop including that file from the global alsa.conf
?
(an additional, related problem, is that Flatpak honors the ALSA_CONFIG_PATH
variable passed from the host, which inside the sandbox is almost certainly going to point to the wrong file and break things; see https://github.com/flatpak/flatpak/issues/1875 for an example)
How to reproduce the problem
-
Install
net.sf.fuse_emulator
from flathub. -
Create the following
~/.asoundrc
file:
pcm.!default {
type plug
slave { pcm "pulse" }
}
pcm.pulse {
type pulse
}
ctl.mixer0 {
type hw
card 0
}
- Run
flatpak run net.sf.fuse_emulator
. The following error message appears and there's no sound (there should be sound when you type on the emulator):
ALSA lib ../../src/dlmisc.c:170:(snd_dlsym_verify) unable to verify version for symbol _snd_pcm_plug_open
ALSA lib ../../src/dlmisc.c:296:(snd1_dlobj_cache_get) symbol _snd_pcm_plug_open is not defined inside [builtin]
ALSA lib ../../src/dlmisc.c:170:(snd_dlsym_verify) unable to verify version for symbol _snd_pcm_plug_open
ALSA lib ../../src/dlmisc.c:296:(snd1_dlobj_cache_get) symbol _snd_pcm_plug_open is not defined inside [builtin]
fuse: error: couldn't open sound device 'default' and 'plughw:0,0' check ALSA configuration.