# Bluetooth segfaults

## MickKi

Hi All,

Something changed in the last couple of months and when I try to start bluetooth it segfaults like so:

```
Mar 29 17:15:06 dell_xps bluetoothd[13404]: Bluetooth daemon 5.49

Mar 29 17:15:06 dell_xps bluetoothd[13404]: Starting SDP server

Mar 29 17:15:06 dell_xps kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3

Mar 29 17:15:06 dell_xps kernel: Bluetooth: BNEP filters: protocol 

Mar 29 17:15:06 dell_xps kernel: Bluetooth: BNEP socket layer initialized

Mar 29 17:15:06 dell_xps bluetoothd[13404]: Bluetooth management interface 1.14 initialized

Mar 29 17:15:06 dell_xps bluetoothd[13404]: Endpoint registered: sender=:1.39 path=/MediaEndpoint/A2DPSource

Mar 29 17:15:06 dell_xps bluetoothd[13404]: Endpoint registered: sender=:1.39 path=/MediaEndpoint/A2DPSink

Mar 29 17:15:06 dell_xps kernel: bluetoothd[13404]: segfault at 8 ip 000055e0c2fdb820 sp 00007ffe865db208 error 4 in bluetoothd[55e0c2f78000+f6000]
```

two udev processes are then pegged at 100% until I kill it.  Any idea what might be at fault here, or how to troubleshoot it?

----------

## audiodef

net-wireless/bluez? What version? I installed less than two months ago, no trouble here. Maybe I can help compare to see what's changed.

----------

## MickKi

Thanks audiodef,  :Smile: 

I'm on net-wireless/bluez-5.49 and kernel 4.14.27-gentoo.

----------

## audiodef

I have the same bluez version, but I have a different kernel version and I used genkernel. I'm wondering this is a kernel config issue. 

AFAIK, the latest stable gentoo-sources is the 4.9 branch and higher versions have to be in accept_keywords. If you're willing, you could try downgrading your kernel and seeing if an all-defaults genkernel compile solves anything. If it does, you could go through the config and compare it to your current config and try to recompile your 4.14 kernel. (Or continue using the working kernel if you have nothing that requires 4.14.)

----------

## MickKi

Right, it must be a kernel issue.  I've installed 4.15.15-gentoo and bluetooth now no longer segfaults, but it fails to connect.  The syslog shows these recurring messages:

```
Apr  3 18:17:26 dell_xps kernel: Bluetooth: hci0: last event is not cmd complete (0x0f)

Apr  3 18:17:42 dell_xps kernel: Bluetooth: hci0: last event is not cmd complete (0x0f)

Apr  3 18:17:58 dell_xps kernel: Bluetooth: hci0: last event is not cmd complete (0x0f)
```

Udev also goes loopy showing the kernel is binding and unbinding recursively.  The syslog errors point to this bug being the cause of it.

I could try going back to 4.9 kernel series, but I moved on from it sometime ago following the spectre and meltdown fixes.  I'll update 4.15 to see if this bluetooth bug is being fixed.

----------

## MickKi

I've tried gentoo-sources-4.14.37, 4.15.18 and 4.16.5.  Unfortunately all break my Dell Studio XPS 15 bluetooth.  As soon as I switch on the WiFi/BT button on hardware udev is pegged at 100% and bluetooth is not able to communicate with BT devices, although bluetoothctl shows it is connected  :Sad: 

Moving back to gentoo-sources-4.9.95 fixes the problem and both WiFi & BT work as they always did.  So this points to a problem with all the latest kernels.

----------

