Exec node error 127

I am running node-red from docker in my rpi4 which has been made possible as an addon from hassio. I am trying to use the exec node to reboot the Pi with the command "sudo shutdown -r now" but all i am getting in response is the error 127. What is this error and why is it happening? Also the error out from the exec node says Command failed: sudo shutdown -r now/bin/sh: sudo: not found

I can't answer the question to the point of being helpful. Sorry.

It is a permission thing.

I had this problem a long time ago and can't remember my solution.

But my command isn't quite as complex as yours.

My exec node is basically this:

sudo shutdown -h now

To shut down the machine.

There is a setting which controls who has access to sudo commands and who hasn't.

I hope someone else can help you better/more.

The point about running in docker is that the application runs in a bubble and is not able to mess with the rest of the system other than in specific ways defined by the docker configuration. Therefore you cannot run commands like that from within the container unless you allow that in the docker build. I am not familiar enough with docker to tell you exactly how to do that though. I keep away from docker generally for exactly that reason. It is very useful in the right application but if you want full access to the system it may not be the best solution.

3 Likes