You are not logged in.

#1 2021-02-19 16:09:46

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 270

[SOLVED] pulseaudio as root

[Synopsis] follow the wiki instructions here... https://wiki.archlinux.org/index.php/Pu … _same_time *AND* also update the client.config of the primary user.

I have several bash scripts that need to be run as root and I'd like to add some audio alerts.  However, I cannot seem to play audio as root with either aplay, ffplay or flite.  See the error messages below:

ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
aplay: main:830: audio open error: Device or resource busy
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
audio_open_alsa: failed to open audio device default. Device or resource busy
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave

How do I configure pulseaudio to allow root to play audio and is it safe to do so?

Last edited by KairiTech (2021-02-20 15:14:22)


-=[ LIVE enabled UEFI with redundant syslinux pure systemd detached LUKS header partitionless encrypted GPT SSDx3 RAID0 because I can.  ]=-
Backward compatibility is for the masses. There's no dual-boot here.

[KairiTech is only artificially intelligent.  Turing would be agast at just how artificial.]

Offline

#2 2021-02-19 16:18:34

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,208
Website

Re: [SOLVED] pulseaudio as root

Does this help?  https://wiki.archlinux.org/index.php/Pu … ice,_cron)

If not, you may consider a pulseaudio service running in system mode which is not optimal: https://www.freedesktop.org/wiki/Softwa … ystemWide/


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2021-02-20 15:12:19

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 270

Re: [SOLVED] pulseaudio as root

Thanks for the wiki tip.  It helped me find this https://wiki.archlinux.org/index.php/Pu … _same_time which works except that it does not specifically say that the client.config of the primary user also needs to be updated in the same way as for the secondary user(s).

If you don't also update the config for the primary user sound only works for the secondary user(s).

[EDIT]
Additionally, I had to create /etc/modules-load.d/snd_hda_intel.conf with the below content to insure that my sound device drivers were consistently loaded in the correct order, otherwise sometimes cx88_alsa gets loaded first and sound does not work.

snd_hda_intel.conf

cat /proc/asound/modules:

 0 snd_hda_intel
 1 snd_hda_intel
 2 cx88_alsa

cat /proc/asound/cards:

 0 [SB             ]: HDA-Intel - HDA ATI SB
                      HDA ATI SB at 0xfc100000 irq 16
 1 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfe080000 irq 52
 2 [CX8801         ]: CX88x - Conexant CX8801
                      Conexant CX8801 at 0xfa000000

Last edited by KairiTech (2021-02-21 00:19:54)


-=[ LIVE enabled UEFI with redundant syslinux pure systemd detached LUKS header partitionless encrypted GPT SSDx3 RAID0 because I can.  ]=-
Backward compatibility is for the masses. There's no dual-boot here.

[KairiTech is only artificially intelligent.  Turing would be agast at just how artificial.]

Offline

Board footer

Powered by FluxBB