Serial port problem

  • Platform information:
    • Hardware: Raspberry Pi 1
    • OS: Raspbian Stretch
    • Java Runtime Environment: OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
    • openHAB version: 2.2.0

Currently, I have issues bringing the Z-Wave PLugin to life. The Error I get is: Serial Error: Port /dev/ttyAMA0 does not exist

I manually installed openhab, sticking to https://docs.openhab.org/installation/linux.html#manual-installation

Things I have checked:

  • in the service configuration, in /lib/systemd/system/openhab2.service, i uncommented the line
#EnvironmentFile=/etc/default/openhab2
  • put
 EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"

into a new file named /etc/default/openhab2

added the openhab user to groups “dialout” and “tty”, so when i

grep tty /etc/group

i get

 tty:x:5:pi,openhab

and when i

grep dialout /etc/group

i get

dialout:x:20:pi,openhab

also, to verify openhab is called with the right parameters, is did

ps ax |grep ttyAMA0

and got

 435 ?        Ss+    0:00 /sbin/agetty --keep-baud 115200,38400,9600 ttyAMA0 vt220
    535 ?        Sl    29:25 /usr/bin/java -Dopenhab.home=/opt/openhab2 -Dopenhab.conf=/opt/openhab2/conf -
    Dopenhab.runtime=/opt/openhab2/runtime -Dopenhab.userdata=/opt/openhab2/userdata -
    Dopenhab.logdir=/opt/openhab2/userdata/logs -Dfelix.cm.dir=/opt/openhab2/userdata/config -Djetty.host=0.0.0.0 -
    Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=0.0.0.0 -Dorg.osgi.service.http.port=8080 
    -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true **-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0** -
    Djava.endorsed.dirs=/usr/lib/jvm/zulu-embedded-8-armhf/jre/lib/endorsed:/usr/lib/jvm/zulu-embedded-8-
    armhf/lib/endorsed:/opt/openhab2/runtime/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/zulu-embedded-8-
    armhf/jre/lib/ext:/usr/lib/jvm/zulu-embedded-8-armhf/lib/ext:/opt/openhab2/runtime/lib/ext -
    Dkaraf.instances=/opt/openhab2/userdata/tmp/instances -Dkaraf.home=/opt/openhab2/runtime -
    Dkaraf.base=/opt/openhab2/userdata -Dkaraf.data=/opt/openhab2/userdata -Dkaraf.etc=/opt/openhab2/userdata/etc -
    Dkaraf.logs=/opt/openhab2/userdata/logs -Dkaraf.restart.jvm.supported=true -
    Djava.io.tmpdir=/opt/openhab2/userdata/tmp -
    Djava.util.logging.config.file=/opt/openhab2/userdata/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -
    Dkaraf.startRemoteShell=true -classpath /opt/openhab2/runtime/lib/boot/org.apache.karaf.diagnostic.boot-
    4.1.3.jar:/opt/openhab2/runtime/lib/boot/org.apache.karaf.jaas.boot-
    4.1.3.jar:/opt/openhab2/runtime/lib/boot/org.apache.karaf.main-4.1.3.jar:/opt/openhab2/runtime/lib/boot/org.osgi.core-
    6.0.0.jar org.apache.karaf.main.Main
    13080 pts/0    S+     0:00 grep --color=auto ttyAMA0

I made the interesting part bold, so you don’t have to search the whole thing. So the parameter is in the command line…
Also, to verify that there is a /dev/ttyAMA0:

 ls -la /dev/ttyAMA0

returns

crw--w---- 1 root tty 204, 64 Dec 31 15:29 /dev/ttyAMA0

The java version should be the recommended 32 bit version of zulu,

 java -version

returns

 openjdk version "1.8.0_152"
   OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
   OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)

Any suggestions where to look next?
Thanks a lot,
Björn

PS: i already had the thing running with raspbian jessie, oracle java and oh 2.1, but the sd card crashed and so i had to set it up new…

I had a similar problem after upgrading to openhab 2.2. It disappeared after I used the appropriate options in openhabian.

So I was searching around for 3 days now, then decided to ask for help, and now i found it: In a fresh Raspbian Installation, the serial port is occupied by the serial console. I had to switch it off using raspi-config. This was one of the first things I did when I installed my first openhab, half a year ago.
Nevertheless, thanks for your help.

1 Like