[GH-ISSUE #1470] No sound in Firefox (with apulse) #985

Closed
opened 2026-05-05 07:15:54 -06:00 by gitea-mirror · 13 comments
Owner

Originally created by @Hund on GitHub (Aug 15, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1470

I'm running Funtoo with Firefox 54 and Firejail 0.9.46. Since I don't like Pulseaudio, I installed apulse to make the sound work via ALSA instead. The only problem is that I get no sound if I run Firefox with Firejail.

What's wrong?

Originally created by @Hund on GitHub (Aug 15, 2017). Original GitHub issue: https://github.com/netblue30/firejail/issues/1470 I'm running Funtoo with Firefox 54 and Firejail 0.9.46. Since I don't like Pulseaudio, I installed apulse to make the sound work via ALSA instead. The only problem is that I get no sound if I run Firefox with Firejail. What's wrong?
gitea-mirror 2026-05-05 07:15:54 -06:00
Author
Owner

@reinerh commented on GitHub (Aug 16, 2017):

apulse uses LD_PRELOAD for calling different functions than intended.
And firejail is a suid binary. LD_PRELOAD doesn't work with suid binaries.
But using LD_PRELOAD inside the jail should work (though not completely sure).

So it probably depends on how you are starting the browser. ("apulse firejail firefox" vs. "firejail apulse firefox")

<!-- gh-comment-id:322789812 --> @reinerh commented on GitHub (Aug 16, 2017): apulse uses LD_PRELOAD for calling different functions than intended. And firejail is a suid binary. LD_PRELOAD doesn't work with suid binaries. But using LD_PRELOAD _inside_ the jail should work (though not completely sure). So it probably depends on how you are starting the browser. ("apulse firejail firefox" vs. "firejail apulse firefox")
Author
Owner

@Hund commented on GitHub (Aug 17, 2017):

The command apulse firejail firefox lets me start Firefox, but I do not get any sound. And the command firejail apulse firefox results in:

Your Firefox profile cannot be loaded. It may be missing or inaccessible.

And the output from the terminal:

$ firejail apulse firefox
Reading profile /etc/firejail/default.profile
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/disable-passwdmgr.inc
Warning: noroot option is not available

** Note: you can use --noprofile to disable default.profile **

Parent pid 3457, child pid 3458
Child process initialized in 39.82 ms
Error: Access was denied while trying to open files in your profile directory.
<!-- gh-comment-id:322990347 --> @Hund commented on GitHub (Aug 17, 2017): The command `apulse firejail firefox` lets me start Firefox, but I do not get any sound. And the command `firejail apulse firefox` results in: > Your Firefox profile cannot be loaded. It may be missing or inaccessible. And the output from the terminal: ``` $ firejail apulse firefox Reading profile /etc/firejail/default.profile Reading profile /etc/firejail/disable-common.inc Reading profile /etc/firejail/disable-programs.inc Reading profile /etc/firejail/disable-passwdmgr.inc Warning: noroot option is not available ** Note: you can use --noprofile to disable default.profile ** Parent pid 3457, child pid 3458 Child process initialized in 39.82 ms Error: Access was denied while trying to open files in your profile directory. ```
Author
Owner

@SkewedZeppelin commented on GitHub (Aug 17, 2017):

Try "firejail --profile=/etc/firejail/firefox.profile" apulse /usr/bin/firefox"

Also please give this a try https://github.com/i-rinat/apulse#access-errors-in-do_connect_pcm

<!-- gh-comment-id:322993147 --> @SkewedZeppelin commented on GitHub (Aug 17, 2017): Try "firejail --profile=/etc/firejail/firefox.profile" apulse /usr/bin/firefox" Also please give this a try https://github.com/i-rinat/apulse#access-errors-in-do_connect_pcm
Author
Owner

@Hund commented on GitHub (Aug 17, 2017):

It didn't work.

ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/pcm/pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
[apulse] [error] do_connect_pcm: can't open playback device "default". Error code -2 (No such file or directory)
[apulse] [error] do_connect_pcm: failed to open ALSA device. Apulse does no resampling or format conversion, leaving that task to ALSA plugins. Ensure that selected device is capable of playing a particular sample format at a particular rate. They have to be supported by either hardware directly, or by "plug" and "dmix" ALSA plugins which will perform required conversions on CPU.
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/pcm/pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
[apulse] [error] do_connect_pcm: can't open playback device "default". Error code -2 (No such file or directory)
[apulse] [error] do_connect_pcm: failed to open ALSA device. Apulse does no resampling or format conversion, leaving that task to ALSA plugins. Ensure that selected device is capable of playing a particular sample format at a particular rate. They have to be supported by either hardware directly, or by "plug" and "dmix" ALSA plugins which will perform required conversions on CPU.

Regarding the other link, I'm not sure if I explained myself poorly, but sound works in Frirefox if I don't run it with Firejail. :)

<!-- gh-comment-id:322996974 --> @Hund commented on GitHub (Aug 17, 2017): It didn't work. ``` ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:767:(parse_card) cannot find card '0' ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/pcm/pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default [apulse] [error] do_connect_pcm: can't open playback device "default". Error code -2 (No such file or directory) [apulse] [error] do_connect_pcm: failed to open ALSA device. Apulse does no resampling or format conversion, leaving that task to ALSA plugins. Ensure that selected device is capable of playing a particular sample format at a particular rate. They have to be supported by either hardware directly, or by "plug" and "dmix" ALSA plugins which will perform required conversions on CPU. ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:767:(parse_card) cannot find card '0' ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3/src/pcm/pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default [apulse] [error] do_connect_pcm: can't open playback device "default". Error code -2 (No such file or directory) [apulse] [error] do_connect_pcm: failed to open ALSA device. Apulse does no resampling or format conversion, leaving that task to ALSA plugins. Ensure that selected device is capable of playing a particular sample format at a particular rate. They have to be supported by either hardware directly, or by "plug" and "dmix" ALSA plugins which will perform required conversions on CPU. ``` Regarding the other link, I'm not sure if I explained myself poorly, but sound works in Frirefox if I don't run it with Firejail. :)
Author
Owner

@SkewedZeppelin commented on GitHub (Aug 17, 2017):

[apulse] [error] do_connect_pcm: can't open playback device "default". Error code -2 (No such file or directory)

But that error you just posted is what that link explains how to solve. Why that error isn't happening outside of Firejail I don't know, but its worth a try

Access errors in do_connect_pcm
For example, Firefox now have a sandbox, that blocks file access. It has predefined list of allowed paths, but ALSA devices are not included by default. Fortunately, it's possible to add those path by hand. Add "/dev/snd/" to "security.sandbox.content.write_path_whitelist" parameter in about:config. Note that trailing slash in "/dev/snd/" is required.

<!-- gh-comment-id:322998951 --> @SkewedZeppelin commented on GitHub (Aug 17, 2017): > [apulse] [error] do_connect_pcm: can't open playback device "default". Error code -2 (No such file or directory) But that error you just posted is what that link explains how to solve. Why that error isn't happening outside of Firejail I don't know, but its worth a try > Access errors in do_connect_pcm For example, Firefox now have a sandbox, that blocks file access. It has predefined list of allowed paths, but ALSA devices are not included by default. Fortunately, it's possible to add those path by hand. Add "/dev/snd/" to "security.sandbox.content.write_path_whitelist" parameter in about:config. Note that trailing slash in "/dev/snd/" is required.
Author
Owner

@Hund commented on GitHub (Aug 17, 2017):

Oh, I see. I tried that now and it didn't help.

<!-- gh-comment-id:323001531 --> @Hund commented on GitHub (Aug 17, 2017): Oh, I see. I tried that now and it didn't help.
Author
Owner

@netblue30 commented on GitHub (Aug 18, 2017):

Currently apulse is not supported, we'll try to bring it in. Try something much simpler like speaker-test (firejail --noprofile apulse speaker-test).

<!-- gh-comment-id:323348172 --> @netblue30 commented on GitHub (Aug 18, 2017): Currently apulse is not supported, we'll try to bring it in. Try something much simpler like speaker-test (firejail --noprofile apulse speaker-test).
Author
Owner

@h1z1 commented on GitHub (Aug 19, 2017):

Rather then LD_PRELOAD you could modify the rpath of firefox-bin or install apulse system wide. You sure you gave access to the right device? Anything in your asoundrc perhaps?

Two other shell variables you can tweak are ALSA_CARD and ALSA_PCM_CARD (there are others but those are the basics).

<!-- gh-comment-id:323499489 --> @h1z1 commented on GitHub (Aug 19, 2017): Rather then LD_PRELOAD you could modify the rpath of firefox-bin or install apulse system wide. You sure you gave access to the right device? Anything in your asoundrc perhaps? Two other shell variables you can tweak are ALSA_CARD and ALSA_PCM_CARD (there are others but those are the basics).
Author
Owner

@Hund commented on GitHub (Aug 19, 2017):

@netblue30: firejail --noprofile apulse speaker-test works.

@h1z1: I installed apulse via my package manager, so I assume it's available system wide?

I don't have a asoundrc file and I'm not sure what do to with ALSA_CARD or ALSA_PCM_CARD.

<!-- gh-comment-id:323499694 --> @Hund commented on GitHub (Aug 19, 2017): @netblue30: `firejail --noprofile apulse speaker-test` works. @h1z1: I installed apulse via my package manager, so I assume it's available system wide? I don't have a asoundrc file and I'm not sure what do to with `ALSA_CARD` or `ALSA_PCM_CARD`.
Author
Owner

@h1z1 commented on GitHub (Aug 19, 2017):

@Hund make sure something like
speaker-test -c2 -Ddefault

.. Outputs to the right speakers. The two environment variables I gave override whatever default it's detecting.

Also what is the output of cat /proc/asound/cards ? Don't remember tbh if it's something I did or firejail but the config for alsa is not whitelisted, thus not read. At least there's only one place I see a whitelist and it's for ~/.asoundrc which is only part.

<!-- gh-comment-id:323535257 --> @h1z1 commented on GitHub (Aug 19, 2017): @Hund make sure something like `speaker-test -c2 -Ddefault` .. Outputs to the right speakers. The two environment variables I gave override whatever default it's detecting. Also what is the output of `cat /proc/asound/cards` ? Don't remember tbh if it's something I did or firejail but the config for alsa is not whitelisted, thus not read. At least there's only one place I see a whitelist and it's for ~/.asoundrc which is only part.
Author
Owner

@h1z1 commented on GitHub (Aug 19, 2017):

Not entirely sure why the above comment was edited by @Fred-Barclay or that it was even possible??

<!-- gh-comment-id:323550405 --> @h1z1 commented on GitHub (Aug 19, 2017): Not entirely sure why the above comment was edited by @Fred-Barclay or that it was even possible??
Author
Owner

@Fred-Barclay commented on GitHub (Aug 19, 2017):

@h1z1 Sorry about that. I just added code tags to the post to make
this
look like
this.

Cheers!
Fred

<!-- gh-comment-id:323552091 --> @Fred-Barclay commented on GitHub (Aug 19, 2017): @h1z1 Sorry about that. I just added code tags to the post to make this look like `this`. Cheers! Fred
Author
Owner

@Hund commented on GitHub (Aug 21, 2017):

Hm, I went back to Gentoo (for other reasons) and it works just fine now. I'm sure I haven't changed anything? Thank you for your time. :)

<!-- gh-comment-id:323774252 --> @Hund commented on GitHub (Aug 21, 2017): Hm, I went back to Gentoo (for other reasons) and it works just fine now. I'm sure I haven't changed anything? Thank you for your time. :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#985
No description provided.