# \[Help!\] exec node + pulseaudio

**URL:** <https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060>\
**Category:** General\
**Created:** [2 May 2022 12:34 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060 "2022-05-02T12:34:45Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [22 May 2022 18:22 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/21 "2022-05-22T18:22:15Z")

</div>

Hi

That code referred to the fact that your code failed and I had to change the 0 to a 1 to get it to work.  
Once I changed the zero to a 1, then the command worked in the terminal.

The errors I get are:

Google chrome on my laptop  
Connecting to nodered via [http://192.168.1.xxx:1880](http://192.168.1.xxx:1880)  
Then running the commands via an exec node.  
I get Connection failure: Connection refused  
pa\_context\_connect() failed: Connection refused

and

amixer: Unable to find simple control 'Master',0

Regards  
Brendon

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [22 May 2022 19:29 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/22 "2022-05-22T19:29:03Z")

</div>

have you done any configuration to pluseaudio?  
the reason I ask is that if I use:  
`pactl -- set-sink-volume 0 20%`  
it works, but if I use  
`pactl -- set-sink-volume 1 20%`  
I get an error: `Failed to get sink information: No such entity`

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [22 May 2022 19:45 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/23 "2022-05-22T19:45:01Z")

</div>

I haven't made any configuration changes to pulseaudio.  
I just tried again. Same result.  
I am using a USB speaker connected via a USB hub - don't know if that makes a difference?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [22 May 2022 21:14 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/24 "2022-05-22T21:14:37Z")

</div>

Try disconnecting the usb hub and speaker and see what happens

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [23 May 2022 10:03 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/25 "2022-05-23T10:03:46Z")

</div>

With the hub and speaker disconnected...

Terminal via VNC/SSH:  
pactl -- set-sink-volume 1 20%  
Failed to get sink information: No such entity

pactl -- set-sink-volume 0 20%  
Failed to get sink information: No such entity

amixer set Master 70%  
Simple mixer control 'Master',0  
Capabilities: pvolume pswitch pswitch-joined  
Playback channels: Front Left - Front Right  
Limits: Playback 0 - 65536  
Mono:  
Front Left: Playback 45875 [70%] [on]  
Front Right: Playback 45875 [70%] [on]

Via nodered using laptop chrome to connect:  
pactl -- set-sink-volume 1 20%  
Connection failure: Connection refused  
pa\_context\_connect() failed: Connection refused

amixer set Master 70%  
amixer: Mixer attach default error: No such file or directory

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 May 2022 10:40 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/26 "2022-05-23T10:40:26Z")

</div>

What do you get if you run  
`amixer -version`  
I get

```auto
console1@console1:~ $ amixer -version
amixer version 1.2.4

```

can you try accessing NR from another device and with a different browser to see if the laptop/chrome is part of the issue?

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [23 May 2022 10:58 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/27 "2022-05-23T10:58:04Z")

</div>

I have the same version  
I tried from Edge on the laptop, and from Chrome on my phone - both browsers give the same errors as before

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 May 2022 11:16 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/28 "2022-05-23T11:16:15Z")

</div>

SSH into the pi and run  
`pacmd list-sinks | grep -e 'name:' -e 'index:'`  
copy and paste the results.

after flashing the SD card did you install anyother software (maybe to control the HAT)?

On my Pi I get:

```auto
console1@console1:~ $ pacmd list-sinks | grep -e 'name:' -e 'index:'
  * index: 0
	name: <auto_null>
console1@console1:~ $ 

```

You might want to read this: [audio - Is there a consistent shell command for adjusting volume? - Unix & Linux Stack Exchange](https://unix.stackexchange.com/questions/560467/is-there-a-consistent-shell-command-for-adjusting-volume)

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [23 May 2022 13:28 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/29 "2022-05-23T13:28:21Z")

</div>

I get

pacmd list-sinks | grep -e 'name:' -e 'index:'

- index: 1  
name: \<alsa\_output.usb-Generic\_USB2.0\_Device\_20130100ph0-00.analog-stereo\>

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 May 2022 14:31 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/30 "2022-05-23T14:31:45Z")

</div>

Please answer all the questions

> [@zenofmud](#):
>
> after flashing the SD card did you install anyother software (maybe to control the HAT)?

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [23 May 2022 15:09 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/31 "2022-05-23T15:09:46Z")

</div>

No, no other software:

1. Raspbian via imager
2. Node-red using standard installation instructions

I am using a [hub](https://shop.pimoroni.com/products/three-port-usb-hub-with-ethernet-and-microb-connector), not a HAT.

I have just borrowed a Pi 4. I'm going to do a basic installation and will report on how that goes.

Thanks  
Brendon

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 May 2022 15:39 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/32 "2022-05-23T15:39:14Z")

</div>

> [@brendonhatcher](#):
>
> \<alsa\_output.usb-Generic\_USB2.0\_Device\_20130100ph0-00.analog-stereo\>

what is this device?

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [23 May 2022 15:51 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/33 "2022-05-23T15:51:34Z")

</div>

That is the USB hub or, more likely, the USB speaker.  
What audio output device are you testing with on a Pi Zero?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 May 2022 17:46 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/34 "2022-05-23T17:46:31Z")

</div>

> [@brendonhatcher](#):
>
> That is the USB hub or, more likely, the USB speaker.  
> What audio output device are you testing with on a Pi Zero

So did you have to install anything or setup anything for the hub and/or speaker? That is probably where the issue is coming from.

I have no audio out device seeing that this is a pi zero with no headphone jack.

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [27 May 2022 09:20 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/35 "2022-05-27T09:20:34Z")

</div>

Hi. There are no installation steps or software for the hub or speaker - just plug and play.  
I disconnected them so that I have the same setup as you.  
This is what I got:

With the hub and speaker disconnected...

Terminal via VNC/SSH:  
pactl -- set-sink-volume 1 20%  
Failed to get sink information: No such entity

pactl -- set-sink-volume 0 20%  
Failed to get sink information: No such entity

amixer set Master 70%  
Simple mixer control 'Master',0  
Capabilities: pvolume pswitch pswitch-joined  
Playback channels: Front Left - Front Right  
Limits: Playback 0 - 65536  
Mono:  
Front Left: Playback 45875 [70%] [on]  
Front Right: Playback 45875 [70%] [on]

Via nodered using laptop chrome to connect:  
pactl -- set-sink-volume 1 20%  
Connection failure: Connection refused  
pa\_context\_connect() failed: Connection refused

amixer set Master 70%  
amixer: Mixer attach default error: No such file or directory

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 May 2022 12:09 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/36 "2022-05-27T12:09:13Z")

</div>

It seems like things keep changing for you. First you can run commands and then you can’t.

If you can’t get it to run on the pi it’s not going to work via node-red.

You could try reflashing the SD card of the pi zero w and follow the steps I posted earlier and do not attach anything else and testing.

All I can tell you is that it works for me.

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [27 May 2022 15:01 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/37 "2022-05-27T15:01:09Z")

</div>

I started again...

Raspberry Pi 4 without every having connected the hub or speaker.  
Standard build using Raspberry Pi imager (64bit)  
Ran updates

**cat /etc/os-release:** PRETTY\_NAME="Debian GNU/Linux 11 (bullseye)"  
**cat /sys/firmware/devicetree/base/model:** Raspberry Pi 4 Model B Rev 1.2

# Accessed terminal via VNC:

pactl -- set-sink-volume 0 15% **worked**  
amixer set Master 70% **worked**

**groups pi is correct**  
pi : pi adm dialout cdrom sudo audio video plugdev games users input render netdev spi i2c gpio lpadmin

**amixer -version**  
amixer version 1.2.4

**pacmd list-sinks | grep -e 'name:' -e 'index:'**

- index: 0  
name: \<alsa\_output.platform-bcm2835\_audio.analog-stereo\>

# Installed base Node-RED

**Standard install, no additional nodes**  
bash \<(curl -sL [https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered](https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered))

**Ran node-red admin init**  
No user security  
No projects  
Pass raspb3rry  
Default theme  
Default editor  
Allow Function nodes to load external modules? (functionExternalModules) · Yes

# Started node-red

**node-red-start**  
Starting as a systemd service.  
27 May 15:14:14 - [info]  
Welcome to Node-RED

27 May 15:14:14 - [info] Node-RED version: v2.2.2  
27 May 15:14:14 - [info] Node.js version: v14.19.3  
27 May 15:14:14 - [info] Linux 5.15.32-v8+ arm64 LE  
27 May 15:14:15 - [info] Loading palette nodes  
27 May 15:14:17 - [info] Settings file : /home/pi/.node-red/settings.js  
27 May 15:14:17 - [info] Context store : 'default' [module=memory]  
27 May 15:14:17 - [info] User directory : /home/pi/.node-red  
27 May 15:14:17 - [warn] Projects disabled : editorTheme.projects.enabled=false  
27 May 15:14:17 - [info] Flows file : /home/pi/.node-red/flows.json  
27 May 15:14:17 - [info] Creating new flow file  
27 May 15:14:17 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)  
27 May 15:14:17 - [info] Starting flows  
27 May 15:14:17 - [info] Started flows

# Imported your nodes

Your code above, under the text "I then installed NR using the script and created the following flows"

# Accessed from laptop

[http://192.168.16.85:1880/](http://192.168.16.85:1880/) via laptop

**Exec node: pactl -- set-sink-volume 0 20%**  
Connection failure: Connection refused  
pa\_context\_connect() failed: Connection refused

**Exec node: amixer set Master 70%**  
amixer: Unable to find simple control 'Master',0

# Accessed directly

[http://127.0.0.1:1880](http://127.0.0.1:1880) via chromium on the Pi (access via VNC)  
Got exactly the same error messages

I added another exec node with touch ~/Documents/hello3.txt  
Running that worked correctly  
So did examples like rm, date, amixer -version  
However, pacmd list-sinks gave back " " not the full output.

Hmmmm

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 May 2022 15:15 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/38 "2022-05-27T15:15:53Z")

</div>

Just to clarify, you VNCed into the pi and ran the updates and tested the ‘pactl’ command and it worked. You then install NR and after that the ‘pactl’ command fails.

Can you run a ‘history’ and copy/paste the results in a reply so I can run the exact commands you have run. Thanks

---

<div class="post-metadata">

**Author:** ![brendonhatcher](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@brendonhatcher](https://discourse.nodered.org/u/brendonhatcher)\
**Post date:** [27 May 2022 15:27 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/39 "2022-05-27T15:27:21Z")

</div>

> Just to clarify, you VNCed into the pi and ran the updates and tested the ‘pactl’ command and it worked.

Yes

> You then install NR and after that the ‘pactl’ command fails.

It continues to work in terminal. It fails in Node-RED exec node.  
The Raspberry Pi build, Node-RED installation and your example flow are free of any other configuration steps, conflicting nodes etc.  
The errors on this new build on the Pi 4 are exactly the same as I experienced on the Pi Zero.

1 raspi-config  
2 sudo raspi-config  
3 sudo iwconfig  
4 sudo ifconfig  
5 sudo killall wpa\_supplicant  
6 sudo wpa\_supplicant -c/etc/wpa\_supplicant/wpa\_supplicant.conf -iwlan0  
7 cd /var/run/  
8 ls  
9 cd /  
10 ls  
11 cd boot  
12 ls  
13 sudo nano wpa\_supplicant.conf  
14 sudo reboot  
15 ifconfig  
16 sudo apt update  
17 sudo apt upgrade  
18 sudo rpi-eeprom-update  
19 sudo rpi-eeprom-update -d -a  
20 sudo reboot  
21 sudo rpi-eeprom-update  
22 ifconfig  
23 sudo raspi-config  
24 cat /etc/os-release  
25 cat /sys/firmware/devicetree/base/model  
26 groups pi  
27 amixer -version  
28 pacmd list-sinks | grep -e 'name:' -e 'index:'  
29 ls  
30 cd Documents  
31 ls  
32 mk hello.txt  
33 touch hello.txt  
34 ls  
35 cd ..  
36 touch ~/Documents/hello2.txt  
37 cd documents  
38 cd Documents  
39 ls  
40 cd ..  
41 rm ~/Documents/hello2.txt  
42 pacmd list-sinks  
43 cd /lib/systemd/system/  
44 ls  
45 sudo nano nodered.service  
46 history  
47 clear

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 May 2022 16:27 UTC](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060/40 "2022-05-27T16:27:21Z")

</div>

> [@brendonhatcher](#):
>
> It continues to work in terminal. It fails in Node-RED exec node.

Your last post said

# Accessed from laptop

[http://192.168.16.85:1880/](http://192.168.16.85:1880/) via laptop

**Exec node: pactl -- set-sink-volume 0 20%**  
Connection failure: Connection refused  
pa\_context\_connect() failed: Connection refused

**Exec node: amixer set Master 70%**  
amixer: Unable to find simple control 'Master',0

So which is it?

And why are you doing a rpi-eeprom-update?

[Previous page](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060.md?page=1)

[Next page](https://discourse.nodered.org/t/help-exec-node-pulseaudio/62060.md?page=3)
