Closed braghettos closed 4 years ago
This is most likely because you are using the Alpine based build (minimal) which doesn't look to include python, which is needed for the neopixel node.
Try will the full full docker container rather than the minimal build.
OK, looks like you've installed python. What's in the node-red log when it fails, is there anything written to stdout?
Hi @hardillb , nothing is written on startup of node red. Just when I try to send a msg in input.
Yes, that's what I'm asking for, not the content of the debug sidebar, I want to see the section of the log around the failure.
No, As I said, not what's in the debug sidebar, I want to see the actual console output from node-red.
It will be in the container log as it all just ends up in stdout
log into the container, cd to /data/node_modules/node-red-node-pi-neopixel
and then run:
./neopix 1 40 pcent 100 true
And let me know what the output is.
I am 99% sure this will be a problem with how you have set your container up.
Also check what the output of python --version
is (I'm going to guess it's 2.x and you've built all the unicorn stuff with python3)
bash-5.0# cd node-red-node-pi-neopixel
bash-5.0# pwd
/usr/src/node-red/node_modules/node-red-node-pi-neopixel
bash-5.0# ./neopix 1 40 pcent 100 true
sudo: setrlimit(RLIMIT_CORE): Operation not permitted
Can't open device file
: Operation not permitted
Traceback (most recent call last):
File "./neopix.py", line 169, in <module>
strip.begin()
File "/usr/lib/python2.7/site-packages/rpi_ws281x/rpi_ws281x.py", line 130, in begin
raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -9 (Failed to create mailbox device)
bash-5.0# python --version
Python 2.7.16
So as the error says the user you are running as is not permitted to create that device - I'm not familiar with that script enough to know if just running it once with root would be enough to create the device so you then use it in node-red the next time or if it must be run as root the whole time.
The neopix script is already running things with sudo
and they have permissions up through docker to get to the host hardware ? I think the answer is don't use docker for direct hardware DMA support https://github.com/jgarff/rpi_ws281x/issues/210 Don't think there is anything we can do about it.
Docker can talk directly with hw with the --device option or running in privilege mode. Which is the device to use in this case?
Well the C code seems to say this
sprintf(filename, "/tmp/mailbox-%d", getpid());
unlink(filename);
if (mknod(filename, S_IFCHR|0600, makedev(100, 0)) < 0) {
printf("Failed to create mailbox device %s: %m\n", filename);
return -1;
}
so it looks to be dynamic based on the pid. Good luck !
After launching the Docker container in privileged mode:
docker run -d -p 1880:1880 --name weatherledboardnodered --privileged --group-add dialout --device=/dev/spidev0.0 --device=/dev/spidev0.1 --device=/dev/serial0 --user=root --restart=always -e NODE_OPTIONS="--max_old_space_size=256" --log-opt max-file=2 --log-opt max-size=2k -e TZ="Europe/Rome" braghettos/makealedwheaterboard:latest
The following command doesn't return any error:
bash-5.0# ./neopix 1 40 pcent 100 true
Looks like I've been lucky!
great - so OK to close this ? as nothing we are going to fix.
Yes! if you want to add this configuration on the README would be helpful for others!
Which node are you reporting an issue on?
node-red-node-pi-neopixel
What are the steps to reproduce?
use docker image braghettos/makealedwheaterboard:latest source code is available at https://github.com/braghettos/makealedweatherboard.git
What happens?
The node is in "stopped" status. When the node receives a msg, the error in debug console is "[error] [rpi-neopixels:8c34d22e.037ad] TypeError: Cannot read property 'stdin' of null"
What do you expect to happen?
Status "running" for the node
Please tell us about your environment: