# Exec bash file issue

**URL:** <https://discourse.nodered.org/t/exec-bash-file-issue/90684>\
**Category:** General\
**Tags:** docker\
**Created:** [3 September 2024 15:47 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684 "2024-09-03T15:47:45Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![golfy44](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/golfy44/32/88406_2.png) [@golfy44](https://discourse.nodered.org/u/golfy44)\
**Post date:** [3 September 2024 15:47 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/1 "2024-09-03T15:47:46Z")

</div>

Hello,

it's been a long time I try to execute a bash file in Node Red.  
Node Red version : 4.0.2 running under docker.

The directory /usr/bin is correctly mounted but when I execute my script (with exec or exec-queue), the file is found but I have the execution error message:  
"/usr/bin/gpio cannot execute: required file not found".

I try with a simple "ls" and it didn't works.

Could you help me please?

Thanks

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [3 September 2024 16:00 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/2 "2024-09-03T16:00:23Z")

</div>

> [@golfy44](#):
>
> "/usr/bin/gpio cannot execute: required file not found".

1. How is your exec node set up?
2. Is that the exact error message that you get?
3. Does the file /usr/bin/gpio exist? Is it an executable binary file or a script?

---

<div class="post-metadata">

**Author:** ![golfy44](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/golfy44/32/88406_2.png) [@golfy44](https://discourse.nodered.org/u/golfy44)\
**Post date:** [3 September 2024 16:31 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/3 "2024-09-03T16:31:45Z")

</div>

@jbudd

1. the configuration of the noe :  

2. yes, it's exactly the message I have.

3. The "startpwm.sh" file is in a mounted directory and recognized.  
The "startpwm.sh" file contains a list of calls of "/usr/bin/gpio" binary executable file with different options.

The script works fine out of Node-Red.

Many thanks

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [3 September 2024 16:56 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/4 "2024-09-03T16:56:45Z")

</div>

message deleted

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 September 2024 19:35 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/5 "2024-09-03T19:35:10Z")

</div>

> [@golfy44](#):
>
> The "startpwm.sh" file is in a mounted directory and recognized.  
> The "startpwm.sh" file contains a list of calls of "/usr/bin/gpio" binary executable file with different options.

I believe that the startpwm.sh script will run _inside_ the container, therefore it will not have access to /usr/bin.

If you exec `ls -al` and `pwd` what do they show? I suspect you will find they show a container directory.

---

<div class="post-metadata">

**Author:** ![golfy44](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/golfy44/32/88406_2.png) [@golfy44](https://discourse.nodered.org/u/golfy44)\
**Post date:** [3 September 2024 20:04 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/6 "2024-09-03T20:04:20Z")

</div>

The directory contains the startpwm.sh and the /user/bin are mounted and available in the docker container.

When I execute ls -la I have the same error message.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 September 2024 20:18 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/7 "2024-09-03T20:18:38Z")

</div>

> [@golfy44](#):
>
> The directory contains the startpwm.sh and the /user/bin are mounted and available in the docker container.

How do you know that?

> [@golfy44](#):
>
> When I execute ls -la I have the same error message.

Exactly what error?

---

<div class="post-metadata">

**Author:** ![golfy44](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/golfy44/32/88406_2.png) [@golfy44](https://discourse.nodered.org/u/golfy44)\
**Post date:** [4 September 2024 06:38 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/8 "2024-09-04T06:38:39Z")

</div>

The result of "docker inspect" command:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a96ba9d92b6bbc2141fd60f8eb0572ee94e4a6d5.png)  
We can see the two directories mounted : "/usr/bin" and "/var/lib/node-red" (/data)  
Is possible a right access problem? I don't think about that because the error message would have been "not access right" no?  
A bad bind propagation ? I specify rprivate (default value) but it could be the wrong one.  
I try with shared without success.

The error when "/usr/bin/ls" is executed:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/282f7ff0459ce1aa186bc99db99faafe2ef17c88.png)

I copy "startpwm.sh" in /var/lib/node-red and call "/data/startpwm.sh" in exec node with the same result:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/32cc3e2f86834ca1998b1b04f542afb1cbe11ac7.png)

Many thanks

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [4 September 2024 07:47 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/9 "2024-09-04T07:47:27Z")

</div>

message deleted

---

<div class="post-metadata">

**Author:** ![golfy44](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/golfy44/32/88406_2.png) [@golfy44](https://discourse.nodered.org/u/golfy44)\
**Post date:** [4 September 2024 07:54 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/10 "2024-09-04T07:54:20Z")

</div>

New information, always with the exec node:

I try to execute "/bin/ls -la" (without /usr) with success:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/104042495a9b15893e25b753bdef10dc19adda6d.png)

The result with the command "/bin/ls -la /usr/bin/gpi\*"  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/0/c0ed9dfd0f88f4afe2849ed4ec91f5156aad013b.png)  
"/usr/bin/" is available in docker

The result with the command "/bin/ls -la /home/pi"  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2e273b4a1837106a4df2848c177730a95c70b5c3.png)  
Normal, "/home/pi" is not mounted.

I added the "/sys/class/gpio" directory in mounted list without success.  
The call to "/usr/bin/gpio" return the same error:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5e33e29f82109df82c40581d98ff890b345b0574.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 September 2024 08:44 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/11 "2024-09-04T08:44:42Z")

</div>

Use the `docker exec` command to check that you can run the commands. That will tell you whether it is a docker issue or a node-red issue.

---

<div class="post-metadata">

**Author:** ![golfy44](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/golfy44/32/88406_2.png) [@golfy44](https://discourse.nodered.org/u/golfy44)\
**Post date:** [4 September 2024 08:56 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/12 "2024-09-04T08:56:56Z")

</div>

the result:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/d/2db57ebd0a60abee6959c99cbc4c344371bb6770.png)

but

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb061b295540a93b7407af42a66c44af2550519c.png)

lack of dependences (lib or someone else) ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 September 2024 09:10 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/13 "2024-09-04T09:10:18Z")

</div>

Please don't screenshot, copy/paste instead, it is much easier to understand.

What does `cat /usr/bin/gpio` give you, using `docker exec`?

---

<div class="post-metadata">

**Author:** ![golfy44](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/golfy44/32/88406_2.png) [@golfy44](https://discourse.nodered.org/u/golfy44)\
**Post date:** [4 September 2024 09:38 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/14 "2024-09-04T09:38:15Z")

</div>

ok for screen shot, sorry.

it's a binary file but at the end there is a reference to a library:  
`/usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/crt1.o$d$a`

I tried to mount /usr/lib in container but it doesn't work (container don't start).

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 September 2024 10:02 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/15 "2024-09-04T10:02:17Z")

</div>

OK, so is a docker issue, not node red. I don't have any other suggestions, apart from not using Docker. Unless you know a lot about Docker it just makes life difficult.

---

<div class="post-metadata">

**Author:** ![golfy44](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/golfy44/32/88406_2.png) [@golfy44](https://discourse.nodered.org/u/golfy44)\
**Post date:** [4 September 2024 11:44 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/16 "2024-09-04T11:44:49Z")

</div>

Thanks a lot @Colin, I will see on Docker side.  
Have a good day

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 December 2024 11:45 UTC](https://discourse.nodered.org/t/exec-bash-file-issue/90684/17 "2024-12-03T11:45:15Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
