Troubleshooting
Why a Node-RED OPC UA install fails on an edge controller
Short answer
A Node-RED OPC UA install on an embedded controller fails in a chain, not for one reason: node-red-contrib-iiot-opcua is deprecated, node-red-contrib-opcua-server adds only server nodes, the native npm build dies on node-gyp, and a stock container image, a nearly full card or a missing balena firewall file blocks each workaround. Work the checks in order; updating to firmware 2020.3 resolved the last one.
On this page
- Check the package name before anything else
- Test whether the native npm install can complete at all
- Run an image that already contains the client nodes
- Worked example: free space on a 2 GB card before the pull
- Trace the container's path to the package registry
- Update the firmware when the firewall file stays missing
- Prove the client end to end
- Questions asked
A Node-RED OPC UA install on an embedded controller fails as a chain of six separate faults: the package you started from is deprecated, its named successor is server-only, the native npm build dies on node-gyp, the container image you pulled is the stock one, the card is nearly full, and the container has no permitted network path because the firewall file was never generated. On one controller at FW 2020.0.1 LTS, updating to 2020.3 resolved the last fault and the install then completed. Work the checks below in order; each names the reading, what it means, and the next step.
Check the package name before anything else #
Read the package you actually installed. node-red-contrib-iiot-opcua is deprecated, and its repository marks it as such. node-red-contrib-opcua-server is not a client replacement: it provides server-side nodes only. If the palette shows OPC UA server nodes but no client nodes (connect, read, write, browse, subscribe), you installed the wrong package for polling another controller, and reinstalling under a similar name will not fix it.
- Server nodes only in the palette: the client package is missing. Go to the next check.
- Client nodes present but not working: skip to the network-path check.
Test whether the native npm install can complete at all #
Read the end of the npm error output. On the controller, the install of the deprecated client package failed even after updating node-gyp. The package pulls in an OPC UA stack whose dependencies may need a native build, and an embedded Linux target with a limited toolchain and little free storage is the wrong place to compile. The same class of failure appears on other small controllers as npm resolver and node-gyp errors, as described in the knowledge base article on resolving npm EAI_AGAIN and node-gyp errors on an IOT2000-class controller.
- The native install fails and a node-gyp update did not help: stop debugging the host toolchain and move Node-RED into a container.
- The install completes: no container is needed; go straight to the end-to-end check.
If you stay native, keep the flow small and pinned; the approach in the article on stable gateway flows with vendor-pinned nodes applies. When the controller itself is the constraint and the project is growing, a fanless industrial mini PC sized for container work is the replacement path.
Run an image that already contains the client nodes #
Installing Node-RED in a container from a stock image and then adding nodes through the manage palette produced only the server package; the client nodes were not offered in the palette at all. The working path is an image with them pre-installed:
balena-engine run -it -p 1880:1880 --name nodered --restart always pxcbe/node-red:opcua
Read the terminal output immediately after that command. The common refusals are mechanical:
Name nodered already in use: an earlier container from the stock image still exists. Runbalena-engine ps -a, stop and remove the old container withbalena-engine rm nodered, then rerun the command.Port 1880 already allocated: another container or service holds the host port. Stop it, or map a different host port.Failed to register layer: the image layer cannot be written; the card is full or holds corrupted leftovers. Go to the storage check.- The editor is reachable on port 1880: open the palette and confirm the client nodes are listed, then continue.
A container started from the stock image keeps its own writable layer, and pulling a different image does not change that. A leftover container from the first attempt is the usual reason the new image seems to lack the nodes. Container-to-network problems have their own failure modes; the article on Node-RED MQTT stuck on connecting inside a Docker container covers the same bridge in a different symptom.
Worked example: free space on a 2 GB card before the pull #
Inputs: the card on the controller is 2 GB (from the device setup); df -h before a retry shows 1.9 GiB used, 0.1 GiB free, which matches the nearly full card in the reported case.
Rule: free space must exceed the compressed image size plus a working margin for npm installs inside the container. Read the image size from balena-engine images after the pull attempt, and take the margin as the size of the npm cache plus one more node install.
Arithmetic: used fraction is 1.9 GiB divided by 2.0 GiB, which is 0.95, so the card shows 95 percent used and 5 percent free, that is about 100 MiB. A Node-RED image with the OPC UA nodes is several hundred megabytes, so 100 MiB free is far below the image size alone, before any margin.
Result: the pull cannot register its layer, which is exactly the Failed to register layer error in this case.
Decision: with free space below the image size plus margin, clean up before pulling. Run balena-engine ps -a and balena-engine images, remove stopped containers and unused images, and use du on the top-level directories to find where failed installs left data. On this controller, Docker and balena-engine directories survived both a factory reset and a factory reset type 2, and manually deleting only those leftovers is what made room. Never delete directories belonging to the controller runtime or the PLC project. The setup itself has been run on a 2 GB card holding nothing else large, so the decision rule is free space, not card size.
Trace the container's path to the package registry #
If the OPC UA nodes run but the palette now refuses to install another node such as the dashboard, the request path is: npm inside the container, out through the balena bridge interface, through the host's nftables ruleset, then via the Ethernet interface to your gateway and DNS. A break at the firewall stage looks exactly like an npm failure inside the container.
ifconfigshows no bridge address or no usable host interface: fix the host network first; npm cannot succeed until it is up.- The balena firewall configuration file under
/etc/nftablesis missing after running./setup.sh: the ruleset was never generated, so container traffic has no permitted path. This persisted through repeated factory resets on one controller at FW 2020.0.1 LTS. - The firewall file exists with the expected entries: test DNS and outbound reachability from inside the container.
The two deciding outputs are the interface list and the firewall file itself. If the file is missing, apply the firewall configuration correction published for the balena setup on your controller, or move to the firmware check.
Update the firmware when the firewall file stays missing #
The controller in this case reported product type F2152, HW 02, FW 2020.0.1 LTS. With the firewall file missing on that level, the firmware update to 2020.3 was the resolving step: after the update the file was generated again and the installation completed correctly.
- Read the current firmware, hardware revision and product type from the device information.
- Obtain the firmware image from the manufacturer or its distributors only, and confirm it targets your product type and hardware revision.
- Back up the PLC project and card data, then update following the manufacturer's documented procedure.
- After reboot, confirm the firmware reads 2020.3 or newer, reinstall balena-engine per the maker's procedure, rerun
./setup.sh, and confirm the firewall file now exists. - Start the container from the pre-built image again.
Prove the client end to end #
Run the readings in order; each proves one hop. df shows free space on the card; balena-engine ps shows the container running with the port mapping; the palette lists the client nodes; the editor opens on port 1880. Then deploy a small flow: an OPC UA client node configured with the endpoint of the controller you want to poll, a read action on a known node identifier, and a debug node. A value arriving at the debug pane on a real tag proves DNS, network path, session and read together. Only that confirmed value is a working install; a completed palette install by itself is not.
Questions asked
Is node-red-contrib-opcua-server a drop-in replacement for node-red-contrib-iiot-opcua?
No. The server package provides only the server-side nodes, so it cannot poll another controller. If you installed it and the palette shows no OPC UA client nodes such as connect, read, write, browse or subscribe, you have the wrong package for a client role, and no palette reinstall on that image will add them. Use a container image with the client nodes already built in.
How much free space does a Node-RED OPC UA container need on the card?
A practical rule is the image size plus a working margin for npm installs, checked with df before the pull. The whole setup has been run on a 2 GB card that held nothing else large, so capacity itself is not the limit. What matters is that repeated failed installs leave directories behind that a factory reset may not clear; delete only those leftovers and confirm free space with df again.
Why does the palette fail to install a node inside the container even though the OPC UA nodes work?
The palette manager runs npm inside the container, and that traffic leaves through the balena bridge and the host firewall ruleset. If the firewall configuration file was never generated after the setup script, container traffic has no permitted path and npm fails as if the registry were down. Check the bridge address and the firewall file first before touching DNS or proxy settings.
Which firmware level fixed the missing balena firewall file?
On one controller running FW 2020.0.1 LTS, the firewall file was not created by the setup script and stayed missing through several factory resets. Updating the firmware to 2020.3 resolved it: after the update the setup script generated the file, and the container then had a working path to the package registry. Obtain firmware images from the manufacturer only and match them to your product type and hardware revision.