Closed 1Joe1 closed 5 years ago
Yes, it looks like DBus permissions are not set up properly to allow OH user to access Bluez stuff.
Are you sure you've done point 8 from here https://github.com/sputnikdev/bluetooth-manager-tinyb#building-bluez-from-sources?
Sorry, it is probably nothing to do with OH user, but still the error log indicate that your Bluez daemon can't talk to DBus because permissions are not set up properly.
Thanks a lot for your fast reply.
yes, I am sure I performed step 8 and added
</policy>
<policy group="bluetooth">
<allow send_destination="org.bluez"/>
</policy>
So my buetooth.conf file looks like this
...
<policy user="root">
<allow own="org.bluez"/>
<allow send_destination="org.bluez"/>
<allow send_interface="org.bluez.Agent1"/>
<allow send_interface="org.bluez.MediaEndpoint1"/>
<allow send_interface="org.bluez.MediaPlayer1"/>
<allow send_interface="org.bluez.ThermometerWatcher1"/>
<allow send_interface="org.bluez.AlertAgent1"/>
<allow send_interface="org.bluez.Profile1"/>
<allow send_interface="org.bluez.HeartRateWatcher1"/>
<allow send_interface="org.bluez.CyclingSpeedWatcher1"/>
<allow send_interface="org.bluez.GattCharacteristic1"/>
<allow send_interface="org.bluez.GattDescriptor1"/>
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<allow send_interface="org.freedesktop.DBus.Properties"/>
</policy>
</policy>
<policy group="bluetooth">
<allow send_destination="org.bluez"/>
</policy>
<policy at_console="true">
<allow send_destination="org.bluez"/>
</policy>
...
I noticed step 9
sudo usermod -a -G bluetooth openhab
does not give me any reply. Is this normal?
As I am already trying to get this working for several days, I double, tripple... preformed the process. As mentioned I also tried the second method for setting up Bluez. When browsing the openhabian folder it seems that both buez-5.43 and bluez-5.47 are installed. When searching for "bluetooth.conf" I also get multiple findings. Could this be a problem?
Hi @1Joe1,
does not give me any reply. Is this normal?
Yes, that's fine.
Sorry to hear that you put a lot of effort in it, but BT was never easy in linux unfortunately.
Yes, it is definitely wrong that you have several Bluez installed. Could you try to remove it first and then instal it from sources? This would eliminate some possible errors.
Sorry, I am quite new to openHAB and linux.
I tried removing Bluez with
sudo apt-get autoremove bluez
however I still have both a \OPENHABIANPI\openhabian\bluez-5.47 and a \OPENHABIANPI\openhabian\bluez-5.43 folder full with a bunch of files. And bluetoothd -v
tells me I have 5.43 installed. How do I remove bluez properly?
No worries, try
sudo apt-get purge bluez
More or less the same result
[00:00:04] openhabian@openHABianPi:~$ sudo apt-get purge bluez [sudo] password for openhabian: Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: bluetooth : Depends: bluez but it is not going to be installed bluez-cups : Depends: cups but it is not going to be installed bluez-dbg : Depends: bluez (= 5.43-0ubuntu1~lorenzen1) but it is not going to be installed pi-bluetooth : Depends: bluez but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). [00:00:21] openhabian@openHABianPi:~$ bluetoothd -v 5.43
Did you try to run apt --fix-broken install
?
This is something wrong with your package manager... We definitely need to remove the older version before installing the newer.
Bad news. apt --fix-broken install
have me this error:
Setting up bluez-cups (5.43-0ubuntu1~lorenzen1) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for systemd (232-25+deb9u4) ...
Processing triggers for dbus (1.10.26-0+deb9u1) ...
Errors were encountered while processing:
bluez
bluez-dbg
bluetooth
Updating FireMotD available updates count ... 2018-09-11 07:12:30,543: FireMotD: Error: Template basic does not exist. Try \'basic\' or \'all\'.jq: error: Could not open file /usr/share/firemotd/data/FireMotD.json: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (1)
I get the feeling there is no way around setting my raspberry completely new. Learning for the next time: regular backups! Even if not everything is up and running yet :-). Or are there any other things I could try first?
Yeah, not sure. We could try to remove the old BLuez manually, then install new one, and them manually set proper soft links... I would try it first. But then, looks like your apt-get manager is badly broken, what if next time you will need to install something else?
Run this:
whereis bluetoothd
bluetoothd: /usr/sbin/bluetoothd /usr/share/man/man8/bluetoothd.8.gz /usr/share/man/man8/bluetoothd.8
to identify where your bluez is/are
Then see what is /usr/sbin/bluetoothd
:
ls /usr/sbin -la | grep bluetoothd
lrwxrwxrwx 1 root root 27 May 27 2016 bluetoothd -> ../lib/bluetooth/bluetoothd
Here you will need to delete that soft link (/usr/sbin/bluetoothd
), and create new one that points to the new Bluez. It is doable, just may not give you 100% of the result, as some other tools/utilities would still be used from the old Bluez unless you do it for all. Still worth trying I think.
Sorry for the delayed answer. I get until:
Here you will need to delete that soft link (/usr/sbin/bluetoothd), and create new one that points to the new Bluez.
So far I get the same responses as you do. I feel dumb to ask, but how do I remove the link? And by "here", do you mean " /lib/bluetooth/bluetoothd " ? Because when trying this I get
openhabian@openHABianPi:~$ /lib/bluetooth/bluetoothd
-bash: /lib/bluetooth/bluetoothd: No such file or directory
Hi, to join the discussion - as Ivan suggested, which tells you where your bluetoothd resides. In Ivan's case, this is /usr/sbin/bluetoothd; further ls -al shows that it points to ../lib/bluetooth/bluetoothd relative to /usr/sbin/bluetoothd - which is /usr/lib/bluetooth/bluetoothd and not /lib/bluetooth/bluetoothd.
So if your ls shows the same relative path, you've ommited /usr from the absolute path.
P.S. Symbolic link is just a special file, if you want to remove it (not the target), just run rm as for normal file (rm /usr/sbin/bluetoothd).
Btw, what is your distribution?
Thanks a lot for your support! I have no idea what got my bluez installation messed up I in the first place, but I couldn't get it right even with you tips. Probably due to my very limited Linux skills. Therefore I choose a clean reinstall (openhabian) and now the binding works just fine.
Hello,
I am having trouble in getting my usb bluetooth dongle (ORICO USB Bluetooth Adapter 4.0 (BTA-402)) working with openHAB. I am running openHAB 2.3 on my raspberry pi 2.
I followed the installation procedure described here: https://github.com/sputnikdev/eclipse-smarthome-bluetooth-binding As part of this I tried both building bluez from sources and the other method mentioned. (https://github.com/sputnikdev/bluetooth-manager-tinyb#prerequisites)
However there seems to be something going wrong, as "sudo systemctl restart bluetooth" leads to this error:
The adapter itself seems to be recognised:
the command "bluetoothctl" freezes my command line.
Any ideas on what I am missing? Anything I could try?