Docker snapshot not reading my serial ports

I am having no luck under docker

  • Platform information:
    • Hardware: amd64 docker image
    • OS: Debian 10
    • Java Runtime Environment: Whatever docker snapshot has
    • openHAB version: 2.5.0
  • Issue of the topic:

Unable to detect nortek dongle for either communication protocol. “Offline - Communication Error”

The dropdown under the controller/coordinator does not show any serial dropdown like i see on videos. Im guessing something is missing. I have read over and over all the docs with no luck. Here is what i tried

  • Added openhab to groups on host: openhab tty dialout audio bluetooth
  • Confirmed serial device is using proper driver “cp210x” with “dmesg | grep tty”
    [ 5.148772] usb 1-1.1.3: cp210x converter now attached to ttyUSB0
    [ 5.160085] usb 1-1.1.3: cp210x converter now attached to ttyUSB1
  • Added EXTRA_JAVA_OPTS=-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyUSB1
  • Docker device passed: --device=/dev/ttyUSB0 and --device=/dev/ttyUSB0
  • Alternatively tried passing devices as volume path as well seperately
  • Added zigbee as Port=/dev/ttyUSB1, flow control=software, baud=57600
  • Checked to see if docker can see the file using "docker exec -it openhab ls -lisa /dev/ttyUSB*
    11817 0 crw-rw-rw- 1 root dialout 188, 0 Dec 30 13:00 /dev/ttyUSB0
    16696 0 crw-rw-rw- 1 root dialout 188, 1 Dec 30 13:00 /dev/ttyUSB1
  • Checked docker uid and gid, both are 1000 (openhab)
  • Changed udev rules to 666 for ttyUSB[0-9]
  • Started home assistant docker image and zwave/zigbee both work and shows up with --device

Logs:

==> /srv/dev-disk-by-id-md-name-omv-Raid-part1/openhab/userdata/logs/events.log <==
2019-12-30 09:15:48.851 [hingStatusInfoChangedEvent] - 'zigbee:coordinator_ember:d407648b' changed from UNINITIALIZED to INITIALIZING
2019-12-30 09:15:48.858 [me.event.ThingUpdatedEvent] - Thing 'zigbee:coordinator_ember:d407648b' has been updated.
2019-12-30 09:15:48.860 [me.event.ThingUpdatedEvent] - Thing 'zigbee:coordinator_ember:d407648b' has been updated.
2019-12-30 09:15:48.861 [me.event.ThingUpdatedEvent] - Thing 'zigbee:coordinator_ember:d407648b' has been updated.
2019-12-30 09:15:48.864 [me.event.ThingUpdatedEvent] - Thing 'zigbee:coordinator_ember:d407648b' has been updated.
2019-12-30 09:15:48.865 [hingStatusInfoChangedEvent] - 'zigbee:coordinator_ember:d407648b' changed from INITIALIZING to UNKNOWN
2019-12-30 09:15:48.865 [nt.FirmwareStatusInfoEvent] - Firmware status of thing zigbee:coordinator_ember:d407648b changed to UNKNOWN.

==> /srv/dev-disk-by-id-md-name-omv-Raid-part1/openhab/userdata/logs/openhab.log <==
2019-12-30 09:15:49.864 [ERROR] [zigbee.dongle.ember.ZigBeeDongleEzsp] - Unable to open Ember serial port

==> /srv/dev-disk-by-id-md-name-omv-Raid-part1/openhab/userdata/logs/events.log <==
2019-12-30 09:15:49.865 [hingStatusInfoChangedEvent] - 'zigbee:coordinator_ember:d407648b' changed from UNKNOWN to OFFLINE: Failed to open communications port
2019-12-30 09:15:49.866 [hingStatusInfoChangedEvent] - 'zigbee:coordinator_ember:d407648b' changed from OFFLINE: Failed to open communications port to OFFLINE (COMMUNICATION_ERROR)

==> /srv/dev-disk-by-id-md-name-omv-Raid-part1/openhab/userdata/logs/openhab.log <==
2019-12-30 09:15:50.867 [ERROR] [zigbee.dongle.ember.ZigBeeDongleEzsp] - Unable to open Ember serial port

==> /srv/dev-disk-by-id-md-name-omv-Raid-part1/openhab/userdata/logs/events.log <==
2019-12-30 09:15:50.868 [hingStatusInfoChangedEvent] - 'zigbee:coordinator_ember:d407648b' changed from OFFLINE (COMMUNICATION_ERROR) to OFFLINE: Failed to open communications port
2019-12-30 09:15:50.869 [hingStatusInfoChangedEvent] - 'zigbee:coordinator_ember:d407648b' changed from OFFLINE: Failed to open communications port to OFFLINE (COMMUNICATION_ERROR)

==> /srv/dev-disk-by-id-md-name-omv-Raid-part1/openhab/userdata/logs/openhab.log <==
2019-12-30 09:15:55.869 [ERROR] [zigbee.dongle.ember.ZigBeeDongleEzsp] - Unable to open Ember serial port

==> /srv/dev-disk-by-id-md-name-omv-Raid-part1/openhab/userdata/logs/events.log <==
2019-12-30 09:15:55.870 [hingStatusInfoChangedEvent] - 'zigbee:coordinator_ember:d407648b' changed from OFFLINE (COMMUNICATION_ERROR) to OFFLINE: Failed to open communications port
2019-12-30 09:15:55.871 [hingStatusInfoChangedEvent] - 'zigbee:coordinator_ember:d407648b' changed from OFFLINE: Failed to open communications port to OFFLINE (COMMUNICATION_ERROR)

You are running in Docker so it’s important to be very clear when you are talking about something you’ve done inside the container and something you’ve done on the host.

Where, inside the container or on the host? Did you create an openhab user on the host? Did you add it to those groups on the host?

This definitely won’t work.

And?

What are the permissions on the files?

Fair point haha,

I ran the group command on the host. I also alternatively tried it on the container as well for shits and giggles.

docker exec -it openhab ls -lisa /dev/ttyUSB* results:

11817 0 crw-rw-rw- 1 root dialout 188, 0 Dec 30 13:00 /dev/ttyUSB0
16696 0 crw-rw-rw- 1 root dialout 188, 1 Dec 30 13:00 /dev/ttyUSB1

OK, first let’s completely rule out permission problems.

Get a shell into the container:

docker exec -it openhab /bin/bash

then su to the openhab user

su - openhab

Now that you’re running as the openhab user lets check some things.

groups

Make sure that dialout is in the list.

cat /dev/ttyUSB1

Nothing will probably happen but if there were a permission problem, it should say so and exit.

I personally don’t actually supply any EXTRA_JAVA_OPTS in my command and both the Zwave and Zigbee work just fine for me. Maybe try removing that just to see what happens.

When I pass the devices, I explicitly tell it to pass it rwm (read/write/mknode).

Here is the Ansible task I use to deploy. You should be able to easily map the options to the docker run command.

- name: Update openHAB docker
  docker_container:
    detach: True
    devices:
      - "/dev/ttyUSB0:/dev/ttyUSB0:rwm"
      - "/dev/ttyUSB1:/dev/ttyUSB1:rwm"
    env:
      CRYPTO_POLICY: unlimited
    hostname: argus.koshak.net
    image: "{{ openhab_version }}"
    log_driver: syslog
    name: openhab
    network_mode: host
    pull: True
    recreate: True
    restart: True
    restart_policy: always
    tty: yes
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - "{{ openhab_data }}/conf:/openhab/conf"
      - "{{ openhab_data }}/userdata:/openhab/userdata"
      - "{{ openhab_data }}/addons:/openhab/addons"

Just tried adding rwm, no change in the outputs. Still Serial Error: Port /dev/ttyUSB0 does not exist

Also yea ive tried removing the javaopts already with no success.

I have posted a bounty

I’m not sure a bounty will do much good here. I doubt there are any code changes necessary here.

At this point I don’t have any recommendations. All I can say is it works for me using the Ansible Task above. Everything else you’ve posted appears to check out.

Im not exactly sure what is going on. I even tried running a ls command under openhab shell. “shell:ls -l /dev/tty*” and the output was the same.

orw-rw-rw-   1 root     dialout         0 Dec 30 14:47 /dev/ttyUSB0
orw-rw-rw-   1 root     dialout         0 Dec 30 14:47 /dev/ttyUSB1

Im not sure why it says o instead of c, let alone what either of those two mean in front of the permissions

I’ve never seen an “o” before. I’ve no idea what that means and it doesn’t appear in info ls. That could be a clue.

Most likely the issue is that the serial libraries cannot not be properly loaded on OpenMediaVault because it doesn’t allow the serial libraries in the temp dir to be set as executable since it mounts filesystems using the noexec flag.

There’s also a YouTube video about how to remove the noexec flag to fix similar issues when using Plex/OpenVPN with Docker on OMV.