Insteon Terminal on Raspberry Pi 3 - Installation

407 views
Skip to first unread message

brenna...@gmail.com

unread,
Sep 17, 2017, 11:44:49 PM9/17/17
to insteon-terminal
I'm stuck, I think I've tried everything, Oracle vs openjdk version of Java, putting the rxtx libraries in the path, hard coding the libraries, copying the raw file over to lib directories, twiddling  the call to start within the wrapper script, changing permissions on the serial port, changing group ownerships.  I find using the oracle java results in it simply taking less time to time out.

Hardware:
-Raspberry Pi 3 (fresh install with full raspbian installed, a failed attempt at openhab2 and insteon terminal)
-USB PLM 2413U



  • The problem is when you start it, it would seem regardless of what has been attempted:
^Cpi@raspberrypi:/opt/insteon-terminal $ ./insteon-terminal -nw
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/insteon-terminal/build/jars/insteon-terminal.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/insteon-terminal/lib/logger/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Insteon Terminal
Connecting
java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver
java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver
gnu.io.NoSuchPortException
Terminal ready!


  • running it as root also has the same outcome
  • I know the PLM is connected for sure as ttyUSB0:
dmesg | grep tty
[    4.448397] usb 1-1.5: FTDI USB Serial Device converter now attached to ttyUSB0

  • The init.py was untouched
-except for uncommenting this line:
connectToMySerial()
-and modifying to point at the PLM:
def connectToMySerial():
    """connects to my modem on pre-defined serial port"""
    connectToSerial("/dev/ttyUSB0")

  • I've used chmod to leave the serial port wide open until it works since I'm also having problems with openhab2, hence why I'm trying to dumb it down to the basics with "can we connect to the plm at all?" to start building up:
pi@raspberrypi:/opt/insteon-terminal $ ls -l /dev/ttyUSB0
crwxrwxrwx 1 root dialout 188, 0 Sep 17 15:06 /dev/ttyUSB0

  • and as a member of the dial out group it should have no issue (attempted to perform the rxtx troubleshooting suggestions, there's something about file locks noted there that was unclear):
pi@raspberrypi:/opt/insteon-terminal $ grep 'dialout' /etc/group
dialout:x:20:pi,openhab,root
pi@raspberrypi:/opt/insteon-terminal $ grep 'uucp' /etc/group
uucp:x:10:pi,root,openhab

  • I don't have a problem opening the serial port, like this:
pi@raspberrypi:/opt/insteon-terminal $ cat /dev/ttyUSB0 
^C
  • But I don't see any chatter when there is a device change, I paired both ways or at least thought I did; and the test switchlinc switch is also paired to the a new revision hub which I'm NOT using for automation, rather enough to limp the system through since Openhab is proving so difficult.
  • I've also performed the LD_LIBRARY_PATH step that was detailed on another thread, or at least I thought I did:
pi@raspberrypi:/opt/insteon-terminal $ echo $LD_LIBRARY_PATH
/usr/lib/jni/

  • and tried to sim link it as others have mentioned on other software threads (when you're spinning in circles I find it creates a big mess):
pi@raspberrypi:/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/arm $ ls -la
total 4960
drwxr-xr-x  5 root root   4096 Sep 17 13:28 .
drwxr-xr-x 12 root root   4096 Sep  7 09:31 ..
drwxr-xr-x  2 root root   4096 Sep  7 09:31 client
drwxr-xr-x  2 root root   4096 Sep  7 09:31 jli
-rw-r--r--  1 root root    620 Oct  6  2015 jvm.cfg
-rw-r--r--  1 root root   7944 Dec  9  2015 libattach.so
-rw-r--r--  1 root root  20424 Dec  9  2015 libawt_headless.so
-rw-r--r--  1 root root 538984 Dec  9  2015 libawt.so
-rw-r--r--  1 root root 299656 Dec  9  2015 libawt_xawt.so
-rw-r--r--  1 root root   5696 Dec  9  2015 libbci.so
-rw-r--r--  1 root root 148164 Dec  9  2015 libdcpr.so
-rw-r--r--  1 root root  11960 Dec  9  2015 libdt_socket.so
-rw-r--r--  1 root root 323196 Dec  9  2015 libfontmanager.so
-rw-r--r--  1 root root 125060 Dec  9  2015 libhprof.so
-rw-r--r--  1 root root  33220 Dec  9  2015 libinstrument.so
-rw-r--r--  1 root root  34564 Dec  9  2015 libj2gss.so
-rw-r--r--  1 root root   9228 Dec  9  2015 libj2pcsc.so
-rw-r--r--  1 root root  54948 Dec  9  2015 libj2pkcs11.so
-rw-r--r--  1 root root   4264 Dec  9  2015 libjaas_unix.so
-rw-r--r--  1 root root  17144 Dec  9  2015 libjava_crw_demo.so
-rw-r--r--  1 root root 147624 Dec  9  2015 libjava.so
-rw-r--r--  1 root root   3432 Dec  9  2015 libjawt.so
-rw-r--r--  1 root root 215936 Dec  9  2015 libjdwp.so
-rw-r--r--  1 root root  16332 Dec  9  2015 libjfr.so
-rw-r--r--  1 root root 209048 Dec  9  2015 libjpeg.so
-rw-r--r--  1 root root   7800 Dec  9  2015 libjsdt.so
-rw-r--r--  1 root root   6016 Dec  9  2015 libjsig.so
-rw-r--r--  1 root root  47220 Dec  9  2015 libjsoundalsa.so
-rw-r--r--  1 root root   3380 Dec  9  2015 libjsound.so
-rw-r--r--  1 root root 284936 Dec  9  2015 libkcms.so
-rw-r--r--  1 root root 277204 Dec  9  2015 liblcms.so
-rw-r--r--  1 root root  32200 Dec  9  2015 libmanagement.so
-rw-r--r--  1 root root 715292 Dec  9  2015 libmlib_image.so
-rw-r--r--  1 root root  80100 Dec  9  2015 libnet.so
-rw-r--r--  1 root root  55672 Dec  9  2015 libnio.so
-rw-r--r--  1 root root   8112 Dec  9  2015 libnpt.so
-rw-r--r--  1 root root   4808 Dec  9  2015 libresource.so
lrwxrwxrwx  1 root root     29 Sep 17 13:28 librxtxSerial.so -> /usr/lib/jni/librxtxSerial.so
-rw-r--r--  1 root root  42864 Dec  9  2015 libsaproc.so
-rw-r--r--  1 root root  16504 Dec  9  2015 libsctp.so
-rw-r--r--  1 root root 328900 Dec  9  2015 libsplashscreen.so
-rw-r--r--  1 root root 204092 Dec  9  2015 libsunec.so
-rw-r--r--  1 root root 366912 Dec  9  2015 libt2k.so
-rw-r--r--  1 root root 134928 Dec  9  2015 libunpack.so
-rw-r--r--  1 root root  40624 Dec  9  2015 libverify.so
-rw-r--r--  1 root root  94936 Dec  9  2015 libzip.so
drwxr-xr-x  2 root root   4096 Sep  7 09:31 server


In short, what does the error mean, that it could not open the virtual serial port and stalled out causing a problem initializing a class as the "no such port" exception implies, or that it cannot find the class?  In which case, how do I chase why it could not find the class, I've tried everything I can think of to troubleshoot that?  (using alternate open java that presumably has a smarter path expectations, tried forcing path, tried modifying call to java using -Djava parameter, tried the "ant clean" to start over);

I would have thought if it was a missing library, it shouldn't compile during the first execution, and if it was a port permissions issue it should complain about permissions; hence why I'm now stumped.

Any help is appreciated,

brenna...@gmail.com

unread,
Sep 18, 2017, 7:12:44 PM9/18/17
to insteon-terminal
Update:

command shows chatter when devices change state:
stty raw -echo < /dev/ttyUSB0; cat -vte /dev/ttyUSB0

So it's a software problem, I wanted to prevent someone creating a long winded troubleshooting message, I think I'll now fall in-line with an identical solution path to the thread linked above!

Daniel Pfrommer

unread,
Sep 18, 2017, 11:01:59 PM9/18/17
to insteon-terminal
First, do you have the latest version of the terminal? About 2 weeks ago I pushed some code to test a new version/fork of rxtx serial called nrjavaserial (which is the one used by openhab) that is supposed to solve the issue of installing native libraries alongside the Java ones. If you don't have the latest version, try upgrading to the latest version.

If you have the latest version, no extra setups should be necessary (the wiki is still written for the old version of librxtx, I'll have to update it). If it's not working with the latest version, let me know and try rolling back to:
before the new version of rxtx was introduced. The new version of rxtx was introduced due to some new oddities in how lockfiles are being handled.

I have never gotten the multiple slf4j bindings error when running insteon terminal, which makes me think your LD_LIBRARY_PATH might be misconfigured, but that's just a stab in the dark. Figuring out what version of the terminal you have is the first step.

A definite fix to this problem is compile a version of nrjavaserial yourself and replace the nrjavaserial.jar in lib/serial. I know this solved an issue for me on a different system where rxtx/nrjavaserial wasn't behaving quite right with lockfiles. The fact that you are using a pi might be a factor in nrjavaserial not working in your scenario.

brenna...@gmail.com

unread,
Sep 20, 2017, 11:48:08 PM9/20/17
to insteon-terminal
Hi Daniel,

Thanks for your reply, when all is broken it's hard to get traction!

So an update since I think it's good to share but I'm no longer roadblocked.  If there's typos I apologize, I use tab completion

-I wiped it and started over with a clean Raspbian install.
-sudo apt-get install ant
-sudo apt-get install xrdp   <- unlikely to be relevant
-cd ~
-cd ./insteon-terminal
-./insteon-terminal

I don't know what the other packages installed in the as mentioned outdated insteon terminal instructions are for, so with the intent of intentionally putting it together piece by piece I left them out.  And to answer the question, I've been running the latest version that uses nrjavaserial just as before when the issue was encountered (I've never had anything working other than an installation of Openhab that I abandoned last year due to the absence of support for the new motion sensor causing it to be sluggish when failing to query parameters from the motion sensor).  Also, my LD_LIBRARY_PATH is empty, when using "echo $LD_LIBRARY_PATH".  It comes up with Oracle Java installed (found using the ls -la dance described on the instructions from the insteon terminal install)  /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java

The behaviour in this state is the same as before, where with the default init.py as soon as you request it to connect via connectToSerial("/dev/ttyUSB0") it spits out the no such port on the command line.  It only required ant to be installed to compile.

------ so that shows for whatever reason the current version isn't working at least with whatever the base raspbian installation is (but now I could also be succumbing to any and all of the permissions problems that I was initially chasing); but this is what it looks like which means either root or dialout group member should work:
ls -l /dev/ttyUSB0
     crw-rw---- 1 root dialout 188, 0 Sep 21 02:26 /dev/ttyUSB0


I then used the command:
cd ~/insteon-terminal
git reset --hard c1eae7139b6c2b59a971d288ef2d81c0245a54
ant clean
./insteon-terminal

This time it now throws java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver

Therefore knowing where I stand I have a number of things to try:
-attempt following the old instructions with what I think is now the source code suggested for rollback, my modern linux is rusty
-attempt to find why the current version of insteon terminal has the duplicate sj4f references occurring, one reference is coming from the one jar and the other from the logback folder
-compile my own nrjavaserial and see what happens when combined with the new version
-finally, try to make my own version of a hello world that uses that serial interface and as much of the toolchain as possible

Since Openhab also did not work as described by installation instructions, I'm assuming the Openhab InsteonBinding and Insteon Terminal both fall flat for similar reasons since they both use nrjavaserial.

If I get it to work, I'll be sure to let others know, and if there's other things to try let me know!

brenna...@gmail.com

unread,
Sep 21, 2017, 12:58:48 AM9/21/17
to insteon-terminal
After performing the ln -s command in the instructions, it works with the older version of Insteon Terminal.  I will now set about playing with recompiling nrjavaserial and the current version.

cd /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/arm/
sudo ln -s /usr/lib/jni/librxtxSerial.so

pfro...@darienps.org

unread,
Sep 24, 2017, 9:27:05 AM9/24/17
to insteon-terminal
Awesome, glad to hear that. The librxtx library seems to have been in a non-standard location. I don't know why the nrjavaserial wasn't working, I'll have to do some more debugging to figure out why the nrjavaserial is throwing these errors.

brenna...@gmail.com

unread,
Oct 31, 2017, 11:23:09 PM10/31/17
to insteon-terminal
As another datapoint I spun up a Ubuntu 16.04 LTS virtual machine.  It has the same behaviour as I found on Raspbian on the latest version, I have yet to find success with recompiling to find those extra bindings problems which are coming out of something for logging, perhaps I did something incorrectly (have not tried again on the VM, which also works without anything special out of the box on the older version you provided).

Jeff Tapia

unread,
Nov 21, 2017, 8:25:02 PM11/21/17
to insteon-terminal
Brennan,

Any chance you can give me exact, simple steps to get inteon-terminal installed and working on a raspbian image for pi?
(of if you have a working image you can share).
I'm not very savvy on compiling and github commands so spoon feeding is really what I need.


Daniel Pfrommer

unread,
Nov 21, 2017, 9:27:28 PM11/21/17
to insteon-terminal
Okay, I got my hands on a raspberry pi and hooked up an insteonplm to it. Unfortunately the raspberry pi was running archlinux, not ubuntu, but I can verify that it doesn't seem to be an nrjavaserial problem with the hardware, which is odd given the error message. I'm going to flash an ubuntu image on the pi and see if I can track down the problem there. With Archlinux I had no setup problems running the terminal (I had to change the lock folder permissions since they are slightly different on arch, but beyond that there wasn't an issue). All that was required was to download java and ant, clone the repository and run ./insteon-terminal.

The fact that it doesn't work on Ubuntu 16.04 is very odd and suggests that there are problems with specific distributions rather than just the raspberry pi. I'll let you know as soon as I have tested the raspian image.

Jeff Tapia

unread,
Nov 21, 2017, 11:20:11 PM11/21/17
to insteon-terminal
Daniel, I "solved" this by your suggestions of reverting back to older builds (took me a bit to figure out the git checkout thing).

I rebuilt with the latest rpi image and documented on this thread.

Thanks for making insteon-terminal and sorry to be an almost-annual-pain.


Daniel Pfrommer

unread,
Nov 22, 2017, 4:25:54 PM11/22/17
to insteon-terminal
Alright, I did some research and it seems like rxtx/nrjavaserial at this point are just plain unsupported, which is why some OS's seem to be breaking the library. I rewrote the serial backend to use the JSerialComm library, which is supposed to be the new standard for doing anything serial related using java. I tested the terminal using JSerialComm on a raspberry pi running raspian and verified that (a) the old nrjavaserial simply didn't support the platform for whatever reason and (b) using the new JSerialComm library fixed the error message.

I know you have solved the issue by rolling back to an older version. Do you mind making a separate clone of the repository and trying to use the new JSerialComm backend. Hopefully we can then put the entire rxtx/nrjavaserial mess behind us and not have to deal with copying native libraries and unsupported platforms.

Thanks,
Daniel

Jeff Tapia

unread,
Nov 22, 2017, 9:56:17 PM11/22/17
to insteon-terminal
Thank you Daniel. I will try it this weekend (tomorrow and Friday are a big family holiday here) and report back. Owe ya.
Reply all
Reply to author
Forward
0 new messages