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

apulse can't open playback device when alsaequal is used #55

Open
worldowner opened this issue Jun 16, 2017 · 18 comments
Open

apulse can't open playback device when alsaequal is used #55

worldowner opened this issue Jun 16, 2017 · 18 comments

Comments

@worldowner
Copy link

I use alsaequal (https://aur.archlinux.org/packages/alsaequal/) to have system-wide alsa equalizer.

Configuration is simple:

$ cat .asoundrc
ctl.equal {
type equal;
}

pcm.plugequal {
type equal;
slave.pcm "plug:dmix";
}

pcm.!default {
type plug;
slave.pcm plugequal;
}

It doesn't work with apulse:

$ apulse firefox
[apulse] [error] do_connect_pcm: can't open playback device "default". Error code -1 (Permission deined)
[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.

I think that sample rate of a signal sent to equalizer doesn't matter. After equalizer does its job signal is sent further to dmix which handles conversion.

@SoniEx2
Copy link

SoniEx2 commented Jun 19, 2017

$ APULSE_PLAYBACK_DEVICE=plugequal apulse firefox

Worked for me until I did a system upgrade.*

@i-rinat
Copy link
Owner

i-rinat commented Jun 19, 2017

until I did a system upgrade

Hmm.

@worldowner, @SoniEx2, have you tried to set "security.sandbox.content.write_path_whitelist" parameter (on about:config page) to "/dev/snd/"?

@SoniEx2
Copy link

SoniEx2 commented Jun 19, 2017

I did.

Right after the system upgrade, I was getting EACCES (-13 I think), then I set that, now I'm getting EPERM (-1) [apulse] [error] do_connect_pcm: can't open playback device "plugequal". Error code -1 (Operation not permitted)...

@SoniEx2
Copy link

SoniEx2 commented Jun 19, 2017

This seems to only happen with firefox...

@SoniEx2
Copy link

SoniEx2 commented Jun 20, 2017

Added all these to security.sandbox.content.write_path_whitelist:

/dev/snd/,/usr/share/alsa/alsa.conf,/usr/share/alsa/cards/,/usr/share/alsa/pcm/,/etc/asound.conf,/usr/share/alsa/alsa.conf.d/,/usr/lib/alsa-lib/libasound_module_pcm_equal.so,/home/soniex2/.alsaequal.bin,/home/soniex2/.asoundrc

And it worked. Sadly no way to filter write path whitelist and read-only path whitelist so this risks my asoundrc...

@worldowner
Copy link
Author

Before sandbox Firefox had rw access to all the files that your user has. So it's still better. If your're concerned about your files just run Firefox in container. I run it in LXC and works fine.

@i-rinat
Copy link
Owner

i-rinat commented Jun 20, 2017

Sadly no way to filter write path whitelist and read-only path whitelist so this risks my asoundrc...

@SoniEx2, as far as I understand, that particular sandbox in Firefox allows accesses to all files for reading. And you only need add paths which need to be writable to the exception list. So, maybe "/dev/snd/,/home/soniex2/.alsaequal.bin" would be enough?

@SoniEx2
Copy link

SoniEx2 commented Jun 20, 2017

Nope. I had to add my asoundrc or else it wouldn't work.

@memeplex
Copy link

memeplex commented Jul 9, 2017

I would like to say that I'm in (very up-to-date) arch using dmix+alsaequal+plug and apulse works out of the box with latest firefox, no need to tweak any settings. Has anything changed since you last discussed about this?

@memeplex
Copy link

memeplex commented Jul 9, 2017

@SoniEx2
Copy link

SoniEx2 commented Jul 9, 2017

@memeplex Please visit about:support and tell me what you see under Application Basics -> Multiprocess Windows.

Edit: Also tell me what you see under Sandbox.

@memeplex
Copy link

memeplex commented Jul 9, 2017

Sure @SoniEx2

Multiprocess Windows 	0/1 (Disabled by add-ons)

Sandbox
---
Seccomp-BPF (System Call Filtering)	true
Seccomp Thread Synchronization	true
User Namespaces	false
Content Process Sandboxing	true
Media Plugin Sandboxing	true
Content Process Sandbox Level	2

@SoniEx2
Copy link

SoniEx2 commented Jul 9, 2017

@memeplex sandbox doesn't work if multiprocess windows is disabled.

@memeplex
Copy link

memeplex commented Jul 9, 2017

You're right @SoniEx2. It was an autoreload addon that was disabling multiprocess windows. Now that I have paused that addon I get not sound anymore. I have set the sandbox whitelist to

  • /dev/snd
  • /usr/share/alsa
  • /usr/lib/alsa-lib
  • /etc/asound.conf (not in my system anyway)
  • /home/carlos/.alsaequal.bin
  • /home/carlos/.asoundrc

but to no avail...

@SoniEx2
Copy link

SoniEx2 commented Jul 9, 2017

needs to be /dev/snd/, /usr/share/alsa/ and same for alsa-lib.

@memeplex
Copy link

memeplex commented Jul 9, 2017

Ahh, ok, shame on me. By trial and error I concluded that I just need to add

  • /dev/snd/
  • /home/carlos/.alsaequal.bin

to get it working. In particular, there was no need of adding ~/.asoundrc.

@worldowner
Copy link
Author

Today I tried on Ubuntu Xenial:

ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_equal.so
[apulse] [error] do_connect_pcm: can't open playback device "default". Error code -6 (No such device or address)

The library exists:
$ ls /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_equal.so
/usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_equal.so

Any ideas?

@eisnerd
Copy link

eisnerd commented Nov 24, 2019

I currently get exactly the same two pulseaudio log lines when trying to load module-alsa-sink for an alsaequal device on 18.04.3. The library exists, ldd shows no missing libs and arch matches, so I have no idea why it doesn't load. It works from other alsa programs, like aplay and mpd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants