# BLE notifications crash the BLUETOOTHCTL

**URL:** <https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443>\
**Category:** Uncategorized\
**Created:** [July 6, 2021, 4:47pm UTC](https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443 "2021-07-06T16:47:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![deadpoolcode](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@deadpoolcode](https://mangoh.discourse.group/u/deadpoolcode)\
**Post date:** [July 6, 2021, 4:47pm UTC](https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443/1 "2021-07-06T16:47:22Z")

</div>

I am using hte following command line commands to set BLE service on the mangoH yellow:

bluetoothctl

power on  
advertise on  
menu gatt  
register-service e2d36f99-8909-4136-9a49-00805f9b34fb  
yes  
register-characteristic 0x0011 read,write  
0x0  
register-characteristic 0x0033 write,notify  
0x0  
register-application

now I can connect to the mangoH yellow via phone BLE and see the charecteristics, read and write

however, when I try to register to BLE notifications with my phone I get:

[CHG] Attribute /org/bluez/app/service0/chrc2 Notify sock acquired  
Attribute /org/bluez/app/service0/chrc2 Notify sock closed

and this is the error from log:

Jul 6 17:51:45 swi-mdm9x28-wp daemon.debug bluetoothd[746]: …/bluez-5.52/src/gatt-database.c:client\_disconnect\_cb() Client disconnected  
Jul 6 17:51:45 swi-mdm9x28-wp daemon.debug bluetoothd[746]: …/bluez-5.52/src/gatt-database.c:profile\_remove() Removed “:1.2/org/bluez/app/register-application”  
Jul 6 17:51:45 swi-mdm9x28-wp daemon.debug bluetoothd[746]: …/bluez-5.52/src/gatt-database.c:profile\_release() Releasing “:1.2”  
Jul 6 17:51:45 swi-mdm9x28-wp daemon.err bluetoothd[746]: Failed to acquire notify: org.freedesktop.DBus.Error.NoReply

I am working with the following :

root@swi-mdm9x28-wp:~# legato version  
19.11.3-1-g8c030edad\_34a8f46a3d85b53df7cd63949d660283\_modified

root@swi-mdm9x28-wp:~# uname -a  
Linux swi-mdm9x28-wp 3.18.140 #1 PREEMPT Wed Dec 9 12:50:57 UTC 2020 armv7l GNU/Linux

there seems to be a dbus support issue with the Yellow + bluez , please assist \ advice

---

<div class="post-metadata">

**Author:** ![deadpoolcode](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@deadpoolcode](https://mangoh.discourse.group/u/deadpoolcode)\
**Post date:** [July 6, 2021, 5:47pm UTC](https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443/2 "2021-07-06T17:47:37Z")

</div>

so I found the issue:  
Jul 6 20:05:53 swi-mdm9x28-wp user.notice kernel: [128.301702] audit: type=1400 audit(1625591153.612:3): lsm=SMACK fn=smack\_file\_receive action=denied subject="\_" object=“admin” requested=rw pid=483 comm=“dbus-daemon” path=“socket:[10118]” dev=“sockfs” ino=10118

my question is, can I disable SMACK from userspace?

apperentlly the solution implemented by mangoH to enable using BLE for the example was to specifically allow BLE access for specific Legato application names  
this is very problematic, since I need to be able to use the BLE freely from any application I write, even outside legato

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [July 7, 2021, 1:59am UTC](https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443/3 "2021-07-07T01:59:19Z")

</div>

You might have a look on yocto source:  
./kernel/security/smack/smack\_lsm.c

function smack\_file\_receive ()

Not sure if forcing this function to return 0 can solve the problem.

---

<div class="post-metadata">

**Author:** ![deadpoolcode](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@deadpoolcode](https://mangoh.discourse.group/u/deadpoolcode)\
**Post date:** [July 12, 2021, 5:26pm UTC](https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443/4 "2021-07-12T17:26:54Z")

</div>

issue resolved by adding a rule to my application

this is quite problematic for users that do not compile the kernel and want to use the legato apps development for BLE

I recommand changing that in future releases

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [July 12, 2021, 11:12pm UTC](https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443/5 "2021-07-12T23:12:40Z")

</div>

How do you add a rule to your app?  
Can you elaborate more?

---

<div class="post-metadata">

**Author:** ![deadpoolcode](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@deadpoolcode](https://mangoh.discourse.group/u/deadpoolcode)\
**Post date:** [July 14, 2021, 8:03am UTC](https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443/6 "2021-07-14T08:03:56Z")

</div>

I resolved by following this instruction:

[https://docs.legato.io/18\_10/conceptsSecuritySmack.html](https://docs.legato.io/18_10/conceptsSecuritySmack.html)

notice for example the configuration:

cat /legato/smack/load2

have the sample ble app enabled:

\_ app.bluetoothSensorTag rwx

---

<div class="post-metadata">

**Author:** ![alexsunny](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@alexsunny](https://mangoh.discourse.group/u/alexsunny)\
**Post date:** [December 26, 2021, 3:27pm UTC](https://mangoh.discourse.group/t/ble-notifications-crash-the-bluetoothctl/9443/7 "2021-12-26T15:27:05Z")

</div>

> [@deadpoolcode](#):
>
> issue resolved by adding a rule to my application
> 
> this is quite problematic for users that do not compile the kernel and want to use the legato apps development for BLE
> 
> I recommand changing that in future releases

thanks for the awesome information.
