Smartmeter Binding: After upgrading the NAS host system no access to /dev/ttyUSB0 in the container

Dear all,

I was running OpenHAB 3.4.4 in a docker on my ASUSTor NAS. After the last upgrade of the ASUSTor host system, my smartmeter reader is not working any more despite it was running for many years without any problem. I get the following error mesage:

COMMUNICATION_ERROR

No provider for port /dev/ttyUSB0 found (This is the serialport where I mapped the smartmeter usb device from the hostsystem to).

I checked the forum and found a few similiar issues. But none of the described solutions are working (mainly changing ownership and access rights). I also updated the container to openhab 4.0.3 without success.
If I logon to the docker console and try to read the ttyUSB0 port with cat I get a reading. I have also another USBserial device which is mapped to another container and works fine after the upgrade.

Thank you for your help.

It is relevant to know what your docker command is. In order to access host interface container must be launched in provileged mode or mounted with /dev directories. Can you share command you used?

Upper versions of linux tend to migrate to different locking mechanisms which might contribute to issues as well.

1 Like

Hi,

Iā€™m using portainer to configure the container. The command is

grafik

The container is configured with privileged mode.

grafik

Best Regards

You may need to verify group ids and ownership of ttyUSB0 on host. In principle once you get into container it should show some meaningful group id when you do la -l /dev/tty*. It could be that update of NAS operating system rolled out some new security defaults and flushed tweaks you did earlier.

1 Like

Thx, if I check the rights on the host system, Iā€™ll get.

crw-rw---- 1 root root 188, 0 Oct 19 08:23 /dev/ttyUSB0
crw-rw---- 1 root root 188, 1 Oct 19 08:23 /dev/ttyUSB1

The second USB device is successfully used in an another container.

I get the same results, when I run the command inside the container:

crw-rw---- 1 root root 188, 0 Oct 19 06:46 /dev/ttyUSB0
crw-rw---- 1 root root 188, 1 Oct 19 06:46 /dev/ttyUSB1

Iā€™m surprised that I see both USB devices inside the openhab container, as I have linked only oneā€¦

You see both devices because provileged flag. You can ommit it if you map device manually.
Core issue of problem is - openhab process within docker container have insufficient permissions to open serial port. Other container might run as root, thus have fewer constraints. Did your do some specific tweaks earlier to your NAS?

1 Like

You have been right, it was an access issue. For whatever reason the access has been limited to group root. So I added a new usergroup with the openhab user and it works.