CANDY-LINE / node-red-contrib-generic-ble

A Node-RED node set for providing access to generic BLE peripheral GATT characteristics.
Apache License 2.0
24 stars 22 forks source link

[error] BlueZ Permission Error #42

Open Fungusware opened 3 years ago

Fungusware commented 3 years ago

Hi, hope you can help.

I have followed the details in the https://flows.nodered.org/node/node-red-contrib-generic-ble installaton notes but I just cannot seem to get this working.

Scanning immediately gives me the Error.

cat /etc/group | grep bluetooth

returns

bluetooth:x:112:pi

NODE-Red is started with

node-red-start

dbaba commented 3 years ago

Did you run sudo reboot after usermod? Reboot is required after changing the group. If yes, check if your board has BLE. Only RPi3A+, RPi3B+ and RPi4 have BLE. See the raspberrypi.org products list for detail.

Fungusware commented 3 years ago

Indeed, I have done all these things.

I can use gatttool to read and write to my device from the command line and all other bluetooth tools work as expected.. But Node-Red is always giving the permissions error.

Thanks for getting back to me, if I can get this resolved, I will be overwhelmingly happy!. It's the last piece in our puzzle.

Regards

On Tue, Nov 17, 2020 at 4:58 PM Daisuke Baba notifications@github.com wrote:

Did you run sudo reboot after usermod? Reboot is required after changing the group. If yes, check if your board has BLE. Only RPi3A+, RPi3B+ and RPi4 have BLE. See the raspberrypi.org products list https://www.raspberrypi.org/products/ for detail.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CANDY-LINE/node-red-contrib-generic-ble/issues/42#issuecomment-728786360, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYHB5CX3BH23QYUE5BL2MLSQI3LVANCNFSM4TYFUV2Q .

--

John Anderson Fungusware http://fungusware.com http://www.xenserver-backup.com

dbaba commented 3 years ago

mmm... Can you please post the actual error message? And /var/log/syslog as well, which probably contains the more precise error message. The permission error is caused by wrong bluetoothd configuration. I'd say you're running NR by other user than pi but I'm not sure if it is. In order to identify the error cause, give me the above info.

Fungusware commented 3 years ago

Hi,

Sure can.

Error Message in the console - http://192.168.5.114:188018 http://192.168.5.114:188018 Nov 00:43:16 - [error] BlueZ Permission Error. See 'Installation Note' in README at https://flows.nodered.org/node/node-red-contrib-generic-ble https://flows.nodered.org/node/node-red-contrib-generic-ble for addressing the issue.

I have attached a few of the logs

On Wed, Nov 18, 2020 at 8:39 AM Daisuke Baba notifications@github.com wrote:

mmm... Can you please post the actual error message? And /var/log/syslog as well, which probably contains the more precise error message. The permission error is caused by wrong bluetoothd configuration. I'd say you're running NR by other user than pi but I'm not sure if it is. In order to identify the error cause, give me the above info.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CANDY-LINE/node-red-contrib-generic-ble/issues/42#issuecomment-729300827, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYHB5EDJEC3KYREY4ZKOZDSQMJSTANCNFSM4TYFUV2Q .

--

John Anderson Fungusware http://fungusware.com http://www.xenserver-backup.com

dbaba commented 3 years ago

Thanks. Need more precise info.

Can you please change the log settings as shown below? The following setting outputs only this node logs. NR logs are disabled.

$ sudo nano /lib/systemd/system/nodered.service
# Insert the following line under `Nice=5` then save the file and exit
Environment="DEBUG=node-red-contrib-generic-ble:*"

$ sudo systemctl daemon-reload
$ node-red-start
# This will not output anything but NR will be running normally

Then try to cause the above error. The console shows precise log info, so you can post it in this thread.

In order to revert the change, just remove the appended line from /lib/systemd/system/nodered.service file.

Fungusware commented 3 years ago

Hi,

Sorry, this doesn't seem to report any further information to the Console. The file is edited as shown below.

[image: image.png]

[image: image.png]

I could setup a remote session if you are willing, as your help is very much appreciated.

Regards

On Wed, Nov 18, 2020 at 10:07 AM Daisuke Baba notifications@github.com wrote:

Thanks. Need more precise info.

Can you please change the log settings as shown below? The following setting outputs only this node logs. NR logs are disabled.

$ sudo nano /lib/systemd/system/nodered.service

Insert the following line under Nice=5 then save the file and exit

Environment="DEBUG=node-red-contrib-generic-ble:*"

$ sudo systemctl daemon-reload $ node-red-start

This will not output anything but NR will be running normally

Then try to cause the above error. The console shows precise log info, so you can post it in this thread.

In order to revert the change, just remove the appended line from /lib/systemd/system/nodered.service file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CANDY-LINE/node-red-contrib-generic-ble/issues/42#issuecomment-729328999, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYHB5EI27TP7VCI6FUVIVDSQMT7TANCNFSM4TYFUV2Q .

--

John Anderson Fungusware http://fungusware.com http://www.xenserver-backup.com

dbaba commented 3 years ago

Unfortunately, no image is available. Can you upload the image files from the github site with the browser?

Fungusware commented 3 years ago

unnamed image

dbaba commented 3 years ago

Thanks. I've published the revised version of this node in order to provide more error info on the console. Could you please upgrade the node to v4.0.3 and post the error info here?

Fungusware commented 3 years ago

Yes, much more information now. See attached. 2020-11-18_13-21-18

dbaba commented 3 years ago

Well, the error is just a permission error... It should be resolved by adding pi user group to bluetooth group.

Again, let me check your environment. Can you please provide the following command results?

$ group pi
# will show the pi user's group
$ uname -a
# will show the linux OS info
$ dpkg -l | grep dbus
# will list dbus related package info

Mine is as follows.

$ groups pi
pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev bluetooth spi i2c gpio

$ uname -a
Linux raspberrypi 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux

$ dpkg -l | grep dbus
ii  dbus                           1.12.20-0+deb10u1                   armhf        simple interprocess messaging system (daemon and utilities)
ii  libdbus-1-3:armhf              1.12.20-0+deb10u1                   armhf        simple interprocess messaging system (library)
ii  python3-dbus

So far, I cannot reproduce the error with the latest OS image (Raspberry Pi OS Lite, Release date: August 20th 2020). So using the latest lite image may resolve the issue.

Fungusware commented 3 years ago

Sure,

He is the information

pi@pi-gpt:~ $ groups pi pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev bluetooth spi i2c gpio pi@pi-gpt:~ $ uname -a Linux pi-gpt 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux pi@pi-gpt:~ $ dpkg -l | grep dbus ii dbus 1.12.20-0+deb10u1 armhf simple interprocess messaging system (daemon and utilities) ii libdbus-1-3:armhf 1.12.20-0+deb10u1 armhf simple interprocess messaging system (library) ii libdbus-1-dev:armhf 1.12.20-0+deb10u1 armhf simple interprocess messaging system (development headers) pi@pi-gpt:~ $

On Wed, Nov 18, 2020 at 2:29 PM Daisuke Baba notifications@github.com wrote:

Well, the error is just a permission error... It should be resolved by adding pi user group to bluetooth group.

Again, let me check your environment. Can you please provide the following command results?

$ group pi

will show the pi user's group

$ uname -a

will show the linux OS info

$ dpkg -l | grep dbus

will list dbus related package info

Mine is as follows.

$ groups pi pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev bluetooth spi i2c gpio

$ uname -a Linux raspberrypi 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux

$ dpkg -l | grep dbus ii dbus 1.12.20-0+deb10u1 armhf simple interprocess messaging system (daemon and utilities) ii libdbus-1-3:armhf 1.12.20-0+deb10u1 armhf simple interprocess messaging system (library) ii python3-dbus

So far, I cannot reproduce the error with the latest OS image (Raspberry Pi OS Lite, Release date: August 20th 2020). So using the latest lite image may resolve the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CANDY-LINE/node-red-contrib-generic-ble/issues/42#issuecomment-729462636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYHB5C5JYAR7ZMOEJINMRTSQNSURANCNFSM4TYFUV2Q .

--

John Anderson Fungusware http://fungusware.com http://www.xenserver-backup.com

dbaba commented 3 years ago

Unfortunately, I have no idea to resolve the issue. Can you please use the fresh OS image without adding ANY packages/programs except Node-RED and this node? I tried the fresh OS image(Raspberry Pi OS Lite) and I confirmed it worked without any issues.