I have just installed the current release of TwisterOS (2.0.1) together with the packages (bluez blueman pi-bluetooth and bluetooth) on my brand new Raspberry Pi 4B. Even though scanning works just fine and it detects every device nearby, I cannot get it to pair to a single device. I tried to connect to a keyboard, mouse, Windows PC and my Android phone without success. When initiating the pairing from the raspi through the graphical UI, I at least receive a prompt asking if I want to pair the device. After that, on the other device it says the pairing was successful, but on the raspi i will get the message that pairing failed. When I try to initialize the process from the other device, I do not even get a prompt on the raspi. Any idea how to fix this?

Edit: I tried to pair the bluetooth mouse from the terminal and got this:

Agent registered
[bluetooth]# discoverable on
Changing discoverable on succeeded
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# agent on
Agent is already registered
[bluetooth]# scan on
Discovery started
[CHG] Controller E4:5F:01:0B:D8:45 Discovering: yes
[NEW] Device A4:C1:38:9A:84:7F Triones-A4C1389A84
[NEW] Device 65:82:BF:B6:FA:09 65-82-BF-B6-FA-09
[NEW] Device CE:7A:CB:6B:38:72 Mi Smart Band 4
[NEW] Device 00:00:01:02:14:EF Bluetooth Mouse
[NEW] Device ED:8E:0E:53:4D:9B Bluetooth Mouse
[bluetooth]# pair 00:00:01:02:14:EF
Attempting to pair with 00:00:01:02:14:EF
[CHG] Device 00:00:01:02:14:EF Connected: yes
[CHG] Device 00:00:01:02:14:EF Connected: no
[NEW] Device ED:8E:0E:53:4E:69 Bluetooth Mouse
[NEW] Device 63:F2:F8:AE:54:E6 63-F2-F8-AE-54-E6
[CHG] Device 00:00:01:02:14:EF RSSI: -59
[CHG] Device 63:F2:F8:AE:54:E6 RSSI: -53
[bluetooth]# trust 00:00:01:02:14:EF
[CHG] Device 00:00:01:02:14:EF Trusted: yes
Changing 00:00:01:02:14:EF trust succeeded
[bluetooth]# connect 00:00:01:02:14:EF
Attempting to connect to 00:00:01:02:14:EF
Failed to connect: org.bluez.Error.Failed

Here is the correspondig journalctl -f -u bluetooth:

-- Logs begin at Sun 2021-04-25 14:13:49 CEST. --
Apr 25 14:13:59 raspberrypi systemd[1]: Condition check resulted in Bluetooth service being skipped.
Apr 25 14:14:00 raspberrypi systemd[1]: Starting Bluetooth service...
Apr 25 14:14:00 raspberrypi bluetoothd[717]: Bluetooth daemon 5.50
Apr 25 14:14:00 raspberrypi systemd[1]: Started Bluetooth service.
Apr 25 14:14:00 raspberrypi bluetoothd[717]: Starting SDP server
Apr 25 14:14:00 raspberrypi bluetoothd[717]: Excluding (cli) sap
Apr 25 14:14:00 raspberrypi bluetoothd[717]: Bluetooth management interface 1.18 initialized
Apr 25 14:14:00 raspberrypi bluetoothd[717]: Endpoint registered: sender=:1.22 path=/MediaEndpoint/A2DPSource
Apr 25 14:14:00 raspberrypi bluetoothd[717]: Endpoint registered: sender=:1.22 path=/MediaEndpoint/A2DPSink

Corresponding sudo btmon (https://pastebin.com/giEKPRrt) and busctl monitor org.bluez (https://pastebin.com/mB4jjPvQ).

ukBaZ pointed out that I might miss a bluetooth profile for the devices, here is the result of bluetoothctl list:

Controller E4:5F:01:0B:D8:45 (public)
Name: raspberrypi
Alias: raspberrypi
Class: 0x001c0000
Powered: yes
Discoverable: yes
Pairable: yes
UUID: Headset AG                (00001112-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
UUID: OBEX File Transfer        (00001106-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
UUID: OBEX Object Push          (00001105-0000-1000-8000-00805f9b34fb)
UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: IrMC Sync                 (00001104-0000-1000-8000-00805f9b34fb)
UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific           (00005005-0000-1000-8000-0002ee000001)
UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server   (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server     (00001132-0000-1000-8000-00805f9b34fb)
UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0532
Discovering: no

Indeed, a profile for bluetooth mouse / keyboard seems to be missing. How do I find and add a profile to support a bluetooth mouse and bluetooth keyboard?

  • There could be a few reasons that you are seeing this behaviour. It maybe that there are no matching Bluetooth profiles between the two devices you are trying to connect. To see what profiles are available on the RPi, type bluetoothctl show. If that doesn't help then when running your script have separate terminals open with the following running to get more debug information: bluetootctl, journalctl -f -u bluetooth, sudo busctl monitor org.bluez, sudo btmon Add any relevant information to your question.
    – ukBaz
    Apr 24 '21 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.