I have made a display that receives temp values from USB/COM.
Node red are setup on a Raspberry with kiosk that automatically launch the dashboard.
Everything works fine when Raspberry are connected to internet, but as soon as I start the Raspberry at location without internet the browser fails to show the dashboard.
The kiosk are set to launch 127.0.0.1
How can I get the dashboard to load with and without internet?
How are you starting Node-red? The Raspberry Pi install script creates a systemd job /etc/systemd/system/multi-user.target.wants/nodered.service which does not start Node-red until networking is available.
Thanks for quick response.
That is correct. It is set up as a service.
Would it be possible to make the service start even without internet?
Yes it is possible but I know very little about systemd.
Maybe someone else knows about it or of course DuckDuckGo is your friend!
I have been trying to sort this for a while. But will continue to search for a solution.
According to Chatgpt the systemd should work:
"To make a service start on boot without requiring an internet connection on a Raspberry Pi, you can use systemd, which is the default init system for most modern Linux distributions, including Raspberry Pi OS"
Clearly it's related to this line in the nodered.service file
However I don't know if you can just delete it or if you have to substitute a different prerequisite target.
I don't think chatgpt is any better at programming than it is at mowing the lawn
Hopefully I will find a solution to get it to boot in a offline location as well.
This is a work project where the sytem not allways has internet. It will then display data and log to file.
You can certainly delete it though I would comment it out personally. However, I don't know that Node-RED will behave as expected then, I would expect Node-RED to always need A network, even if only the loopback (localhost) since it is, after all, basically a network service.
I honestly think that this is the wrong approach. As long as the device starts up without the Internet and can start the network services.
So the right approach is to find out what is waiting for something on the Internet.
- Open the browser dev tools to see whether it is the browser waiting for something. If so, let us know what. Do this first as it is the most likely and the easiest to check.
- Check the Node-RED logs to see if something is stuck. Noting that you might need to wait for around 5 minutes or so before some things time out when waiting for network responses.
- Check the device's startup logs to see if there is an error there that is preventing startup.
Good point. Does "Wants = network.target" actually prevent Node-red starting if there is no network available? I can't test it because all my Pies are headless.
@trodys says the problem occurs when the Pi has no internet connection, which is I suppose not quite the same as no network connection.
I assumed no network and no keyboard (since kiosk mode), which makes any diagnosis more difficult.
Of course the log files are available to check back on when he does have access to the device.
This might be worth trying as an experiment:
Disable the systemd service
sudo systemctl disable nodered; sudo systemctl stop nodered
Put a line in /etc/rc.local (above
/usr/bin/node-red --userDir /home/pi/.node-red >/home/pi/nrlog.txt 2>&1 &
Change the references to pi if your login is different.
How do you know that the service is not starting?
Please post the file /lib/systemd/system/node-red.service
Thanks to everyone for assisting with this little information.
Could it be that the KIOSK service launches before the node-red service are up and running?
Now I can see the browser page says connection refused (or something simular. I do not have it on ENG language)
Error message "ERR_CONNECTION_REFUSED"
As soon as I launch my mobile hotspot and the raspberry are connected to internet the Node red dashboard comes up and everything works fine.
I am really trying my best and learning by searching and reading. But I do not understand why it does not work. I will try to setup another system and do some more testing.
Right, that is the clue we are probably looking for. Now you need to trace back to find out what is being blocked. Look at the network tab in dev tools on the browser to find the error and post the info back here.
Will try to get a mouse connected.
Its maded based on compute model.
Remote connection are normally the only way I can control it, and as soon as I activate network everything works fine.
There are only one USB on the board that the compute model are docked on to, and its in a enclosure.
Will open and see if I can connect a wired mouse.
Might be easier on a separate Pi or similar if you have one? The important thing is that it is the BROWSER that must not have internet connection initially - that's what you are testing first.
If you can access the Node-RED Dashboard from elsewhere, you could also do a simple visual check when loading the Dashboard so see what it attempts to load from the Internet. Should be pretty obvious. Once we know that we can work out what is asking for it.
Did you try the experiment I suggested above?
Thanks everyone for guiding me.
I went back to work and sat up a new system on a development board.
Everything worked fine when I set up the test system.
Looked in to the logs from browser developer dashboard. Did not find anything suspicious in the browser dev dashboard.....
I actually ended up with entering a 10sec sleep in the kiosk.sh line and now it works at every boot.
So at the end it looks like the browser halts if its trying to open the Node red dashboard before Node red has started up completely? And some how it does a refresh when it connects to a network afterwards.
A bit strange, but I havent got it to fail yet with the delay in kiosk.sh
Will have to look in to see if I can get the kiosk.sh to launch once the nodered.service are active, or do you have any suggestions?
Next version of main board will definetily have more than one USB for sure
This has been a pain to perform any fault finding on !!
This is simple if you use systemd to start the kiosk script. You can simply make the startup require the Node-RED service before it starts. Just like Node-RED waits for the network.