openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

Bluetooth BlueZ Binding fails as Native Libraries not deployed #5680

Closed communig8-public closed 3 years ago

communig8-public commented 5 years ago

Working with the current snapshot, after installing the Bluetooth BlueZ Binding and attempting to configure a new Bluetooth BlueZ Adapter, the Thing displays "Status: UNINITIALIZED - HANDLER_INITIALIZING_ERROR BlueZ JNI connection cannot be established.”. The log shows Caused by: java.lang.UnsatisfiedLinkError: tinyb.BluetoothManager.getNativeAPIVersion()Ljava/lang/String;" On checking the code, this error is thrown if there is a problem using the Native Libraries included in the Binding bundle.

Expected Behavior

That the Thing initialise correctly, without error.

Current Behavior

When the binding is installed, the included Native Libraries libtinyb.so and libjavatinyb.so are not deployed leading to the error when a Bluetooth BlueZ Adapter is added/configured.

Steps to Reproduce

  1. Install the Bluetooth BlueZ Binding.
  2. Add a Bluetooth BlueZ Adapter Thing configured with its MAC.

Context

The problem prevents a Bluetooth BlueZ Adapter being configured and so prevents any other Things being created that need to use a Bluetooth BlueZ Adapter as a Bridge.

Environment

schorfi commented 4 years ago

#5680 (comment)

openhab> system:property | grep proc                                                                                                                                                                                                                                                
org.osgi.framework.processor=x86-64
org.osgi.framework.system.packages=org.osgi.dto;version="1.0",org.osgi.resource;version="1.0",org.osgi.resource.dto;version="1.0";uses:="org.osgi.dto",org.osgi.framework;version="1.8",org.osgi.framework.dto;version="1.8";uses:="org.osgi.dto",org.osgi.framework.hooks.bundle;version="1.1";uses:="org.osgi.framework",org.osgi.framework.hooks.resolver;version="1.0";uses:="org.osgi.framework.wiring",org.osgi.framework.hooks.service;version="1.1";uses:="org.osgi.framework",org.osgi.framework.hooks.weaving;version="1.1";uses:="org.osgi.framework.wiring",org.osgi.framework.launch;version="1.2";uses:="org.osgi.framework",org.osgi.framework.namespace;version="1.1";uses:="org.osgi.resource",org.osgi.framework.startlevel;version="1.0";uses:="org.osgi.framework",org.osgi.framework.startlevel.dto;version="1.0";uses:="org.osgi.dto",org.osgi.framework.wiring;version="1.2";uses:="org.osgi.framework,org.osgi.resource",org.osgi.framework.wiring.dto;version="1.2";uses:="org.osgi.dto,org.osgi.resource.dto",org.osgi.service.condpermadmin;version="1.1.1";uses:="org.osgi.framework,org.osgi.service.permissionadmin",org.osgi.service.packageadmin;version="1.2";uses:="org.osgi.framework",org.osgi.service.permissionadmin;version="1.2",org.osgi.service.resolver;version="1.0";uses:="org.osgi.resource",org.osgi.service.startlevel;version="1.1";uses:="org.osgi.framework",org.osgi.service.url;version="1.0",org.osgi.util.tracker;version="1.5.1";uses:="org.osgi.framework",org.apache.karaf.version;version="4.2.7",org.apache.karaf.jaas.boot.principal;uses:=javax.security.auth;version="4.2.7",org.apache.karaf.jaas.boot;uses:="javax.security.auth,javax.security.auth.callback,javax.security.auth.login,javax.security.auth.spi,org.osgi.framework";version="4.2.7",org.apache.karaf.info;version="4.2.7",javax.accessibility, javax.activity, javax.annotation;version="1.0", javax.annotation.processing;version="1.0", javax.crypto, javax.crypto.interfaces, javax.crypto.spec, javax.imageio, javax.imageio.event, javax.imageio.metadata, javax.imageio.plugins.bmp, javax.imageio.plugins.jpeg, javax.imageio.spi, javax.imageio.stream, javax.jws, javax.jws.soap, javax.lang.model, javax.lang.model.element, javax.lang.model.type, javax.lang.model.util, javax.management, javax.management.loading, javax.management.modelmbean, javax.management.monitor, javax.management.openmbean, javax.management.relation, javax.management.remote, javax.management.remote.rmi, javax.management.timer, javax.naming, javax.naming.directory, javax.naming.event, javax.naming.ldap, javax.naming.spi, javax.net, javax.net.ssl, javax.print, javax.print.attribute, javax.print.attribute.standard, javax.print.event, javax.rmi, javax.rmi.CORBA, javax.rmi.ssl, javax.script, javax.security.auth, javax.security.auth.callback, javax.security.auth.kerberos, javax.security.auth.login, javax.security.auth.spi, javax.security.auth.x500, javax.security.cert, javax.security.sasl, javax.sound.midi, javax.sound.midi.spi, javax.sound.sampled, javax.sound.sampled.spi, javax.sql, javax.sql.rowset, javax.sql.rowset.serial, javax.sql.rowset.spi, javax.swing, javax.swing.border, javax.swing.colorchooser, javax.swing.event, javax.swing.filechooser, javax.swing.plaf, javax.swing.plaf.basic, javax.swing.plaf.metal, javax.swing.plaf.multi, javax.swing.plaf.synth, javax.swing.table, javax.swing.text, javax.swing.text.html, javax.swing.text.html.parser, javax.swing.text.rtf, javax.swing.tree, javax.swing.undo, javax.tools, javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, javax.xml, javax.xml.bind;version="2.2.8", javax.xml.bind.annotation;version="2.2.8", javax.xml.bind.annotation.adapters;version="2.2.8", javax.xml.bind.attachment;version="2.2.8", javax.xml.bind.helpers;version="2.2.8", javax.xml.bind.util;version="2.2.8", javax.xml.crypto, javax.xml.crypto.dom, javax.xml.crypto.dsig, javax.xml.crypto.dsig.dom, javax.xml.crypto.dsig.keyinfo, javax.xml.crypto.dsig.spec, javax.xml.datatype, javax.xml.namespace, javax.xml.parsers, javax.xml.stream;version="1.2", javax.xml.stream.events;version="1.2", javax.xml.stream.util;version="1.2", javax.xml.transform, javax.xml.transform.dom, javax.xml.transform.sax, javax.xml.transform.stax, javax.xml.transform.stream, javax.xml.validation, javax.xml.ws;version="2.2", javax.xml.ws.handler;version="2.2", javax.xml.ws.handler.soap;version="2.2", javax.xml.ws.http;version="2.2", javax.xml.ws.soap;version="2.2", javax.xml.ws.spi;version="2.2", javax.xml.ws.wsaddressing;version="2.2", javax.xml.ws.spi.http;version="2.2", javax.xml.xpath, javafx.animation, javafx.application, javafx.beans, javafx.beans.binding, javafx.beans.property, javafx.beans.property.adapter, javafx.beans.value, javafx.collections, javafx.collections.transform, javafx.concurrent, javafx.css, javafx.embed.swing, javafx.embed.swt, javafx.event, javafx.fxml, javafx.geometry, javafx.print, javafx.scene, javafx.scene.canvas, javafx.scene.chart, javafx.scene.control, javafx.scene.control.cell, javafx.scene.effect, javafx.scene.image, javafx.scene.input, javafx.scene.layout, javafx.scene.media, javafx.scene.paint, javafx.scene.shape, javafx.scene.text, javafx.scene.transform, javafx.scene.web, javafx.stage, javafx.util, javafx.util.converter, netscape.javascript, org.ietf.jgss, org.omg.CORBA, org.omg.CORBA_2_3, org.omg.CORBA_2_3.portable, org.omg.CORBA.DynAnyPackage, org.omg.CORBA.ORBPackage, org.omg.CORBA.portable, org.omg.CORBA.TypeCodePackage, org.omg.CosNaming, org.omg.CosNaming.NamingContextExtPackage, org.omg.CosNaming.NamingContextPackage, org.omg.Dynamic, org.omg.DynamicAny, org.omg.DynamicAny.DynAnyFactoryPackage, org.omg.DynamicAny.DynAnyPackage, org.omg.IOP, org.omg.IOP.CodecFactoryPackage, org.omg.IOP.CodecPackage, org.omg.Messaging, org.omg.PortableInterceptor, org.omg.PortableInterceptor.ORBInitInfoPackage, org.omg.PortableServer, org.omg.PortableServer.CurrentPackage, org.omg.PortableServer.POAManagerPackage, org.omg.PortableServer.POAPackage, org.omg.PortableServer.portable, org.omg.PortableServer.ServantLocatorPackage, org.omg.SendingContext, org.omg.stub.java.rmi, org.omg.stub.javax.management.remote.rmi, org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.css, org.w3c.dom.events, org.w3c.dom.html, org.w3c.dom.ls, org.w3c.dom.ranges, org.w3c.dom.stylesheets, org.w3c.dom.traversal, org.w3c.dom.views, org.w3c.dom.xpath, org.xml.sax, org.xml.sax.ext, org.xml.sax.helpers, com.sun.nio.sctp

the libraries are shipped within the bluez jar bundle of the binding add-on (you can browse the jar file to find them) I am curious whether the fixed were actually shipped to the snapshot I used (how can I find out?)

I am also offering help

J-N-K commented 4 years ago

Please also add the output of the apt command.

BobSilent commented 4 years ago

Just very quick,

#   Release = Raspbian GNU/Linux 10 (buster)
##    Kernel = Linux 4.19.75-v7l+
##  Platform = Raspberry Pi 4 Model B Rev 1.2
##    Memory = Free: 3.00GB (78%), Used: 0.85GB (22%), Total: 3.86GB
##      Swap = Free: 0.09GB (100%), Used: 0.00GB (0%), Total: 0.09GB
##      Root = Free: 25.29GB (90%), Used: 2.56GB (10%), Total: 29.07GB
##   Updates = 1 apt updates available.
##  Sessions = 1 session(s)
## Processes = 116 running processes of 32768 maximum processes

                  openHAB 2.5.0~M6-1 (Milestone Build)
[14:43:23] openhabian@openhab:~$ apt list | grep bluez

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

bluez-cups-dbgsym/testing 5.50-1+rpt1 armhf
bluez-cups/testing 5.50-1+rpt1 armhf
bluez-dbgsym/testing 5.50-1+rpt1 armhf
bluez-firmware/testing,now 1.2-4+rpt2 all [installed,automatic]
bluez-hcidump-dbgsym/testing 5.50-1+rpt1 armhf
bluez-hcidump/testing 5.50-1+rpt1 armhf
bluez-obexd-dbgsym/testing 5.50-1+rpt1 armhf
bluez-obexd/testing 5.50-1+rpt1 armhf
bluez-test-scripts/testing 5.50-1+rpt1 all
bluez-test-tools-dbgsym/testing 5.50-1+rpt1 armhf
bluez-test-tools/testing 5.50-1+rpt1 armhf
bluez-tools/stable 2.0~20170911.0.7cb788c-2 armhf
bluez/testing,now 5.50-1+rpt1 armhf [installed,automatic]
libkf5bluezqt-data/stable 5.54.0-1 all
libkf5bluezqt-dev/stable 5.54.0-1 armhf
libkf5bluezqt-doc/stable 5.54.0-1 all
libkf5bluezqt6/stable 5.54.0-1 armhf
python-bluez/stable 0.22+really0.22-1 armhf
python3-bluez/stable 0.22+really0.22-1 armhf
qml-module-org-kde-bluezqt/stable 5.54.0-1 armhf
system:property | grep proc~                                                                                                                                                                                                  openhab> system:property | grep proc
org.osgi.framework.processor=ARM
org.osgi.framework.system.packages=org.osgi.dto;version="1.0",org.osgi.resource;version="1.0",org.osgi.resource.dto;version="1.0";uses:="org.osgi.dto",org.osgi.framework;version="1.8",org.osgi.framework.dto;version="1.8";uses:="org.osgi.dto",org.osgi.framework.hooks.bundle;version="1.1";uses:="org.osgi.framework",org.osgi.framework.hooks.resolver;version="1.0";uses:="org.osgi.framework.wiring",org.osgi.framework.hooks.service;version="1.1";uses:="org.osgi.framework",org.osgi.framework.hooks.weaving;version="1.1";uses:="org.osgi.framework.wiring",org.osgi.framework.launch;version="1.2";uses:="org.osgi.framework",org.osgi.framework.namespace;version="1.1";uses:="org.osgi.resource",org.osgi.framework.startlevel;version="1.0";uses:="org.osgi.framework",org.osgi.framework.startlevel.dto;version="1.0";uses:="org.osgi.dto",org.osgi.framework.wiring;version="1.2";uses:="org.osgi.framework,org.osgi.resource",org.osgi.framework.wiring.dto;version="1.2";uses:="org.osgi.dto,org.osgi.resource.dto",org.osgi.service.condpermadmin;version="1.1.1";uses:="org.osgi.framework,org.osgi.service.permissionadmin",org.osgi.service.packageadmin;version="1.2";uses:="org.osgi.framework",org.osgi.service.permissionadmin;version="1.2",org.osgi.service.resolver;version="1.0";uses:="org.osgi.resource",org.osgi.service.startlevel;version="1.1";uses:="org.osgi.framework",org.osgi.service.url;version="1.0",org.osgi.util.tracker;version="1.5.1";uses:="org.osgi.framework",org.apache.karaf.version;version="4.2.7",org.apache.karaf.jaas.boot.principal;uses:=javax.security.auth;version="4.2.7",org.apache.karaf.jaas.boot;uses:="javax.security.auth,javax.security.auth.callback,javax.security.auth.login,javax.security.auth.spi,org.osgi.framework";version="4.2.7",org.apache.karaf.info;version="4.2.7",javax.accessibility, javax.activity, javax.annotation;version="1.0", javax.annotation.processing;version="1.0", javax.crypto, javax.crypto.interfaces, javax.crypto.spec, javax.imageio, javax.imageio.event, javax.imageio.metadata, javax.imageio.plugins.bmp, javax.imageio.plugins.jpeg, javax.imageio.spi, javax.imageio.stream, javax.jws, javax.jws.soap, javax.lang.model, javax.lang.model.element, javax.lang.model.type, javax.lang.model.util, javax.management, javax.management.loading, javax.management.modelmbean, javax.management.monitor, javax.management.openmbean, javax.management.relation, javax.management.remote, javax.management.remote.rmi, javax.management.timer, javax.naming, javax.naming.directory, javax.naming.event, javax.naming.ldap, javax.naming.spi, javax.net, javax.net.ssl, javax.print, javax.print.attribute, javax.print.attribute.standard, javax.print.event, javax.rmi, javax.rmi.CORBA, javax.rmi.ssl, javax.script, javax.security.auth, javax.security.auth.callback, javax.security.auth.kerberos, javax.security.auth.login, javax.security.auth.spi, javax.security.auth.x500, javax.security.cert, javax.security.sasl, javax.sound.midi, javax.sound.midi.spi, javax.sound.sampled, javax.sound.sampled.spi, javax.sql, javax.sql.rowset, javax.sql.rowset.serial, javax.sql.rowset.spi, javax.swing, javax.swing.border, javax.swing.colorchooser, javax.swing.event, javax.swing.filechooser, javax.swing.plaf, javax.swing.plaf.basic, javax.swing.plaf.metal, javax.swing.plaf.multi, javax.swing.plaf.synth, javax.swing.table, javax.swing.text, javax.swing.text.html, javax.swing.text.html.parser, javax.swing.text.rtf, javax.swing.tree, javax.swing.undo, javax.tools, javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, javax.xml, javax.xml.bind;version="2.2.8", javax.xml.bind.annotation;version="2.2.8", javax.xml.bind.annotation.adapters;version="2.2.8", javax.xml.bind.attachment;version="2.2.8", javax.xml.bind.helpers;version="2.2.8", javax.xml.bind.util;version="2.2.8", javax.xml.crypto, javax.xml.crypto.dom, javax.xml.crypto.dsig, javax.xml.crypto.dsig.dom, javax.xml.crypto.dsig.keyinfo, javax.xml.crypto.dsig.spec, javax.xml.datatype, javax.xml.namespace, javax.xml.parsers, javax.xml.stream;version="1.2", javax.xml.stream.events;version="1.2", javax.xml.stream.util;version="1.2", javax.xml.transform, javax.xml.transform.dom, javax.xml.transform.sax, javax.xml.transform.stax, javax.xml.transform.stream, javax.xml.validation, javax.xml.ws;version="2.2", javax.xml.ws.handler;version="2.2", javax.xml.ws.handler.soap;version="2.2", javax.xml.ws.http;version="2.2", javax.xml.ws.soap;version="2.2", javax.xml.ws.spi;version="2.2", javax.xml.ws.wsaddressing;version="2.2", javax.xml.ws.spi.http;version="2.2", javax.xml.xpath, javafx.animation, javafx.application, javafx.beans, javafx.beans.binding, javafx.beans.property, javafx.beans.property.adapter, javafx.beans.value, javafx.collections, javafx.collections.transform, javafx.concurrent, javafx.css, javafx.embed.swing, javafx.embed.swt, javafx.event, javafx.fxml, javafx.geometry, javafx.print, javafx.scene, javafx.scene.canvas, javafx.scene.chart, javafx.scene.control, javafx.scene.control.cell, javafx.scene.effect, javafx.scene.image, javafx.scene.input, javafx.scene.layout, javafx.scene.media, javafx.scene.paint, javafx.scene.shape, javafx.scene.text, javafx.scene.transform, javafx.scene.web, javafx.stage, javafx.util, javafx.util.converter, netscape.javascript, org.ietf.jgss, org.omg.CORBA, org.omg.CORBA_2_3, org.omg.CORBA_2_3.portable, org.omg.CORBA.DynAnyPackage, org.omg.CORBA.ORBPackage, org.omg.CORBA.portable, org.omg.CORBA.TypeCodePackage, org.omg.CosNaming, org.omg.CosNaming.NamingContextExtPackage, org.omg.CosNaming.NamingContextPackage, org.omg.Dynamic, org.omg.DynamicAny, org.omg.DynamicAny.DynAnyFactoryPackage, org.omg.DynamicAny.DynAnyPackage, org.omg.IOP, org.omg.IOP.CodecFactoryPackage, org.omg.IOP.CodecPackage, org.omg.Messaging, org.omg.PortableInterceptor, org.omg.PortableInterceptor.ORBInitInfoPackage, org.omg.PortableServer, org.omg.PortableServer.CurrentPackage, org.omg.PortableServer.POAManagerPackage, org.omg.PortableServer.POAPackage, org.omg.PortableServer.portable, org.omg.PortableServer.ServantLocatorPackage, org.omg.SendingContext, org.omg.stub.java.rmi, org.omg.stub.javax.management.remote.rmi, org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.css, org.w3c.dom.events, org.w3c.dom.html, org.w3c.dom.ls, org.w3c.dom.ranges, org.w3c.dom.stylesheets, org.w3c.dom.traversal, org.w3c.dom.views, org.w3c.dom.xpath, org.xml.sax, org.xml.sax.ext, org.xml.sax.helpers, com.sun.nio.sctp
o

do you need apt list?

schorfi commented 4 years ago

Please also add the output of the apt command.

I cant

cat /proc/version 
Linux version 5.4.0-rc6 (root@edelia) (gcc version 9.2.0 (Gentoo 9.2.0-r2 p3)) #1 SMP Mon Nov 11 17:17:57 CET 2019
[bluetooth]# version
Version 5.43

@bob, where do I get this openHAB version print @bob, I guess you got a wrong bluez version? it says we need 5.43

schorfi commented 4 years ago

I tried ubuntu in a VM and have same issues, however, did not get 5.43 installed though, not sure how to downgrade in ubuntu yet; question is it worth it to do that for futher debugging?

openhab> bundle:list | grep -i blue                                                                                                                                                                                      
212 │ Active │  80 │ 2.5.0.201912080345      │ openHAB Add-ons :: Bundles :: Bluetooth Binding
213 │ Active │  80 │ 2.5.0.201912080345      │ openHAB Add-ons :: Bundles :: BlueGiga Bluetooth Adapter
214 │ Active │  80 │ 2.5.0.201912080346      │ openHAB Add-ons :: Bundles :: BlueZ Bluetooth Adapter
215 │ Active │  80 │ 2.5.0.201912080346      │ openHAB Add-ons :: Bundles :: Blukii Bluetooth Adapter
216 │ Active │  80 │ 2.5.0.201912080346      │ openHAB Add-ons :: Bundles :: RuuviTag Bluetooth Adapter
apt list | grep bluez

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

bluez/bionic-updates,now 5.48-0ubuntu3.2 amd64 [installed]
bluez-btsco/bionic 1:0.50-0ubuntu6 amd64
bluez-cups/bionic-updates,now 5.48-0ubuntu3.2 amd64 [installed]
bluez-dbg/bionic-updates 5.48-0ubuntu3.2 amd64
bluez-hcidump/bionic-updates 5.48-0ubuntu3.2 amd64
bluez-obexd/bionic-updates,now 5.48-0ubuntu3.2 amd64 [installed]
bluez-tests/bionic-updates 5.48-0ubuntu3.2 amd64
bluez-tools/bionic 0.2.0~20140808-5build1 amd64
libkf5bluezqt-data/bionic,bionic 5.44.0-0ubuntu1 all
libkf5bluezqt-dev/bionic 5.44.0-0ubuntu1 amd64
libkf5bluezqt6/bionic 5.44.0-0ubuntu1 amd64
python-bluez/bionic 0.22-1 amd64
qml-module-org-kde-bluezqt/bionic 5.44.0-0ubuntu1 amd64
openhab> system:property | grep proc                                                                                                                                                                                     
org.osgi.framework.processor=x86-64
org.osgi.framework.system.packages=org.osgi.dto;version="1.0",org.osgi.resource;version="1.0",org.osgi.resource.dto;version="1.0";uses:="org.osgi.dto",org.osgi.framework;version="1.8",org.osgi.framework.dto;version="1.8";uses:="org.osgi.dto",org.osgi.framework.hooks.bundle;version="1.1";uses:="org.osgi.framework",org.osgi.framework.hooks.resolver;version="1.0";uses:="org.osgi.framework.wiring",org.osgi.framework.hooks.service;version="1.1";uses:="org.osgi.framework",org.osgi.framework.hooks.weaving;version="1.1";uses:="org.osgi.framework.wiring",org.osgi.framework.launch;version="1.2";uses:="org.osgi.framework",org.osgi.framework.namespace;version="1.1";uses:="org.osgi.resource",org.osgi.framework.startlevel;version="1.0";uses:="org.osgi.framework",org.osgi.framework.startlevel.dto;version="1.0";uses:="org.osgi.dto",org.osgi.framework.wiring;version="1.2";uses:="org.osgi.framework,org.osgi.resource",org.osgi.framework.wiring.dto;version="1.2";uses:="org.osgi.dto,org.osgi.resource.dto",org.osgi.service.condpermadmin;version="1.1.1";uses:="org.osgi.framework,org.osgi.service.permissionadmin",org.osgi.service.packageadmin;version="1.2";uses:="org.osgi.framework",org.osgi.service.permissionadmin;version="1.2",org.osgi.service.resolver;version="1.0";uses:="org.osgi.resource",org.osgi.service.startlevel;version="1.1";uses:="org.osgi.framework",org.osgi.service.url;version="1.0",org.osgi.util.tracker;version="1.5.1";uses:="org.osgi.framework",org.apache.karaf.version;version="4.2.7",org.apache.karaf.jaas.boot.principal;uses:=javax.security.auth;version="4.2.7",org.apache.karaf.jaas.boot;uses:="javax.security.auth,javax.security.auth.callback,javax.security.auth.login,javax.security.auth.spi,org.osgi.framework";version="4.2.7",org.apache.karaf.info;version="4.2.7",javax.accessibility, javax.activity, javax.annotation;version="1.0", javax.annotation.processing;version="1.0", javax.crypto, javax.crypto.interfaces, javax.crypto.spec, javax.imageio, javax.imageio.event, javax.imageio.metadata, javax.imageio.plugins.bmp, javax.imageio.plugins.jpeg, javax.imageio.spi, javax.imageio.stream, javax.jws, javax.jws.soap, javax.lang.model, javax.lang.model.element, javax.lang.model.type, javax.lang.model.util, javax.management, javax.management.loading, javax.management.modelmbean, javax.management.monitor, javax.management.openmbean, javax.management.relation, javax.management.remote, javax.management.remote.rmi, javax.management.timer, javax.naming, javax.naming.directory, javax.naming.event, javax.naming.ldap, javax.naming.spi, javax.net, javax.net.ssl, javax.print, javax.print.attribute, javax.print.attribute.standard, javax.print.event, javax.rmi, javax.rmi.CORBA, javax.rmi.ssl, javax.script, javax.security.auth, javax.security.auth.callback, javax.security.auth.kerberos, javax.security.auth.login, javax.security.auth.spi, javax.security.auth.x500, javax.security.cert, javax.security.sasl, javax.sound.midi, javax.sound.midi.spi, javax.sound.sampled, javax.sound.sampled.spi, javax.sql, javax.sql.rowset, javax.sql.rowset.serial, javax.sql.rowset.spi, javax.swing, javax.swing.border, javax.swing.colorchooser, javax.swing.event, javax.swing.filechooser, javax.swing.plaf, javax.swing.plaf.basic, javax.swing.plaf.metal, javax.swing.plaf.multi, javax.swing.plaf.synth, javax.swing.table, javax.swing.text, javax.swing.text.html, javax.swing.text.html.parser, javax.swing.text.rtf, javax.swing.tree, javax.swing.undo, javax.tools, javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, javax.xml, javax.xml.bind;version="2.2.8", javax.xml.bind.annotation;version="2.2.8", javax.xml.bind.annotation.adapters;version="2.2.8", javax.xml.bind.attachment;version="2.2.8", javax.xml.bind.helpers;version="2.2.8", javax.xml.bind.util;version="2.2.8", javax.xml.crypto, javax.xml.crypto.dom, javax.xml.crypto.dsig, javax.xml.crypto.dsig.dom, javax.xml.crypto.dsig.keyinfo, javax.xml.crypto.dsig.spec, javax.xml.datatype, javax.xml.namespace, javax.xml.parsers, javax.xml.stream;version="1.2", javax.xml.stream.events;version="1.2", javax.xml.stream.util;version="1.2", javax.xml.transform, javax.xml.transform.dom, javax.xml.transform.sax, javax.xml.transform.stax, javax.xml.transform.stream, javax.xml.validation, javax.xml.ws;version="2.2", javax.xml.ws.handler;version="2.2", javax.xml.ws.handler.soap;version="2.2", javax.xml.ws.http;version="2.2", javax.xml.ws.soap;version="2.2", javax.xml.ws.spi;version="2.2", javax.xml.ws.wsaddressing;version="2.2", javax.xml.ws.spi.http;version="2.2", javax.xml.xpath, javafx.animation, javafx.application, javafx.beans, javafx.beans.binding, javafx.beans.property, javafx.beans.property.adapter, javafx.beans.value, javafx.collections, javafx.collections.transform, javafx.concurrent, javafx.css, javafx.embed.swing, javafx.embed.swt, javafx.event, javafx.fxml, javafx.geometry, javafx.print, javafx.scene, javafx.scene.canvas, javafx.scene.chart, javafx.scene.control, javafx.scene.control.cell, javafx.scene.effect, javafx.scene.image, javafx.scene.input, javafx.scene.layout, javafx.scene.media, javafx.scene.paint, javafx.scene.shape, javafx.scene.text, javafx.scene.transform, javafx.scene.web, javafx.stage, javafx.util, javafx.util.converter, netscape.javascript, org.ietf.jgss, org.omg.CORBA, org.omg.CORBA_2_3, org.omg.CORBA_2_3.portable, org.omg.CORBA.DynAnyPackage, org.omg.CORBA.ORBPackage, org.omg.CORBA.portable, org.omg.CORBA.TypeCodePackage, org.omg.CosNaming, org.omg.CosNaming.NamingContextExtPackage, org.omg.CosNaming.NamingContextPackage, org.omg.Dynamic, org.omg.DynamicAny, org.omg.DynamicAny.DynAnyFactoryPackage, org.omg.DynamicAny.DynAnyPackage, org.omg.IOP, org.omg.IOP.CodecFactoryPackage, org.omg.IOP.CodecPackage, org.omg.Messaging, org.omg.PortableInterceptor, org.omg.PortableInterceptor.ORBInitInfoPackage, org.omg.PortableServer, org.omg.PortableServer.CurrentPackage, org.omg.PortableServer.POAManagerPackage, org.omg.PortableServer.POAPackage, org.omg.PortableServer.portable, org.omg.PortableServer.ServantLocatorPackage, org.omg.SendingContext, org.omg.stub.java.rmi, org.omg.stub.javax.management.remote.rmi, org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.css, org.w3c.dom.events, org.w3c.dom.html, org.w3c.dom.ls, org.w3c.dom.ranges, org.w3c.dom.stylesheets, org.w3c.dom.traversal, org.w3c.dom.views, org.w3c.dom.xpath, org.xml.sax, org.xml.sax.ext, org.xml.sax.helpers, com.sun.nio.sctp
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic
$ cat /proc/version
Linux version 4.15.0-36-generic (buildd@lgw01-amd64-031) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018
J-N-K commented 4 years ago

https://www.openhab.org/addons/bindings/bluetooth.bluez/#bluetooth-bluez-adapter

schorfi commented 4 years ago

https://www.openhab.org/addons/bindings/bluetooth.bluez/#bluetooth-bluez-adapter

not sure what you are trying to point me/us... i knew this page and already tried this *.thing, but then i receive an error in the log at startup checked for bluetooth user, and version, all my assumtions are ok (arm vs x86_64?)

however, managed to downgrade, still doesnt work

$ dpkg -l | grep blue
ii  bluetooth                             5.43-0ubuntu1~leoni1                            all          Bluetooth support
ii  bluez                                 5.43-0ubuntu1~leoni1                            amd64        Bluetooth tools and daemons
ii  bluez-cups                            5.43-0ubuntu1~leoni1                            amd64        Bluetooth printer driver for CUPS
ii  bluez-dbg                             5.43-0ubuntu1~leoni1                            amd64        Bluetooth tools and daemons (with debugging symbols)
ii  bluez-hcidump                         5.43-0ubuntu1~leoni1                            amd64        Analyses Bluetooth HCI packets
ii  bluez-obexd                           5.43-0ubuntu1~leoni1                            amd64        bluez obex daemon
ii  bluez-tests                           5.43-0ubuntu1~leoni1                            amd64        BlueZ test tools and scripts
ii  gir1.2-gnomebluetooth-1.0:amd64       3.28.0-2ubuntu0.2                               amd64        Introspection data for GnomeBluetooth
ii  libbluetooth-dev                      5.43-0ubuntu1~leoni1                            amd64        Development files for using the BlueZ Linux Bluetooth library
ii  libbluetooth3:amd64                   5.43-0ubuntu1~leoni1                            amd64        Library to use the BlueZ Linux Bluetooth stack
ii  libbluetooth3-dbg                     5.43-0ubuntu1~leoni1                            amd64        Library to use the BlueZ Linux Bluetooth stack with debugging symbols
ii  libgnome-bluetooth13:amd64            3.28.0-2ubuntu0.2                               amd64        GNOME Bluetooth tools - support library

next step is obviously try an raspberry VM?!

BobSilent commented 4 years ago

@schorfi The openhab version print is from SSH connection

regarding the bluez version, you are completely right, i am new to openhab and therefore i used the openhabian image to prepare my PI, so i thought if the version is essential it should be considered when installing the image, and I do not need to take care for it. Anyhow, i finally made it to download the bluez sources and compile them on my PI

[22:59:00] openhabian@openhab:~$ sudo service bluetooth status
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-12-08 22:55:41 CET; 5min ago
     Docs: man:bluetoothd(8)
 Main PID: 14293 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 4915)
   Memory: 456.0K
   CGroup: /system.slice/bluetooth.service
           └─14293 /usr/libexec/bluetooth/bluetoothd

Dec 08 22:55:41 openhab systemd[1]: Starting Bluetooth service...
Dec 08 22:55:41 openhab bluetoothd[14293]: Bluetooth daemon 5.43
Dec 08 22:55:41 openhab bluetoothd[14293]: Unknown group GATT in main.conf
Dec 08 22:55:41 openhab systemd[1]: Started Bluetooth service.
Dec 08 22:55:41 openhab bluetoothd[14293]: Starting SDP server
Dec 08 22:55:41 openhab bluetoothd[14293]: Bluetooth management interface 1.14 initialized
[23:01:29] openhabian@openhab:~$ /usr/libexec/bluetooth/bluetoothd --version
5.43

but as you also already said, it brings the same errror

==> /var/log/openhab2/openhab.log <==
2019-12-08 22:57:21.258 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler@10de948': BlueZ JNI connection cannot be established.
java.lang.IllegalStateException: BlueZ JNI connection cannot be established.
    at org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:98) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
    at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
    at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: java.lang.UnsatisfiedLinkError: tinyb.BluetoothManager.getNativeAPIVersion()Ljava/lang/String;
    at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[?:?]
    at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) ~[?:?]
    at org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:93) ~[?:?]
    ... 10 more

maybe i am to stupid, but after i reached the UNINITIALIZED (HANDLER_INITIALIZING_ERROR) state i always need to remove and add the thing, a simple configure and save does not retrigger the initialization.

splatch commented 4 years ago

I have experienced this issue earlier and managed to fix it locally with a small tweak to tinyb headers. The UnsatisfiedLinkError lead me to wrong assumption that the issue is related to library loading while it was related to loading logic implemented in tinyb itself.

The logic which controls loading of libtinyb / libjavatinyb is located here: https://github.com/intel-iot-devkit/tinyb/blob/ac6d3082d06183c860eea97f451d5a92022348e0/java/BluetoothManager.java#L304

uleimberger commented 4 years ago

Error still exists -- I am not able to bind a Adapter. `2019-12-27 12:15:49.558 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'bluetooth:bluez:hci0': BlueZ JNI connection cannot be established.

java.lang.IllegalStateException: BlueZ JNI connection cannot be established.

at org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:98) ~[?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]

at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]

at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

Caused by: java.lang.UnsatisfiedLinkError: tinyb.BluetoothManager.getNativeAPIVersion()Ljava/lang/String;

at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[?:?]

at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) ~[?:?]

at org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:93) ~[?:?]

... 10 more`

Maybe we get a solution soon.

JoG4711 commented 4 years ago

Hi Udo, I'm not sure if this will help you, but it is worth trying. Have a look at this post: bluetooth/ruuvitags with pi4 and openhab 2.5 Maybe the steps lead you to a working bluetooth binding with openhab 2.5. Thanks, Jo

uleimberger commented 4 years ago

Hello Jo nope does not work - i am not able to load libtinyb.so and/or libjavatinyb.so. I shared the modules directly in Zulu. When you start openhab2.service you get this error. Jan 07 13:44:47 anubispi karaf[32042]: Native code library failed to load. Jan 07 13:44:47 anubispi karaf[32042]: java.lang.UnsatisfiedLinkError: /var/lib/openhab2/cache/org.eclipse.osgi/223/0/.cp/lib/armv6hf/libjavatinyb.so: libtinyb.so.0.5.0-28-gac6d308: cannot open shared object file: No such file or directory

the tinyb - modules are in the folder: /var/lib/openhab2/cache/org.eclipse.osgi/223/0/.cp/lib/armv6hf/ but they need a file libtinyb.so.0.5.0-28-gac6d308 I have no clue where this files comes from -- internal caching from openhab ?

picmac commented 4 years ago

Hi,

for me worked the following on RPi4, openHABian 1.5, openHAB 2.5 Relase

Regards, Marcus

uleimberger commented 4 years ago

@picmac -- great - this worked now for me so far. Bluetooth controller is now available and works. Nice. But there is an error wen I status the bluetooth.service - as far as i can see it - it has to do with some Playstation Controller bindings. I do not use any PS-Controller but i do not like errors at all ;-) Maybe someone knows what to do ? Of course i can delete the six - modules.

` bluetooth.service - Bluetooth service Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2020-01-10 06:08:10 EST; 2min 29s ago Docs: man:bluetoothd(8) Main PID: 572 (bluetoothd) Status: "Running" Tasks: 1 (limit: 4915) Memory: 2.5M CGroup: /system.slice/bluetooth.service └─572 /usr/lib/bluetooth/bluetoothd --noplugin=sap

Jan 10 06:08:10 xxxxxxxx.systemd[1]: Starting Bluetooth service... Jan 10 06:08:10 xxxxxxxxbluetoothd[572]: Bluetooth daemon 5.43 Jan 10 06:08:10 xxxxxxxxsystemd[1]: Started Bluetooth service. Jan 10 06:08:10 xxxxxxxxbluetoothd[572]: Starting SDP server Jan 10 06:08:10 xxxxxxxxbluetoothd[572]: Excluding (cli) sap Jan 10 06:08:10 xxxxxxxxbluetoothd[572]: Can't load plugin /usr/lib/arm-linux-gnueabihf/bluetooth/plugins/sixaxis.so: /usr/lib/arm-linux-gnueabihf/bluetooth/plugins/sixaxis.so: undefined symbol: btd_request_authorization_cable_configured Jan 10 06:08:10 xxxxxxxxbluetoothd[572]: Bluetooth management interface 1.14 initialized Jan 10 06:08:10 xxxxxxxxbluetoothd[572]: Failed to obtain handles for "Service Changed" characteristic Jan 10 06:08:10 xxxxxxxxbluetoothd[572]: Failed to set privacy: Rejected (0x0b)`

ilvits commented 4 years ago

@picmac Great! This worked for me too!

Same errors, @uleimberger. ))

â bluetooth.service - Bluetooth service Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-01-22 10:56:54 MSK; 12min ago Docs: man:bluetoothd(8) Main PID: 463 (bluetoothd) Status: "Running" Tasks: 1 (limit: 2319) Memory: 2.6M CGroup: /system.slice/bluetooth.service ââ463 /usr/lib/bluetooth/bluetoothd

Jan 22 10:56:54 openhab bluetoothd[463]: Bluetooth daemon 5.43 Jan 22 10:56:54 openhab systemd[1]: Started Bluetooth service. Jan 22 10:56:54 openhab bluetoothd[463]: Starting SDP server Jan 22 10:56:54 openhab bluetoothd[463]: Can't load plugin /usr/lib/arm-linux-gnueabihf/bluetooth/plugins/sixaxis.so: /usr/lib/arm Jan 22 10:56:54 openhab bluetoothd[463]: Bluetooth management interface 1.14 initialized Jan 22 10:56:54 openhab bluetoothd[463]: Failed to obtain handles for "Service Changed" characteristic Jan 22 10:56:54 openhab bluetoothd[463]: Sap driver initialization failed. Jan 22 10:56:54 openhab bluetoothd[463]: sap-server: Operation not permitted (1) Jan 22 10:56:54 openhab bluetoothd[463]: Failed to set privacy: Rejected (0x0b) Jan 22 11:07:22 openhab bluetoothd[463]: Can't store name for private addressed device /org/bluez/hci0/dev_63_6E_0A_8F_BD_44

schorfi commented 4 years ago

hey, nice that it works for you

I am still stuck how to tackle this issue; I copied libjavatinyb.so and libtinyb.so to my java vm lib folder

/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/amd64

that makes not complain about non detected libraries as before, rather it now complains about the "loading logic" @splatch referred to.... 2020-02-01 21:51:42.557 [WARN ] [rnal.discovery.BlueZDiscoveryService] - Failed to scan for Bluetooth devices java.lang.RuntimeException: Native library is out of date. Please update the native library. at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:317) ~[bundleFile:?] at org.openhab.binding.bluetooth.bluez.internal.discovery.BlueZDiscoveryService.startScan(BlueZDiscoveryService.java:57) [bundleFile:?] at org.openhab.binding.bluetooth.bluez.internal.discovery.BlueZDiscoveryService.startBackgroundDiscovery(BlueZDiscoveryService.java:51) [bundleFile:?]

webmiceleo commented 4 years ago

@picmac -- this worked now for me.

elik745i commented 3 years ago

updatet links, worked for me:

wget https://github.com/openhab/openhab-addons/raw/2.5.x/bundles/org.openhab.binding.bluetooth.bluez/src/main/resources/lib/armv6hf/libtinyb.so wget https://github.com/openhab/openhab-addons/raw/2.5.x/bundles/org.openhab.binding.bluetooth.bluez/src/main/resources/lib/armv6hf/libjavatinyb.so sudo cp lib* /opt/jdk/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf/jre/lib/aarch32/ sudo apt purge bluez wget http://archive.raspberrypi.org/debian/pool/main/b/bluez/bluez_5.50-1.2~deb10u1+rpt2_armhf.deb sudo dpkg -i bluez_5.50-1.2~deb10u1+rpt2_armhf.deb sudo apt-get install pi-bluetooth sudo usermod -a -G bluetooth openhab sudo reboot

smhswiss commented 3 years ago

The approach on resolving the Native libs issue might work for RPI based setup's. But for amd based such my one it does not Linux 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux

I have tried with the downgraded version 5.47 of bluez and as well with 5.50 it is the same story and the same error beyond. pointing to the tinyB libs.

newest test with OH 3 snapshot on my regular MacBook

3.0.0-SNAPSHOT - Build #1976

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

openhab> log:tail                                                                                                                              
17:53:38.480 [INFO ] [b.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Europe/Zurich'.
17:53:38.494 [INFO ] [b.core.internal.i18n.I18nProviderImpl] - Locale set to 'en_CH'.
17:53:45.299 [INFO ] [b.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
17:53:47.185 [INFO ] [org.openhab.ui.internal.UIService    ] - Started UI on port 8080
17:53:48.051 [INFO ] [hab.ui.habpanel.internal.HABPanelTile] - Started HABPanel at /habpanel
Native code library failed to load.
java.lang.UnsatisfiedLinkError: no tinyb in java.library.path: [/Users/********/Projects/openhab3/userdata/tmp/lib]

Lib folder contains the tinyb files of https://github.com/openhab/openhab-addons/tree/2.5.x/bundles/org.openhab.binding.bluetooth.bluez/src/main/resources/lib/x86-64


amanda:lib $ pwd
/Users/********/Projects/openhab3/userdata/tmp/lib
amanda:lib ********$ ls -l
total 336
-rw-r--r--  1 ********  staff  85105 Oct 20 17:44 libjavatinyb.so
-rw-r--r--  1 ********  staff  85115 Oct 20 17:45 libtinyb.so

In difference to my main system is, that I don't have bluez at all here.

cpmeister commented 3 years ago

The Bluetooth BlueZ Binding has been updated so that it uses D-Bus directly instead of using tinyB. So this issue is now obsolete as of OH3 M2.