[SOLVED] FS20 binding with CUL - Error in DOCKER

I’m using OH 2.2 on my QNAP NAS for about 2 years.
In order to be more flexible I tried to install, OH 2.2 in a DOCKER Container on my QNAP NAS.
The installation so far went well. I could map the original config and user data folders I used before to the OH2.2 inside the Container.
However, I’m getting an error, when trying to control some devices used FS20 bindings.
I connect via CUL - which is working well when using the OH 2.2 version on the NAS directly, but not inside the Container anymore :frowning:

Seems that the CUL cannot be addressed from inside the container?!

Any idea?

Many thanks

09:27:02.988 [INFO ] [smarthome.event.ExtensionEvent       ] - Extension 'binding-fs201' has been installed.                                                                                                                                                             
09:27:03.258 [ERROR] [org.apache.felix.configadmin         ] - [org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService, id=347, bundle=236/mvn:org.openhab.binding/org.openhab.binding.fs20/1.11.0]: Unexpected problem updating configuration org.openhab.fs20                                                                                                                                                                                                                                                                  
java.lang.NullPointerException: null                                                                                                                                                                                                                                     
        at org.openhab.io.transport.cul.CULLifecycleListenerListenerRegisterer.open(CULLifecycleListenerListenerRegisterer.java:21) [237:org.openhab.io.transport.cul:1.11.0]                                                                                            
        at org.openhab.io.transport.cul.CULLifecycleManager.open(CULLifecycleManager.java:92) [237:org.openhab.io.transport.cul:1.11.0]                                                                                                                                  
        at org.openhab.io.transport.cul.CULLifecycleManager.config(CULLifecycleManager.java:74) [237:org.openhab.io.transport.cul:1.11.0]                                                                                                                                
        at org.openhab.binding.fs20.internal.FS20Binding.updated(FS20Binding.java:94) [236:org.openhab.binding.fs20:1.11.0]                                                                                                                                              
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [7:org.apache.felix.configadmin:1.8.16]                                                                                                                         
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [7:org.apache.felix.configadmin:1.8.16]                                                                                                                   
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [7:org.apache.felix.configadmin:1.8.16]                                                                                                             
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1479) [7:org.apache.felix.configadmin:1.8.16]                                                                                                            
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1435) [7:org.apache.felix.configadmin:1.8.16]                                                                                                                
        at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [7:org.apache.felix.configadmin:1.8.16]                                                                                                                                                     
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [7:org.apache.felix.configadmin:1.8.16]                                                                                                                                                      
        at java.lang.Thread.run(Thread.java:748) [?:?] 

I don’t have any good advice except:

  • you have to pass the hardware devices into the container, with docker run that would be using the --device argument
  • getting devices into containers running on QNAP is notoriously difficult, search the forum for QNAP for lots of posts.

Hello Rich,

I was able to map the ttyACM0 into the container, however still getting the error message.

Inside the Container:

root@WeWeNAS-2:/dev# ls -l
total 0
crw--w---- 1 root tty  136, 0 Aug 14 11:32 console
lrwxrwxrwx 1 root root     11 Aug 14 11:29 core -> /proc/kcore
lrwxrwxrwx 1 root root     13 Aug 14 11:29 fd -> /proc/self/fd
crw-rw-rw- 1 root root   1, 7 Aug 14 11:29 full
drwxrwxrwt 2 root root     40 Aug 14 11:29 mqueue
crw-rw-rw- 1 root root   1, 3 Aug 14 11:29 null
lrwxrwxrwx 1 root root      8 Aug 14 11:29 ptmx -> pts/ptmx
drwxr-xr-x 2 root root      0 Aug 14 11:29 pts
crw-rw-rw- 1 root root   1, 8 Aug 14 11:29 random
drwxrwxrwt 2 root root     40 Aug 14 11:29 shm
lrwxrwxrwx 1 root root     15 Aug 14 11:29 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root     15 Aug 14 11:29 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root     15 Aug 14 11:29 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root   5, 0 Aug 14 11:29 tty
crw------- 1 root root 166, 0 Aug 14 11:29 ttyACM0
crw-rw-rw- 1 root root   1, 9 Aug 14 11:29 urandom
crw-rw-rw- 1 root root   1, 5 Aug 14 11:29 zero
root@WeWeNAS-2:/dev# exit

Outside the Container:

[/share/Container/openhab] # cd /dev
[/dev] # ls -l ttyA*
crw------- 1 admin administrators 166, 0 2019-08-14 13:28 ttyACM0
[/dev] # 

It’s a little worrying that the ownership is different on the host and inside the container but maybe that’s something weird about qnap.

But, as you can see, the device can only be read or written to by root. Is OH running as root?

I got it running :slight_smile:
I’m not running OH as root but openhab user.

I change the file permission when starting the Container.

  docker exec openhab_220 chmod a+rw /dev/ttyACM0

This solved the problem - I can control things with FS20 binding using the CUL.