NanoPi M4 Node-RED install difficulties

https://www.friendlyarm.com/index.php?route=product/product&product_id=234

I was working on a project using a Raspberry Pi 3B+ and kept running into road blocks. The last one was trying to get Real Time Clock (RTC) to work with two different shields without success.

I have also struggled with the Raspberry Pi (whichever model) being very slow to show Node-RED Dashboard items on a mobile phone.

I decided to try the NanpPi M4.
Built in Real Time Clock (just need optional battery)
eMMC boot
Raspberry Pi physical size and mounting
4G RAM, heaps more processor power
The Real Time Clock does work if you have a battery connected.
The response and performance is fantastic.
When it is running, it is able to render Node-RED Dashboard items, including trend charts, very fast.

Problems:
The NanoPi M4 doesn't run Raspbian.
It runs its own build of Lubuntu LXDE.
There is a desktop with Chrome browser but not much else.
It has taken me 5 times trying to install Node-RED on this device. Each time some different aspect won't work.
One install I couldn't get Node-RED to run at boot no matter what I did.
Another install, I managed to get Node-RED to run at boot, but can't install any extra Nodes.
Another install, I couldn't get the WiFi set up as a HotSpot, but another install the HotSpot configured exactly as it should and worked well.

I think my Node-RED problems have something to do with user permissions, but I am struggling to find Log files, I don't know enough about Linux and User Permissions to know how to start working through this.
I am usually able to work my way through things by searching for specific phrases relating to a problem, but now I am coming up blank.

My current situation is that I have the device running as an access-point, I have apache2 running as a web server, I have FTP working, I have Node-RED starting on boot...
But I can't load any new Nodes, specifically Dashboard but others also.
The error log says it needs root user permissions, but I can't find the log to copy it in detail.
I actually used NPM to install this Node-RED setup, but I can't manually install Dashboard using sudo npm install.....

Where do I find the Node-RED configuration file?
It seems this is dependent on how it was installed so could be in a number of places?
I think I know how to find the systemd file that controls the startup, but what should I be looking for in there to give sudo or root user permissions so that "Pallet Manager" can work?
What further information do I need to give?

Thank you

What version of node.js?

How did you install node-red?

You say you've got it set to start on boot... how exactly are you doing that?

You say the error log says it needs root permissions, but you can't find the log. So which log says it needs root permissions if you can't find the log?

Generally variants of debian, like raspbian and ubuntu should all work ok if you installed using the script we use for Pi - as per the install documentation. - You need to run that as whatever user you want Node-RED to end up running as (and not use sudo or root). It will ask for root permissions to install nodejs and Node-RED itself but apart from that it should all be running as a non-root user. However.... you are not in that position now.. so either we can try to unpick it all or you would have to redo the Node-RED (and nodejs ) install.

1 Like

I have a Pi3 running node-red with dashboard, mosquitto, influxdb, grafana and operating as my vpn server and network file server and the dashboard loads fine on mobile devices and PC.
Are you showing charts on the dashboard?

Thanks for taking an interest.

The first way I tried to install Node-RED was using the Node-RED upgrade script command but it doesn't work. I will step through the steps I have taken.

From a uSD card boot I have flashed the eMMC card with "Friendly Desktop"
http://wiki.friendlyarm.com/wiki/index.php/FriendlyDesktop_18.04_for_RK3399

On first boot from eMMC I have left the default user as "pi" but changed the passwd, and changed the root passwd.
I have keyboard, mouse, hdmi monitor and Ethernet network connection (all auto detected) Chrome browser is in default package, and XTerm (paste in XTerm is middle click).
sudo apt-get update
sudo apt-get upgrade (shows error with hostapd)
sudo dpkg-reconfigure tzdata (set to local time zone)
sudo apt-get install build-essential (shows error with hostapd)

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

returns the following:
bash: curl: command not found

I am open to suggestions as to how to get this working. I have tried a couple of other Node-RED install guidelines each ending up with some problem or another.

So it seems the error with hostapd is the first problem.
If I assume I need to install bash I get the following which shows the same error as when running .....upgrade.

pi@NanoPi-M4:~$ sudo apt-get install bash
Reading package lists... Done
Building dependency tree
Reading state information... Done
bash is already the newest version (4.4.18-2ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up hostapd (2:2.6-15ubuntu2.2) ...
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript hostapd, action "restart" failed.
โ— hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-04-13 09:59:40 AEST; 32ms ago
Process: 20265 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B DAEMON_OPTS {DAEMON_CONF} (code=exited, status=1/FAILURE)

Apr 13 09:59:40 NanoPi-M4 systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Apr 13 09:59:40 NanoPi-M4 hostapd[20265]: Configuration file: /etc/hostapd/hostapd.conf
Apr 13 09:59:40 NanoPi-M4 hostapd[20265]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
Apr 13 09:59:40 NanoPi-M4 hostapd[20265]: Failed to set up interface with /etc/hostapd/hostapd.conf
Apr 13 09:59:40 NanoPi-M4 hostapd[20265]: Failed to initialize interface
Apr 13 09:59:40 NanoPi-M4 systemd[1]: hostapd.service: Control process exited, code=exited status=1
Apr 13 09:59:40 NanoPi-M4 systemd[1]: hostapd.service: Failed with result 'exit-code'.
Apr 13 09:59:40 NanoPi-M4 systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
dpkg: error processing package hostapd (--configure):
installed hostapd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
hostapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
pi@NanoPi-M4:~ ^C pi@NanoPi-M4:~

I don't understand why both the upgrade and install bash are so concerned about hostapd?
From what I can find out, hostapd is used to configure connections if the device is being used as a wireless access point.

Scenario 1, what if I don't need to set up a wireless access-point and I even have WiFi turned off? Why would I need hostapd.

Scenario 2, creating a wireless access point actually works. Using the GUI network settings on this "Friendly Desktop" it is easy as pie to create a WiFi Hot-Spot.

Next step, try installing curl

pi@NanoPi-M4:~$ sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libcurl4
The following NEW packages will be installed:
curl libcurl4
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
Need to get 332 kB of archives.
After this operation, 958 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com bionic-security/main arm64 libcurl4 arm64 7.58.0-2ubuntu3.6 [180 kB]
Get:2 http://ports.ubuntu.com bionic-security/main arm64 curl arm64 7.58.0-2ubuntu3.6 [152 kB]
Fetched 332 kB in 2s (136 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libcurl4:arm64.
(Reading database ... 121654 files and directories currently installed.)
Preparing to unpack .../libcurl4_7.58.0-2ubuntu3.6_arm64.deb ...
Unpacking libcurl4:arm64 (7.58.0-2ubuntu3.6) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.58.0-2ubuntu3.6_arm64.deb ...
Unpacking curl (7.58.0-2ubuntu3.6) ...
Setting up hostapd (2:2.6-15ubuntu2.2) ...
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript hostapd, action "restart" failed.
โ— hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-04-13 11:05:45 AEST; 25ms ago
Process: 1853 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B DAEMON_OPTS {DAEMON_CONF} (code=exited, status=1/FAILURE)

Apr 13 11:05:45 NanoPi-M4 systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Apr 13 11:05:45 NanoPi-M4 hostapd[1853]: Configuration file: /etc/hostapd/hostapd.conf
Apr 13 11:05:45 NanoPi-M4 hostapd[1853]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
Apr 13 11:05:45 NanoPi-M4 hostapd[1853]: Failed to set up interface with /etc/hostapd/hostapd.conf
Apr 13 11:05:45 NanoPi-M4 hostapd[1853]: Failed to initialize interface
Apr 13 11:05:45 NanoPi-M4 systemd[1]: hostapd.service: Control process exited, code=exited status=1
Apr 13 11:05:45 NanoPi-M4 systemd[1]: hostapd.service: Failed with result 'exit-code'.
Apr 13 11:05:45 NanoPi-M4 systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
dpkg: error processing package hostapd (--configure):
installed hostapd package post-installation script subprocess returned error exit status 1
Setting up libcurl4:arm64 (7.58.0-2ubuntu3.6) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up curl (7.58.0-2ubuntu3.6) ...
Errors were encountered while processing:
hostapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
pi@NanoPi-M4:~$

So now try the Node-RED install again and looks much more successful.

Running Node-RED update for user pi at /home/pi

This can take 20-30 minutes on the slower Pi versions - please wait.

Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Remove old version of Node.js :heavy_check_mark:
Install Node.js LTS :heavy_check_mark: Node v10.15.3 Npm 6.9.0
Clean npm cache :heavy_check_mark:
Install Node-RED core
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ npm update check failed โ”‚
โ”‚ Try running with sudo or get access โ”‚
โ”‚ to the local update config store via โ”‚
โ”‚ sudo chown -R USER:(id -gn $USER) /home/pi/.config โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Install Node-RED core :heavy_check_mark: 0.20.5
Any errors will be logged to /var/log/nodered-install.log
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ npm update check failed โ”‚
โ”‚ Try running with sudo or get access โ”‚
โ”‚ to the local update config store via โ”‚
โ”‚ sudo chown -R USER:(id -gn $USER) /home/pi/.config โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Move global nodes to local -
Install extra Pi nodes -
Npm rebuild existing nodes -
Add shortcut commands :heavy_check_mark:
Update systemd script :heavy_check_mark:

All done.
You can now start Node-RED with the command node-red-start
or using the icon under Menu / Programming / Node-RED
Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started Sat Apr 13 11:12:31 AEST 2019 - Finished Sat Apr 13 11:14:57 AEST 2019

I started Node-RED using the icon under Menu / Programming
Then tried to install node-red-dashboard using pallet manager.
This is the error log displayed on the aborted npm install.

2019-04-13T01:24:03.886Z Install : node-red-dashboard 2.14.0

2019-04-13T01:24:03.921Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production node-red-dashboard@2.14.0
2019-04-13T01:24:06.952Z [err] npm ERR!
2019-04-13T01:24:06.954Z [err] path /home/pi/.npm/_cacache/index-v5/bd/db
2019-04-13T01:24:06.954Z [err] npm ERR! code EACCES
2019-04-13T01:24:06.954Z [err] npm ERR! errno -13
2019-04-13T01:24:06.954Z [err] npm ERR! syscall mkdir
2019-04-13T01:24:06.958Z [err] npm ERR! Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db'
2019-04-13T01:24:06.959Z [err] npm ERR! { [Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db']
2019-04-13T01:24:06.959Z [err] npm ERR! cause:
2019-04-13T01:24:06.959Z [err] npm ERR! { Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db'
2019-04-13T01:24:06.959Z [err] npm ERR! errno: -13,
2019-04-13T01:24:06.959Z [err] npm ERR! code: 'EACCES',
2019-04-13T01:24:06.959Z [err] npm ERR! syscall: 'mkdir',
2019-04-13T01:24:06.959Z [err] npm ERR! path: '/home/pi/.npm/_cacache/index-v5/bd/db' },
2019-04-13T01:24:06.959Z [err] npm ERR! isOperational: true,
2019-04-13T01:24:06.959Z [err] npm ERR! stack:
2019-04-13T01:24:06.959Z [err] npm ERR! 'Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db'',
2019-04-13T01:24:06.959Z [err] npm ERR! errno: -13,
2019-04-13T01:24:06.960Z [err] npm ERR! code: 'EACCES',
2019-04-13T01:24:06.960Z [err] npm ERR! syscall: 'mkdir',
2019-04-13T01:24:06.960Z [err] npm ERR! path: '/home/pi/.npm/_cacache/index-v5/bd/db' }
2019-04-13T01:24:06.960Z [err] npm ERR!
2019-04-13T01:24:06.961Z [err]
2019-04-13T01:24:06.961Z [err] npm ERR! The operation was rejected by your operating system.
2019-04-13T01:24:06.961Z [err] npm ERR! It is likely you do not have the permissions to access this file as the current user
2019-04-13T01:24:06.961Z [err] npm ERR!
2019-04-13T01:24:06.961Z [err] npm ERR! If you believe this might be a permissions issue, please double-check the
2019-04-13T01:24:06.961Z [err] npm ERR!
2019-04-13T01:24:06.961Z [err] permissions of the file and its containing directories, or try running
2019-04-13T01:24:06.961Z [err] npm ERR! the command again as root/Administrator (though this is not recommended).
2019-04-13T01:24:06.978Z [err]
2019-04-13T01:24:06.979Z [err] npm ERR! A complete log of this run can be found in:
2019-04-13T01:24:06.979Z [err] npm ERR! /home/pi/.npm/_logs/2019-04-13T01_24_06_964Z-debug.log
2019-04-13T01:24:06.996Z rc=243

I followed this note on the failed install
sudo chown -R $USER:$(id -gn $USER) /home/pi/.config

Then ran the Node-RED install update package again.

It seemed to run without any errors.
I then tried to install dashboard using pallet manager but failed again.

nodered-install.log


Started : Sat Apr 13 11:12:31 AEST 2019
Running for user pi at /home/pi
Failed to stop nodered.service: Unit nodered.service not loaded.
Found global nodes: :
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodered
Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodejs-legacy' is not installed, so not removed
Package 'npm' is not installed, so not removed
Package 'nodejs' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up hostapd (2:2.6-15ubuntu2.2) ...
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript hostapd, action "restart" failed.
e[0;1;31mโ—e[0m hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; disabled; vendor preset: enabled)
Active: e[0;1;31mfailede[0m (Result: exit-code) since Sat 2019-04-13 11:12:40 AEST; 20ms ago
Process: 2335 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} e[0;1;31m(code=exited, status=1/FAILURE)e[0m

Apr 13 11:12:40 NanoPi-M4 systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Apr 13 11:12:40 NanoPi-M4 hostapd[2335]: Configuration file: /etc/hostapd/hostapd.conf
Apr 13 11:12:40 NanoPi-M4 hostapd[2335]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
Apr 13 11:12:40 NanoPi-M4 hostapd[2335]: Failed to set up interface with /etc/hostapd/hostapd.conf
Apr 13 11:12:40 NanoPi-M4 hostapd[2335]: Failed to initialize interface
Apr 13 11:12:40 NanoPi-M4 systemd[1]: e[0;1;39me[0;1;31me[0;1;39mhostapd.service: Control process exited, code=exited status=1e[0m
Apr 13 11:12:40 NanoPi-M4 systemd[1]: e[0;1;39me[0;1;31me[0;1;39mhostapd.service: Failed with result 'exit-code'.e[0m
Apr 13 11:12:40 NanoPi-M4 systemd[1]: e[0;1;31me[0;1;39me[0;1;31mFailed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.e[0m
dpkg: error processing package hostapd (--configure):
installed hostapd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
hostapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
dpkg: warning: ignoring request to remove nodejs which isn't installed
dpkg: warning: ignoring request to remove node which isn't installed
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up hostapd (2:2.6-15ubuntu2.2) ...
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript hostapd, action "restart" failed.
e[0;1;31mโ—e[0m hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; disabled; vendor preset: enabled)
Active: e[0;1;31mfailede[0m (Result: exit-code) since Sat 2019-04-13 11:12:47 AEST; 18ms ago
Process: 2446 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} e[0;1;31m(code=exited, status=1/FAILURE)e[0m

Apr 13 11:12:47 NanoPi-M4 systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Apr 13 11:12:47 NanoPi-M4 hostapd[2446]: Configuration file: /etc/hostapd/hostapd.conf
Apr 13 11:12:47 NanoPi-M4 hostapd[2446]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
Apr 13 11:12:47 NanoPi-M4 hostapd[2446]: Failed to set up interface with /etc/hostapd/hostapd.conf
Apr 13 11:12:47 NanoPi-M4 hostapd[2446]: Failed to initialize interface
Apr 13 11:12:47 NanoPi-M4 systemd[1]: e[0;1;39me[0;1;31me[0;1;39mhostapd.service: Control process exited, code=exited status=1e[0m
Apr 13 11:12:47 NanoPi-M4 systemd[1]: e[0;1;39me[0;1;31me[0;1;39mhostapd.service: Failed with result 'exit-code'.e[0m
Apr 13 11:12:47 NanoPi-M4 systemd[1]: e[0;1;31me[0;1;39me[0;1;31mFailed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.e[0m
dpkg: error processing package hostapd (--configure):
installed hostapd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
hostapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.58.0-2ubuntu3.6).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up hostapd (2:2.6-15ubuntu2.2) ...
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript hostapd, action "restart" failed.
e[0;1;31mโ—e[0m hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; disabled; vendor preset: enabled)
Active: e[0;1;31mfailede[0m (Result: exit-code) since Sat 2019-04-13 11:12:53 AEST; 18ms ago
Process: 2533 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} e[0;1;31m(code=exited, status=1/FAILURE)e[0m

Apr 13 11:12:53 NanoPi-M4 systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Apr 13 11:12:53 NanoPi-M4 hostapd[2533]: Configuration file: /etc/hostapd/hostapd.conf
Apr 13 11:12:53 NanoPi-M4 hostapd[2533]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
Apr 13 11:12:53 NanoPi-M4 hostapd[2533]: Failed to set up interface with /etc/hostapd/hostapd.conf
Apr 13 11:12:53 NanoPi-M4 hostapd[2533]: Failed to initialize interface
Apr 13 11:12:53 NanoPi-M4 systemd[1]: e[0;1;39me[0;1;31me[0;1;39mhostapd.service: Control process exited, code=exited status=1e[0m
Apr 13 11:12:53 NanoPi-M4 systemd[1]: e[0;1;39me[0;1;31me[0;1;39mhostapd.service: Failed with result 'exit-code'.e[0m
Apr 13 11:12:53 NanoPi-M4 systemd[1]: e[0;1;31me[0;1;39me[0;1;31mFailed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.e[0m
dpkg: error processing package hostapd (--configure):
installed hostapd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
hostapd
E: Sub-process /usr/bin/dpkg returned an error code (1)

Installing the NodeSource Node.js 10.x repo...

Populating apt-get cache...

Confirming "bionic" is supported...

Adding the NodeSource signing key to your keyring...

Creating apt sources list file for the NodeSource Node.js 10.x repo...

Running apt-get update for you...

Run sudo apt-get install -y nodejs to install Node.js 10.x and npm

You may also need development tools to build native addons:

 sudo apt-get install gcc g++ make

To install the Yarn package manager, run:

 curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
 echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
 sudo apt-get update && sudo apt-get install yarn

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
Need to get 14.5 MB of archives.
After this operation, 72.4 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_10.x bionic/main arm64 nodejs arm64 10.15.3-1nodesource1 [14.5 MB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 14.5 MB in 2s (6,325 kB/s)
Selecting previously unselected package nodejs.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 121667 files and directories currently installed.)
Preparing to unpack .../nodejs_10.15.3-1nodesource1_arm64.deb ...
Unpacking nodejs (10.15.3-1nodesource1) ...
Setting up nodejs (10.15.3-1nodesource1) ...
Setting up hostapd (2:2.6-15ubuntu2.2) ...
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript hostapd, action "restart" failed.
e[0;1;31mโ—e[0m hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; disabled; vendor preset: enabled)
Active: e[0;1;31mfailede[0m (Result: exit-code) since Sat 2019-04-13 11:13:26 AEST; 22ms ago
Process: 3505 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} e[0;1;31m(code=exited, status=1/FAILURE)e[0m

Apr 13 11:13:26 NanoPi-M4 systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Apr 13 11:13:26 NanoPi-M4 hostapd[3505]: Configuration file: /etc/hostapd/hostapd.conf
Apr 13 11:13:26 NanoPi-M4 hostapd[3505]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
Apr 13 11:13:26 NanoPi-M4 hostapd[3505]: Failed to set up interface with /etc/hostapd/hostapd.conf
Apr 13 11:13:26 NanoPi-M4 hostapd[3505]: Failed to initialize interface
Apr 13 11:13:26 NanoPi-M4 systemd[1]: e[0;1;39me[0;1;31me[0;1;39mhostapd.service: Control process exited, code=exited status=1e[0m
Apr 13 11:13:26 NanoPi-M4 systemd[1]: e[0;1;39me[0;1;31me[0;1;39mhostapd.service: Failed with result 'exit-code'.e[0m
Apr 13 11:13:26 NanoPi-M4 systemd[1]: e[0;1;31me[0;1;39me[0;1;31mFailed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.e[0m
dpkg: error processing package hostapd (--configure):
installed hostapd package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Errors were encountered while processing:
hostapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
/usr/bin/npx -> /usr/lib/node_modules/npm/bin/npx-cli.js
/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js

  • npm@6.9.0
    added 54 packages from 9 contributors, removed 15 packages and updated 47 packages in 18.81s
    /usr/bin/node-red -> /usr/lib/node_modules/node-red/red.js
    /usr/bin/node-red-pi -> /usr/lib/node_modules/node-red/bin/node-red-pi

bcrypt@3.0.5 install /usr/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.5/bcrypt_lib-v3.0.5-node-v64-linux-arm64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.5 and node@10.15.3 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
COPY Release/bcrypt_lib.node
COPY /usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'

  • node-red@0.20.5
    added 353 packages from 347 contributors in 53.774s
    0.20.5
    Finished : Sat Apr 13 11:12:31 AEST 2019

Started : Sat Apr 13 11:30:32 AEST 2019
Running for user pi at /home/pi
Found global nodes: :
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodered
/usr/bin/node-red -> /usr/lib/node_modules/node-red/red.js
/usr/bin/node-red-pi -> /usr/lib/node_modules/node-red/bin/node-red-pi

bcrypt@3.0.5 install /usr/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.5/bcrypt_lib-v3.0.5-node-v64-linux-arm64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.5 and node@10.15.3 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
COPY Release/bcrypt_lib.node
COPY /usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'

  • node-red@0.20.5
    added 353 packages from 347 contributors in 39.964s
    0.20.5
    Finished : Sat Apr 13 11:30:32 AEST 2019

.npm/_logs

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'install',
1 verbose cli '--no-audit',
1 verbose cli '--no-update-notifier',
1 verbose cli '--save',
1 verbose cli '--save-prefix="~"',
1 verbose cli '--production',
1 verbose cli 'node-red-dashboard@2.14.0' ]
2 info using npm@6.9.0
3 info using node@v10.15.3
4 verbose npm-session bf3741d1d326d77f
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/node-red-dashboard 360ms (from cache)
8 silly fetchPackageMetaData error for node-red-dashboard@2.14.0 EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db'
9 timing stage:rollbackFailedOptional Completed in 2ms
10 timing stage:runTopLevelLifecycles Completed in 505ms
11 verbose stack Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db'
12 verbose cwd /home/pi/.node-red
13 verbose Linux 4.4.154
14 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--no-audit" "--no-update-notifier" "--save" "--save-prefix="~"" "--production" "node-red-dashboard@2.14.0"
15 verbose node v10.15.3
16 verbose npm v6.9.0
17 error path /home/pi/.npm/_cacache/index-v5/bd/db
18 error code EACCES
19 error errno -13
20 error syscall mkdir
21 error Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db'
21 error { [Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db']
21 error cause:
21 error { Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db'
21 error errno: -13,
21 error code: 'EACCES',
21 error syscall: 'mkdir',
21 error path: '/home/pi/.npm/_cacache/index-v5/bd/db' },
21 error isOperational: true,
21 error stack:
21 error 'Error: EACCES: permission denied, mkdir '/home/pi/.npm/_cacache/index-v5/bd/db'',
21 error errno: -13,
21 error code: 'EACCES',
21 error syscall: 'mkdir',
21 error path: '/home/pi/.npm/_cacache/index-v5/bd/db' }
22 error The operation was rejected by your operating system.
22 error It is likely you do not have the permissions to access this file as the current user
22 error
22 error If you believe this might be a permissions issue, please double-check the
22 error permissions of the file and its containing directories, or try running
22 error the command again as root/Administrator (though this is not recommended).
23 verbose exit [ -13, true ]

OK, I don't know why there seems to be a fascination with hostapd, but aside from that you seem to be close. Luckily /home/pi/.npm is just a cache folder so can be safely removed and it will be re-created.

cd /home/pi 
sudo rm  -rf .npm

Then tell us what node -v. and. npm -v. report..
And restart and retry.Node-RED.

1 Like

Thank you.

deleted the file
node -v v10.15.3
npm -v 6.9.0

Started and opened Node-RED
Used Pallet manager to install Dashboard without any errors or problems.

Much appreciated.

1 Like