Paraphraser / PiBuilder

Ideas for building a Raspberry Pi from "bare metal" to ready-to-run IOTstack
MIT License
110 stars 24 forks source link

menu.sh fails when nodered is selected. #8

Closed oderflallc closed 10 months ago

oderflallc commented 10 months ago

menu.sh fails when building nodered:

Starting NodeRed Build script Error running PreBuildHook on 'nodered' Traceback (most recent call last): File "./scripts/buildstack_menu.py", line 460, in runPrebuildHook exec(code, execGlobals, execLocals) File "./.templates//nodered/build.py", line 396, in main() File "./.templates//nodered/build.py", line 386, in main eval(toRun)() File "./.templates//nodered/build.py", line 119, in preBuild installCommand = addonsSelected["dockerFileInstallCommand"]


TypeError: 'NoneType' object is not subscriptable

Thanks a million
oderflallc commented 10 months ago

Running on ProxMox Debian 12 VM:

pi@pxeiot:~/IOTstack$ uname -a Linux pxeiot 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64 GNU/Linux pi@pxeiot:~/IOTstack$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm

Noschvie commented 10 months ago

This seems to be the wrong project, better you ask IOTstack.

Paraphraser commented 10 months ago

@oderflallc - @Noschvie is correct that this is an IOTstack problem, not a PiBuilder problem but, rather than wait for you to open an issue on IOTstack, I will try to help you here.

I have not been able to replicate your problem exactly but I can get close if I do this:

  1. ./menu.sh
  2. Choose "Build Stack"
  3. Use the up/down arrow keys to put the cursor on "nodered"
  4. Press space to select "nodered".
  5. Press Enter to build the stack.

Those five steps get me this error:

Screenshot 2023-11-19 at 08 27 48

That error is a fairly common problem with people new to IOTstack. Adding Node-RED into your stack needs some extra steps:

  1. ./menu.sh

  2. Choose "Build Stack"

  3. Use the up/down arrow keys to put the cursor on "nodered"

  4. Press space to select "nodered".

  5. Without moving the cursor, press right arrow.

  6. Choose "Select & build addons list".

  7. Use the up/down arrow keys and space key to choose your add-on nodes.

    If you don't know which ones you need, it's OK to just leave the list with the defaults selected.

  8. When the list of add-on nodes is how you want it, press Enter to save that list.

  9. Choose "Go back".

  10. Press Enter to build the stack.

Although the menu does prompt you at step 5, I don't the message is particularly clear:

odered (fileIssues) - ['/addons_list.yml does not exist. Build addons file in options to fix. This is optional']

What that means is "press the right-arrow". Why it doesn't simply say that is a mystery. The message is also misleading because it isn't actually optional. It's mandatory (for Node-RED).

My guess is that if you go back into the menu, then "Build Stack", then put the cursor on "nodered", and pick up from step 5 by pressing the right arrow, you will be able to fix the problem.

If you can't then the simplest approach is to fool the menu into thinking it's a brand new build:

$ cd ~/IOTstack
$ rm -rf docker-compose.yml services
$ ./menu.sh

Earlier I said "I have not been able to replicate your exact problem". If you compare/contrast your traceback with mine, you will see they are similar for code lines 460, 396 and 386 but differ at the point of the base call. Your error traces back to line 119 while mine traces back to line 114.

The relevant area of code is:

Screenshot 2023-11-19 at 08 34 32

You can see from line 109 that this area of code is all to do with building Node-RED. Given the sequence of events I described above where I do not press the right-arrow to select the add-ons, I can easily explain why line 114 leads to a crash:

Conversely, I can't explain how, under normal conditions, I can get past line 114 and fail at line 119. The only way I can contrive that is by taking action outside the menu. Something like this:

$ cd ~/IOTstack
$ mkdir -p services/nodered
$ touch ./services/nodered/addons_list.yml
$ ./menu.sh

If I do that then select "nodered" and build the stack I get:

Screenshot 2023-11-19 at 09 09 08

That's identical to your crash.

If you did something "outside the menu" similar to what I just did then maybe try the rm command (above) to persuade the menu to start over properly.

If that doesn't help and you think you might've accidentally done more damage to the IOTstack folder structure, the simplest solution is to start over with a clean clone:

$ cd
$ sudo rm -rf IOTstack
$ git clone https://github.com/SensorsIot/IOTstack.git
$ cd IOTstack
$ ./menu.sh

Hope this helps.

oderflallc commented 10 months ago

Muchisimas gracias for your prompt response.

And yes, I did the "touch trick" at one point. Sorry for not divulging this before. I gave up and decided to created a new VM on the Proxmox server following the instructions to a "T". the .menu.sh did show options for nodered this time. I accepted the ones shown by default. Everything appears to have worked this time!

"Linux iots 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Sat Nov 18 14:28:45 2023 from 10.10.1.205

Useful Docker aliases: Influx: influx NodeRed: NODERED_DATA Docker: BUILD | DPS | DNET { …} PULL | REBUILD | RECREATE { …} RESTART | TERMINATE | UP { …} DI { …} DOWN, PRUNE, I, S, T, V Building /home/pi/.cache/IOTstackAliases/cache - this may take some time checking nodered - /bin/bash checking zerotier - /bin/ash checking influxdb2 - /usr/bin/bash checking mosquitto - /bin/ash checking grafana - /bin/bash checking portainer-ce - no shell found Shells: _SHELL (all capital letters) pi@iots:~$ "

I am now ready to continue learning and integrating IOStack with Home Assistant. My goal is to be able to make it easier for the members of my family to control and manage all of the IOT devices I have installed without having to ask them to install applications on their phones (which they refused to do) and train them on how to use them. I also can no longer be the only one capable of turning the lights ON or OFF in the house ;-)

Thanks again for the great work.