ch2i / LoraGW-Setup

SX1301 Lora Concentrator Raspberry PI based gateway setup
76 stars 30 forks source link

Monitor doesn't start due to bad/not compiled _rpi_ws281x.so file #4

Closed netweaver1970 closed 6 years ago

netweaver1970 commented 6 years ago

Hi, 1st of all, thanks for the great work you've done (and are still doing), the main function, working as a TTN Lorawan gateway, is working perfectly. I have the Pi0W + RAK831 board, PCB version 1.3 (small PCB). There is one issue though, the monitor doesn't properly start because the WS281X lib is not properly compiled. The file is in the expected location but is 0 bytes. A bit too short :) Below is the log for the monitor service.

What could I check/do to make it work? Compile something again differently/by itself?

Thanks, Geert

Oct 03 18:48:42 loragw-ac6d systemd[1]: Started LoraGW monitoring service.
Oct 03 18:48:46 loragw-ac6d monitor[1438]: Traceback (most recent call last):
Oct 03 18:48:46 loragw-ac6d monitor[1438]:   File "/opt/loragw/monitor.py", line 25, in <module>
Oct 03 18:48:46 loragw-ac6d monitor[1438]:     from neopixel import *
Oct 03 18:48:46 loragw-ac6d monitor[1438]:   File "build/bdist.linux-armv6l/egg/neopixel.py", line 5, in <module>
Oct 03 18:48:46 loragw-ac6d monitor[1438]:   File "build/bdist.linux-armv6l/egg/_rpi_ws281x.py", line 7, in <module>
Oct 03 18:48:46 loragw-ac6d monitor[1438]:   File "build/bdist.linux-armv6l/egg/_rpi_ws281x.py", line 6, in __bootstrap__
Oct 03 18:48:46 loragw-ac6d monitor[1438]: ImportError: /root/.cache/Python-Eggs/rpi_ws281x-1.0.0-py2.7-linux-armv6l.egg-tmp/_rpi_ws281x.so: file too short
Oct 03 18:48:46 loragw-ac6d systemd[1]: monitor.service: Main process exited, code=exited, status=1/FAILURE
Oct 03 18:48:46 loragw-ac6d systemd[1]: monitor.service: Unit entered failed state.
Oct 03 18:48:47 loragw-ac6d systemd[1]: monitor.service: Failed with result 'exit-code'.
Oct 03 18:48:52 loragw-ac6d systemd[1]: monitor.service: Service hold-off time over, scheduling restart.
Oct 03 18:48:52 loragw-ac6d systemd[1]: Stopped LoraGW monitoring service.
netweaver1970 commented 6 years ago

UPDATE : I ran the LED part of the config script again, separately in a new led.sh file . Log below. I'll dive a bit further into the script, see where that .so file should be coming from. But it looks like the downloaded (from git) .deb file install didn't finish at all: when querying using dpkg -r it says it's not installed but when trying to install it using dpkg -i says it's already there? Que? Anyway, if it's only this share lib that's missing, can we not simply get it from a working install and put it at the right location (as a stop-gap solution) while the root cause is analyzed?

You see, I'm not hindered by any knowledge here :)

Thanks, Geert

Installing WS2812B LED driver
Blacklisting snd_bcm2835 module due to WS2812b LED PWM
./led.sh: 6: ./led.sh: append1: not found
Installing WS2812B drivers and libraries
fatal: destination path 'rpi_ws281x' already exists and is not an empty directory.
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `libws2811.a' is up to date.
scons: `test' is up to date.
scons: done building targets.
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `deb' is up to date.
scons: done building targets.
(Reading database ... 38092 files and directories currently installed.)
Preparing to unpack libws2811_1.1.0-1.deb ...
Unpacking libws2811 (1.1.0-1) over (1.1.0-1) ...
postrm called with unknown argument `upgrade'
dpkg: warning: subprocess old post-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Use of uninitialized value $package in concatenation (.) or string at /usr/share/debconf/frontend line 68.
postrm called with unknown argument `failed-upgrade'
dpkg: error processing archive libws2811_1.1.0-1.deb (--install):
 subprocess new post-removal script returned error exit status 1
Use of uninitialized value $package in concatenation (.) or string at /usr/share/debconf/frontend line 68.
Errors were encountered while processing:
 libws2811_1.1.0-1.deb
running build
running build_py
running build_ext
running install
running bdist_egg
running egg_info
writing rpi_ws281x.egg-info/PKG-INFO
writing top-level names to rpi_ws281x.egg-info/top_level.txt
writing dependency_links to rpi_ws281x.egg-info/dependency_links.txt
reading manifest file 'rpi_ws281x.egg-info/SOURCES.txt'
writing manifest file 'rpi_ws281x.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv6l/egg
running install_lib
running build_py
running build_ext
creating build/bdist.linux-armv6l/egg
copying build/lib.linux-armv6l-2.7/_rpi_ws281x.so -> build/bdist.linux-armv6l/egg
copying build/lib.linux-armv6l-2.7/neopixel.py -> build/bdist.linux-armv6l/egg
byte-compiling build/bdist.linux-armv6l/egg/neopixel.py to neopixel.pyc
creating stub loader for _rpi_ws281x.so
byte-compiling build/bdist.linux-armv6l/egg/_rpi_ws281x.py to _rpi_ws281x.pyc
creating build/bdist.linux-armv6l/egg/EGG-INFO
copying rpi_ws281x.egg-info/PKG-INFO -> build/bdist.linux-armv6l/egg/EGG-INFO
copying rpi_ws281x.egg-info/SOURCES.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying rpi_ws281x.egg-info/dependency_links.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying rpi_ws281x.egg-info/top_level.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
writing build/bdist.linux-armv6l/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating 'dist/rpi_ws281x-1.0.0-py2.7-linux-armv6l.egg' and adding 'build/bdist.linux-armv6l/egg' to it
removing 'build/bdist.linux-armv6l/egg' (and everything under it)
Processing rpi_ws281x-1.0.0-py2.7-linux-armv6l.egg
Removing /usr/local/lib/python2.7/dist-packages/rpi_ws281x-1.0.0-py2.7-linux-armv6l.egg
Copying rpi_ws281x-1.0.0-py2.7-linux-armv6l.egg to /usr/local/lib/python2.7/dist-packages
rpi-ws281x 1.0.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/rpi_ws281x-1.0.0-py2.7-linux-armv6l.egg
Processing dependencies for rpi-ws281x==1.0.0
Finished processing dependencies for rpi-ws281x==1.0.0

> rpi-ws281x-native@0.9.0 install /opt/nodejs/lib/node_modules/rpi-ws281x-native
> node-gyp rebuild

make: Entering directory '/opt/nodejs/lib/node_modules/rpi-ws281x-native/build'
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/ws2811.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/pwm.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/dma.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/mailbox.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/board_info.o
  AR(target) Release/obj.target/rpi_libws2811.a
  COPY Release/rpi_libws2811.a
  CXX(target) Release/obj.target/rpi_ws281x/src/rpi-ws281x.o
  SOLINK_MODULE(target) Release/obj.target/rpi_ws281x.node
  COPY Release/rpi_ws281x.node
  COPY ../lib/binding/rpi_ws281x.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/opt/nodejs/lib/node_modules/rpi-ws281x-native/build'
+ rpi-ws281x-native@0.9.0
updated 1 package in 81.539s
/home/loragw/node_modules/rpi-ws281x-native -> /opt/nodejs/lib/node_modules/rpi-ws281x-native
netweaver1970 commented 6 years ago

UPDATE 2: It works !! I removed the rpi_ws281x subdirectory, ran the led.sh part of the setup again, let it re-compile all and now the LEDs are happily flashing green in turns. And the switch function to shutdown the OS properly is also working fine!

Just some physical work now to properly box it.

Very nice solution! Geert