MySensors Serial Gateway not coming online in OH2

Greetings All.
I have hit a wall here. I am setting up openhab2 on my Ubuntu box. Im running Ubuntu 16.04 LTS, with Openhab 2 stable release installed.

I can get every other thing configured and running smoothly EXCEPT for this serial gateway.

My gateway is an Arduino Uno, flashed with the lastest stable MySensors library and serial gateway sketch. When its connected to the box via USB it comes up as /dev/ttyAMC0, and Im able to see it running via serial monitors. But when I go into openhab to add it the gateway still shows up as offline. I’ve already added openhab to ‘dialout’ and ‘tty’ groups and made the java exceptions changes and enabled the serial transport via karaf console as noted in the installation instructions.

The only thing the logs are producing is a generic "unable to connect to serial port tty/ACM0 message.

Im at a total loss here.

Use the correct name. ttyAMC0 ist not tty/ACM0.
Please post your definition.

Sorry they are both /dev/ttyACM0

@Dbagioni

I think @hr3 meant that tty/ACM0 is not /ttyACM0. But I hope this is a typo when posting and not configured like this in your item as port.

  1. Did you configure udev rules for the device? And gave it a distinct name? E.g. /ttyUno? And use this as port? See the docs.

https://docs.openhab.org/addons/bindings/serial1/readme.html

  1. Post your Item definition.
  2. Post the line added to /etc/default/openhab2 for the OPENHAB_JAVA_OPTS. Did you reboot after changing the Java Options?
  3. Post what you see after typing in the commandline. With the Uno plugged-in.
lsusb
  1. Post
ls -al /dev/

Ok still loosing my mind over here…First note Im not a software guy, im a hardware guy…soldering irons and oscilloscopes is where Im most comfortable.

So in response to your inquires.

1 - Yes I tried…but I cant find the “start.sh” that is mentioned and am not sure what numbers they are looking for.

SUBSYSTEM==“tty”, ATTRS{idVendor}==“0403”, ATTRS{idProduct}==“6001”, ATTRS{serial}==“AE01F0PD”, SYMLINK+=“ttyMySensors”

when I look at the USB devices this is the line Im seeing.

Bus 002 Device 004: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)

2 - I did not create an “item” but am not sure what to do with that beyond that because in my previous build the gateway was ‘self-discovered’ in the paperUI. Basically I turned it on and it popped up in the in box, clicked on it and i was happily running without issue.

3- Yes I did…rebooted (now more times than I can count).
#########################

JAVA OPTIONS

Additional options for the JAVA_OPTS environment variable.

These will be appended to the execution of the openHAB Java runtime in front$

A couple of independent examples:

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/tt$

EXTRA_JAVA_OPTS="-Djna.library.path=/lib/arm-linux-gnueabihf/ -Duser.timez$

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyACM0"

#########################

Bus 002 Device 004: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

drwxr-xr-x 20 root root 4260 Feb 18 08:31 .
drwxr-xr-x 25 root root 4096 Jan 23 06:07 …
crw------- 1 root root 10, 235 Feb 18 08:18 autofs
drwxr-xr-x 2 root root 400 Feb 18 08:18 block
drwxr-xr-x 2 root root 120 Feb 18 08:18 bsg
crw------- 1 root root 10, 234 Feb 18 08:18 btrfs-control
drwxr-xr-x 3 root root 60 Feb 18 08:18 bus
lrwxrwxrwx 1 root root 3 Feb 18 08:18 cdrom -> sr0
drwxr-xr-x 2 root root 3920 Feb 18 08:31 char
crw------- 1 root root 5, 1 Feb 18 08:18 console
lrwxrwxrwx 1 root root 11 Feb 18 08:18 core -> /proc/kcore
drwxr-xr-x 2 root root 60 Feb 18 08:18 cpu
crw------- 1 root root 10, 59 Feb 18 08:18 cpu_dma_latency
crw------- 1 root root 10, 203 Feb 18 08:18 cuse
drwxr-xr-x 5 root root 100 Feb 18 08:18 disk
drwxr-xr-x 2 root root 100 Feb 18 08:18 dri
lrwxrwxrwx 1 root root 3 Feb 18 08:18 dvd -> sr0
crw------- 1 root root 10, 61 Feb 18 08:18 ecryptfs
crw-rw---- 1 root video 29, 0 Feb 18 08:18 fb0
lrwxrwxrwx 1 root root 13 Feb 18 08:18 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Feb 18 08:18 full
crw-rw-rw- 1 root root 10, 229 Feb 18 08:18 fuse
crw------- 1 root root 10, 228 Feb 18 08:18 hpet
drwxr-xr-x 2 root root 0 Feb 18 08:18 hugepages
crw------- 1 root root 10, 183 Feb 18 08:18 hwrng
crw------- 1 root root 89, 0 Feb 18 08:18 i2c-0
crw------- 1 root root 89, 1 Feb 18 08:18 i2c-1
crw------- 1 root root 89, 2 Feb 18 08:18 i2c-2
crw------- 1 root root 89, 3 Feb 18 08:18 i2c-3
crw------- 1 root root 89, 4 Feb 18 08:18 i2c-4
crw------- 1 root root 89, 5 Feb 18 08:18 i2c-5
crw------- 1 root root 89, 6 Feb 18 08:18 i2c-6
crw------- 1 root root 89, 7 Feb 18 08:18 i2c-7
lrwxrwxrwx 1 root root 25 Feb 18 08:18 initctl -> /run/systemd/initctl/fifo
drwxr-xr-x 2 root root 220 Feb 18 08:18 input
crw------- 1 root root 247, 0 Feb 18 08:18 kfd
crw-r–r-- 1 root root 1, 11 Feb 18 08:18 kmsg
crw-rw----+ 1 root root 10, 232 Feb 18 08:18 kvm
drwxr-xr-x 2 root root 60 Feb 18 08:18 lightnvm
lrwxrwxrwx 1 root root 28 Feb 18 08:18 log -> /run/systemd/journal/dev-log
brw-rw---- 1 root disk 7, 0 Feb 18 08:18 loop0
brw-rw---- 1 root disk 7, 1 Feb 18 08:18 loop1
brw-rw---- 1 root disk 7, 2 Feb 18 08:18 loop2
brw-rw---- 1 root disk 7, 3 Feb 18 08:18 loop3
brw-rw---- 1 root disk 7, 4 Feb 18 08:18 loop4
brw-rw---- 1 root disk 7, 5 Feb 18 08:18 loop5
brw-rw---- 1 root disk 7, 6 Feb 18 08:18 loop6
brw-rw---- 1 root disk 7, 7 Feb 18 08:18 loop7
crw-rw---- 1 root disk 10, 237 Feb 18 08:18 loop-control
crw-rw---- 1 root lp 6, 0 Feb 18 08:18 lp0
drwxr-xr-x 2 root root 60 Feb 18 08:18 mapper
crw------- 1 root root 10, 227 Feb 18 08:18 mcelog
crw------- 1 root root 246, 0 Feb 18 08:18 mei0
crw-r----- 1 root kmem 1, 1 Feb 18 08:18 mem
crw------- 1 root root 10, 56 Feb 18 08:18 memory_bandwidth
drwxrwxrwt 2 root root 40 Feb 18 08:18 mqueue
drwxr-xr-x 2 root root 60 Feb 18 08:18 net
crw------- 1 root root 10, 58 Feb 18 08:18 network_latency
crw------- 1 root root 10, 57 Feb 18 08:18 network_throughput
crw-rw-rw- 1 root root 1, 3 Feb 18 08:18 null
crw-rw-r-- 1 root lp 99, 0 Feb 18 08:18 parport0
crw-r----- 1 root kmem 1, 4 Feb 18 08:18 port
crw------- 1 root root 108, 0 Feb 18 08:18 ppp
crw------- 1 root root 10, 1 Feb 18 08:18 psaux
crw-rw-rw- 1 root tty 5, 2 Feb 18 09:53 ptmx
drwxr-xr-x 2 root root 0 Feb 18 08:18 pts
crw-rw-rw- 1 root root 1, 8 Feb 18 08:18 random
crw-rw-r–+ 1 root netdev 10, 62 Feb 18 08:18 rfkill
lrwxrwxrwx 1 root root 4 Feb 18 08:18 rtc -> rtc0
crw------- 1 root root 251, 0 Feb 18 08:18 rtc0
brw-rw---- 1 root disk 8, 0 Feb 18 08:18 sda
brw-rw---- 1 root disk 8, 1 Feb 18 08:18 sda1
brw-rw---- 1 root disk 8, 2 Feb 18 08:18 sda2
brw-rw---- 1 root disk 8, 5 Feb 18 08:18 sda5
brw-rw---- 1 root disk 8, 16 Feb 18 08:18 sdb
brw-rw---- 1 root disk 8, 17 Feb 18 08:18 sdb1
brw-rw---- 1 root disk 8, 32 Feb 18 08:18 sdc
brw-rw---- 1 root disk 8, 33 Feb 18 08:18 sdc1
brw-rw---- 1 root disk 8, 34 Feb 18 08:18 sdc2
drwxr-xr-x 4 root root 80 Feb 18 08:31 serial
crw-rw---- 1 root disk 21, 0 Feb 18 08:18 sg0
crw-rw---- 1 root disk 21, 1 Feb 18 08:18 sg1
crw-rw---- 1 root disk 21, 2 Feb 18 08:18 sg2
crw-rw----+ 1 root cdrom 21, 3 Feb 18 08:18 sg3
drwxrwxrwt 2 root root 180 Feb 18 08:19 shm
crw------- 1 root root 10, 231 Feb 18 08:18 snapshot
drwxr-xr-x 3 root root 260 Feb 18 08:18 snd
brw-rw----+ 1 root cdrom 11, 0 Feb 18 08:18 sr0
lrwxrwxrwx 1 root root 15 Feb 18 08:18 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Feb 18 08:18 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Feb 18 08:18 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty 5, 0 Feb 18 09:51 tty
crw–w---- 1 root tty 4, 0 Feb 18 08:18 tty0
crw–w---- 1 root tty 4, 1 Feb 18 08:18 tty1
crw–w---- 1 root tty 4, 10 Feb 18 08:18 tty10
crw–w---- 1 root tty 4, 11 Feb 18 08:18 tty11
crw–w---- 1 root tty 4, 12 Feb 18 08:18 tty12
crw–w---- 1 root tty 4, 13 Feb 18 08:18 tty13
crw–w---- 1 root tty 4, 14 Feb 18 08:18 tty14
crw–w---- 1 root tty 4, 15 Feb 18 08:18 tty15
crw–w---- 1 root tty 4, 16 Feb 18 08:18 tty16
crw–w---- 1 root tty 4, 17 Feb 18 08:18 tty17
crw–w---- 1 root tty 4, 18 Feb 18 08:18 tty18
crw–w---- 1 root tty 4, 19 Feb 18 08:18 tty19
crw–w---- 1 root tty 4, 2 Feb 18 08:18 tty2
crw–w---- 1 root tty 4, 20 Feb 18 08:18 tty20
crw–w---- 1 root tty 4, 21 Feb 18 08:18 tty21
crw–w---- 1 root tty 4, 22 Feb 18 08:18 tty22
crw–w---- 1 root tty 4, 23 Feb 18 08:18 tty23
crw–w---- 1 root tty 4, 24 Feb 18 08:18 tty24
crw–w---- 1 root tty 4, 25 Feb 18 08:18 tty25
crw–w---- 1 root tty 4, 26 Feb 18 08:18 tty26
crw–w---- 1 root tty 4, 27 Feb 18 08:18 tty27
crw–w---- 1 root tty 4, 28 Feb 18 08:18 tty28
crw–w---- 1 root tty 4, 29 Feb 18 08:18 tty29
crw–w---- 1 root tty 4, 3 Feb 18 08:18 tty3
crw–w---- 1 root tty 4, 30 Feb 18 08:18 tty30
crw–w---- 1 root tty 4, 31 Feb 18 08:18 tty31
crw–w---- 1 root tty 4, 32 Feb 18 08:18 tty32
crw–w---- 1 root tty 4, 33 Feb 18 08:18 tty33
crw–w---- 1 root tty 4, 34 Feb 18 08:18 tty34
crw–w---- 1 root tty 4, 35 Feb 18 08:18 tty35
crw–w---- 1 root tty 4, 36 Feb 18 08:18 tty36
crw–w---- 1 root tty 4, 37 Feb 18 08:18 tty37
crw–w---- 1 root tty 4, 38 Feb 18 08:18 tty38
crw–w---- 1 root tty 4, 39 Feb 18 08:18 tty39
crw–w---- 1 root tty 4, 4 Feb 18 08:18 tty4
crw–w---- 1 root tty 4, 40 Feb 18 08:18 tty40
crw–w---- 1 root tty 4, 41 Feb 18 08:18 tty41
crw–w---- 1 root tty 4, 42 Feb 18 08:18 tty42
crw–w---- 1 root tty 4, 43 Feb 18 08:18 tty43
crw–w---- 1 root tty 4, 44 Feb 18 08:18 tty44
crw–w---- 1 root tty 4, 45 Feb 18 08:18 tty45
crw–w---- 1 root tty 4, 46 Feb 18 08:18 tty46
crw–w---- 1 root tty 4, 47 Feb 18 08:18 tty47
crw–w---- 1 root tty 4, 48 Feb 18 08:18 tty48
crw–w---- 1 root tty 4, 49 Feb 18 08:18 tty49
crw–w---- 1 root tty 4, 5 Feb 18 08:18 tty5
crw–w---- 1 root tty 4, 50 Feb 18 08:18 tty50
crw–w---- 1 root tty 4, 51 Feb 18 08:18 tty51
crw–w---- 1 root tty 4, 52 Feb 18 08:18 tty52
crw–w---- 1 root tty 4, 53 Feb 18 08:18 tty53
crw–w---- 1 root tty 4, 54 Feb 18 08:18 tty54
crw–w---- 1 root tty 4, 55 Feb 18 08:18 tty55
crw–w---- 1 root tty 4, 56 Feb 18 08:18 tty56
crw–w---- 1 root tty 4, 57 Feb 18 08:18 tty57
crw–w---- 1 root tty 4, 58 Feb 18 08:18 tty58
crw–w---- 1 root tty 4, 59 Feb 18 08:18 tty59
crw–w---- 1 root tty 4, 6 Feb 18 08:18 tty6
crw–w---- 1 root tty 4, 60 Feb 18 08:18 tty60
crw–w---- 1 root tty 4, 61 Feb 18 08:18 tty61
crw–w---- 1 root tty 4, 62 Feb 18 08:18 tty62
crw–w---- 1 root tty 4, 63 Feb 18 08:18 tty63
crw–w---- 1 root tty 4, 7 Feb 18 08:18 tty7
crw–w---- 1 root tty 4, 8 Feb 18 08:18 tty8
crw–w---- 1 root tty 4, 9 Feb 18 08:18 tty9
crw-rw---- 1 root dialout 166, 0 Feb 18 08:31 ttyACM0
crw------- 1 root root 5, 3 Feb 18 08:18 ttyprintk
crw-rw---- 1 root dialout 4, 64 Feb 18 08:18 ttyS0
crw-rw---- 1 root dialout 4, 65 Feb 18 08:18 ttyS1
crw-rw---- 1 root dialout 4, 74 Feb 18 08:18 ttyS10
crw-rw---- 1 root dialout 4, 75 Feb 18 08:18 ttyS11
crw-rw---- 1 root dialout 4, 76 Feb 18 08:18 ttyS12
crw-rw---- 1 root dialout 4, 77 Feb 18 08:18 ttyS13
crw-rw---- 1 root dialout 4, 78 Feb 18 08:18 ttyS14
crw-rw---- 1 root dialout 4, 79 Feb 18 08:18 ttyS15
crw-rw---- 1 root dialout 4, 80 Feb 18 08:18 ttyS16
crw-rw---- 1 root dialout 4, 81 Feb 18 08:18 ttyS17
crw-rw---- 1 root dialout 4, 82 Feb 18 08:18 ttyS18
crw-rw---- 1 root dialout 4, 83 Feb 18 08:18 ttyS19
crw-rw---- 1 root dialout 4, 66 Feb 18 08:18 ttyS2
crw-rw---- 1 root dialout 4, 84 Feb 18 08:18 ttyS20
crw-rw---- 1 root dialout 4, 85 Feb 18 08:18 ttyS21
crw-rw---- 1 root dialout 4, 86 Feb 18 08:18 ttyS22
crw-rw---- 1 root dialout 4, 87 Feb 18 08:18 ttyS23
crw-rw---- 1 root dialout 4, 88 Feb 18 08:18 ttyS24
crw-rw---- 1 root dialout 4, 89 Feb 18 08:18 ttyS25
crw-rw---- 1 root dialout 4, 90 Feb 18 08:18 ttyS26
crw-rw---- 1 root dialout 4, 91 Feb 18 08:18 ttyS27
crw-rw---- 1 root dialout 4, 92 Feb 18 08:18 ttyS28
crw-rw---- 1 root dialout 4, 93 Feb 18 08:18 ttyS29
crw-rw---- 1 root dialout 4, 67 Feb 18 08:18 ttyS3
crw-rw---- 1 root dialout 4, 94 Feb 18 08:18 ttyS30
crw-rw---- 1 root dialout 4, 95 Feb 18 08:18 ttyS31
crw-rw---- 1 root dialout 4, 68 Feb 18 08:18 ttyS4
crw-rw---- 1 root dialout 4, 69 Feb 18 08:18 ttyS5
crw-rw---- 1 root dialout 4, 70 Feb 18 08:18 ttyS6
crw-rw---- 1 root dialout 4, 71 Feb 18 08:18 ttyS7
crw-rw---- 1 root dialout 4, 72 Feb 18 08:18 ttyS8
crw-rw---- 1 root dialout 4, 73 Feb 18 08:18 ttyS9
crw------- 1 root root 10, 239 Feb 18 08:18 uhid
crw------- 1 root root 10, 223 Feb 18 08:18 uinput
crw-rw-rw- 1 root root 1, 9 Feb 18 08:18 urandom
crw------- 1 root root 10, 240 Feb 18 08:18 userio
crw-rw---- 1 root tty 7, 0 Feb 18 08:18 vcs
crw-rw---- 1 root tty 7, 1 Feb 18 08:18 vcs1
crw-rw---- 1 root tty 7, 2 Feb 18 08:18 vcs2
crw-rw---- 1 root tty 7, 3 Feb 18 08:18 vcs3
crw-rw---- 1 root tty 7, 4 Feb 18 08:18 vcs4
crw-rw---- 1 root tty 7, 5 Feb 18 08:18 vcs5
crw-rw---- 1 root tty 7, 6 Feb 18 08:18 vcs6
crw-rw---- 1 root tty 7, 128 Feb 18 08:18 vcsa
crw-rw---- 1 root tty 7, 129 Feb 18 08:18 vcsa1
crw-rw---- 1 root tty 7, 130 Feb 18 08:18 vcsa2
crw-rw---- 1 root tty 7, 131 Feb 18 08:18 vcsa3
crw-rw---- 1 root tty 7, 132 Feb 18 08:18 vcsa4
crw-rw---- 1 root tty 7, 133 Feb 18 08:18 vcsa5
crw-rw---- 1 root tty 7, 134 Feb 18 08:18 vcsa6
drwxr-xr-x 2 root root 60 Feb 18 08:18 vfio
crw------- 1 root root 10, 63 Feb 18 08:18 vga_arbiter
crw------- 1 root root 10, 137 Feb 18 08:18 vhci
crw------- 1 root root 10, 238 Feb 18 08:18 vhost-net
crw-rw-rw- 1 root root 1, 5 Feb 18 08:18 zero

Thats what I have.

And to add to my frustration, I can see and interact with the gateway via Arduino Serial Monitor. But i cant copy that out for some reason…but it boots up normally and interfaces with devices as it should.

@Dbagioni

  1. when you use systemctl start openhab.service then i think your start.sh should be /etc/default/openhab2 this is where you should add EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyAMA0:/dev/ttyACM0"

As your post is not right formatted i im not sure but i think you have it there. Have a look here for more information about formatting posts.

Maybe just check in

  1. Did you install the binding? I am not sure but the name serial1 suggests that it is a OpenHAB1 binding. Maybe you need to add legacy binding support. But i think not as the documentation does not list it as legacy.

  2. List the groups of your openhab, maybe it is not in dialout. I know you said it should be. I just try to find the problem.

sudo -u openhab groups
  1. Try to use the serial connection as openhab
sudo -u openhab <SerialTerminalConnection>
  1. Maybe try to define a Item
String UnoItem { serial="/dev/ttyACM0@<baudrate>" } 

And maybe you can find something in teh logs?

My start.sh file (i foudn it I think) is actually in /usr/share/openhab2. But it is literally 4 lines. the execute line reads.

exec “${DIRNAME}/runtime/bin/karaf” “${@}”

The file it references is pretty well buried in the runtime directory. Its a bunch of greek to me. It is about 150 lines or so.

  1. I have 2 bindings…the latest mysensors is 2.3.0 which I can get to run right. So I downgraded and manually installed 2.2.0 which runs perfectly on my other OH server.

  2. “openhab tty dialout david” is the output when I enter the group listing.

  3. Not to sure how to do that…I keep getting errors. “command not valid”

And I do have an item made for the gateway.
String UnoGateway { serial="/dev/ttyACM0@<115200>" }

Still pluggin on this one.

remove the brackets

@Dbagioni my /etc/init.d/openhab2 contains

...
  
# Read configuration variable file if it is present
if [ -r /etc/default/openhab2 ]; then
  . /etc/default/openhab2

...

and /etc/default/openhab2 has this.

...

#########################
## JAVA OPTIONS
## Additional options for the JAVA_OPTS environment variable.
## These will be appended to the execution of the openHAB Java runtime in front of a$
##
## A couple of independent examples:
##   EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"
##   EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/$
##   EXTRA_JAVA_OPTS="-Djna.library.path=/lib/arm-linux-gnueabihf/ -Duser.timezone=E$

EXTRA_JAVA_OPTS=""

...

Please see if you find similar files!
Please post all 4 lines if the start.sh!

  1. Opening a serial connection try serial,
sudo apt install screen
screen /dev/ttyACM0 115200
sudo -u openhab screen /dev/ttyACM0 115200
  1. Items file
String UnoGateway { serial="/dev/ttyACM0@115200" }
  1. What does the logg say. Any Errors or messages?

Ok…progress has been made. I now have a serial gateway online and mysensors is back finding nodes like a fat kid in a cupcake shop. Buuuuuutttttt when the gateway goes idle it is going ofline and I have to reboot the box?

In conjuction with the item placed in the item file I managed to locate the file that specifically deals with java setting its environment and default ports. It resides in usr/share.openhab2/runtime/bin, it is called setenv, there is a section called “set JAVA options”

export JAVA_OPTS="${JAVA_OPTS}
-Dopenhab.home=${OPENHAB_HOME}
-Dopenhab.conf=${OPENHAB_CONF}
-Dopenhab.runtime=${OPENHAB_RUNTIME}
-Dopenhab.userdata=${OPENHAB_USERDATA}
-Dopenhab.logdir=${OPENHAB_LOGDIR}
-Dfelix.cm.dir=${OPENHAB_USERDATA}/config
-Djetty.host=${HTTP_ADDRESS}
-Djetty.http.compliance=RFC2616
-Dorg.ops4j.pax.web.listening.addresses=${HTTP_ADDRESS}
-Dorg.osgi.service.http.port=${HTTP_PORT}
-Dorg.osgi.service.http.port.secure=${HTTPS_PORT}
-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0"

I added the last line, just the same as in the /etc/default/openhab2 file. After I did all of the above and rebooted the gateway began showing up as online. Now it keeps going “offline” despite being active.

First this is where the files should be.

https://docs.openhab.org/installation/linux.html#file-locations/

How did you install with apt-get or manual.
And second runtime folder content changes are not permanent.

You say you have no /etc/default/openhab2 so i assume you installed manually. So this files should be of interrest.

/etc/init.d/openhab 
/usr/share/openhab/bin/openhab.sh

I installed via apt-get.

I have the /etc/default/openhab2 files and I added the JAVA information to them as well as the other file.

What should I look for in the init.d files?

if you installed wtih apt-get ony the /etc/default/openhab2 should be of concern to add EXTRA_JAVA_OPTSand then a reboot.