Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google-chrome can't read alsa.conf / audio playback fails #65725

Open
ivan opened this issue Aug 1, 2019 · 2 comments
Open

google-chrome can't read alsa.conf / audio playback fails #65725

ivan opened this issue Aug 1, 2019 · 2 comments
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@ivan
Copy link
Member

ivan commented Aug 1, 2019

Describe the bug

google-chrome can't read alsa.conf, presumably because of Chrome/Chromium's audio sandbox. Chromium in nixpkgs gets patched to support the /nix/store/... paths needed for ALSA.

On my machine that requires dmix (specified in alsa.conf), I usually do not hear audio output in Chrome.

To Reproduce
Steps to reproduce the behavior:

  1. On NixOS master, install google-chrome and run google-chrome-stable
  2. Observe:
ALSA lib conf.c:3956:(snd_config_update_r) Cannot access file /nix/store/ykkyj86i3hdnb47wa49kvrwjwh7amdzz-alsa-lib-1.1.9/share/alsa/alsa.conf
ALSA lib conf.c:3956:(snd_config_update_r) Cannot access file /nix/store/ykkyj86i3hdnb47wa49kvrwjwh7amdzz-alsa-lib-1.1.9/share/alsa/alsa.conf
ALSA lib conf.c:3956:(snd_config_update_r) Cannot access file /nix/store/ykkyj86i3hdnb47wa49kvrwjwh7amdzz-alsa-lib-1.1.9/share/alsa/alsa.conf
ALSA lib pcm.c:2635:(snd_pcm_open_noupdate) Unknown PCM default
[10914:10914:0801/132524.153092:ERROR:alsa_util.cc(204)] PcmOpen: default,No such file or directory
ALSA lib conf.c:3956:(snd_config_update_r) Cannot access file /nix/store/ykkyj86i3hdnb47wa49kvrwjwh7amdzz-alsa-lib-1.1.9/share/alsa/alsa.conf
ALSA lib pcm.c:2635:(snd_pcm_open_noupdate) Unknown PCM plug:default
[10914:10914:0801/132524.153269:ERROR:alsa_util.cc(204)] PcmOpen: plug:default,No such file or directory

Expected behavior

Working audio

Metadata
Please run nix run nixpkgs.nix-info -c nix-info -m and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 4.19.62-hardened, NixOS, 19.09.git.cd22d6f (Loris)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2.2
  • channels(root): ""
  • nixpkgs: /var/nixpkgs

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
@ivan
Copy link
Member Author

ivan commented Aug 1, 2019

I attempted this fix, but Chrome is not a happy camper

diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix
index b0ae61c761d..2f21484e32a 100644
--- a/pkgs/applications/networking/browsers/google-chrome/default.nix
+++ b/pkgs/applications/networking/browsers/google-chrome/default.nix
@@ -129,6 +129,10 @@ in stdenv.mkDerivation rec {
       patchelf --set-rpath $rpath $elf
       patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $elf
     done
+
+    # Let the audio sandbox read alsa.conf
+    # We can't use ${alsaLib}/share/alsa/ because that string is longer than the one we're replacing
+    sed -i -e 's,/usr/share/alsa/,/nix/store/\x00\x00\x00\x00\x00,g' $out/share/google/$appname/chrome
   '';

   meta = {
[1:4:0801/135507.441816:ERROR:render_media_log.cc(27)] MediaEvent: MEDIA_ERROR_LOG_ENTRY {"error":"audio render error"}
[1:1:0801/135507.442259:ERROR:render_media_log.cc(27)] MediaEvent: PIPELINE_ERROR AUDIO_RENDERER_ERROR
[1:4:0801/135508.191290:ERROR:render_media_log.cc(27)] MediaEvent: MEDIA_ERROR_LOG_ENTRY {"error":"audio render error"}
[1:1:0801/135508.274973:ERROR:render_media_log.cc(27)] MediaEvent: PIPELINE_ERROR AUDIO_RENDERER_ERROR

@stale
Copy link

stale bot commented Jun 2, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

1 participant