:: Re: [DNG] Firefox, sudo and apulse …
Kezdőlap
Delete this message
Reply to this message
Szerző: g4sra
Dátum:  
Címzett: dng@lists.dyne.org
Tárgy: Re: [DNG] Firefox, sudo and apulse (was Re: Steam, Mumble, Valheim, Alsa and shared audio)
On Tuesday, August 31st, 2021 at 4:21 PM, hal <vmlinux@???> wrote:
> On 8/28/21 13:24, g4sra via Dng wrote:
> > Install 'apulse' which are a sort of pulseaudio compatability libraries.
> apulse hasn't been working for me with Firefox for at least a year now. I don't know if I messed it up or if it was some software change, but it just stopped working once. Firefox doesn't seem to have FOSS in the focus so much anymore so always thought maybe they did something (again).
> I just tried ff now running as my LXDE logged in user[1] and using sudo[2]. Both generated some apulse complaints I have to look into. my "default" dev is the onboard sound chip which might be in use with another application I have open.
> Maybe I need to make "default" one of my dmix devices and not the "raw device", or I need to specify a playback rate in /etc/asound.conf like I've seen in some ALSA examples? hmm..

You are correct in that you definitely do not want a "raw device" as your default.

> ::::::: apulse errors :::::::
> [apulse] [error] do_connect_pcm: can't get initial hw parameters for playback device "default". Error code 1 (Operation not permitted)

Permissions error, likely 'User' related.

> [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.

The selected device is not capable of handling the data format, so you need to change your "default" device configuration.

> ::::::: cards/devices :::::::
> $ cat /proc/asound/cards
> 0 [PCH ]: HDA-Intel - HDA Intel PCH
> HDA Intel PCH at 0xfbff8000 irq 37
>


> ::::::: snipped /etc/asound.conf :::::::
> $ cat /etc/asound.conf
>


> ...
> pcm.!default {
> type plug
> slave.pcm "duplex"
> }
>


> ctl.!default {
> type hw
> card 0
> }

Check to make sure you do not have a ~/.asoundrc overriding /etc/asound.conf

> > This may (and I do mean 'may') be your Desktop not releasing the audio devices, google that for your specific desktop to find out how to make it release them when you launch steam.


> [1] $ /usr/bin/apulse /home/apps/firefox/firefox -ProfileManager


> [2] $ sudo -u webuser /usr/bin/apulse /home/apps/firefox/firefox -ProfileManager

Switching 'User's in a GUI without re-logging is not always straightforward, session management can get in the way and conflict with the GUI.

In case you are unaware....
To simplify the GUI side, use 'xauth'

get user_one's cookie:
user_one# xauth -n list localhost/unix:0
localhost/unix:0 MIT-MAGIC-COOKIE-1 83c12a394ac0c5afe1fee0a973b9e49g

then give the cookie to user_two:
user_two# xauth add localhost/unix:0 MIT-MAGIC-COOKIE-1 83c12a394ac0c5afe1fee0a973b9e49g

now 'user_two' can access the GUI (you may need to set DISPLAY):
user_two# DISPLAY=:0 /usr/bin/apulse /home/apps/firefox/firefox -ProfileManager

I do this so frequently for 'root' that I have a two-line bash script I called 'xsudo.sh'

#!/usr/bin/env bash
sudo bash -c "xauth add $(xauth -n list localhost/unix:0) && exec $@ &"