Requesting support for Tp-link UB500 Bluetooth adapter

I will try to help you, module building can get a bit confusing !
First, try to provide any errors except modprobe: ERROR: could not insert 'btusb': Exec format error if you are getting any.
Second, do uname -r and tell me what it returns.
Third, are you running absolute vanilla arch or a fork ?

This article is actually linked to this article. Please make sure to look into that article as well, and also change the kernel version to your own kernel version in the several commands shown in this article. I just built the patched btusb module in the new kernel 5.15.2-2-MANJARO and it works flawlessly !

Bluetooth monitor ver 5.62
= Note: Linux version 5.15.2-arch1-1 (x86_64)                          0.764499
= Note: Bluetooth subsystem version 2.22                               0.764500

nov 19 21:34:35 archlinux systemd[1]: Starting Bluetooth service...
nov 19 21:34:35 archlinux bluetoothd[13881]: Bluetooth daemon 5.62
nov 19 21:34:35 archlinux bluetoothd[13881]: D-Bus setup failed: Connection ":1.284" is not allowed to own the serv>
nov 19 21:34:35 archlinux bluetoothd[13881]: src/main.c:main() Unable to get on D-Bus
nov 19 21:34:35 archlinux systemd[1]: bluetooth.service: Main process exited, code=exited, status=1/FAILURE
nov 19 21:34:35 archlinux systemd[1]: bluetooth.service: Failed with result 'exit-code'.
nov 19 21:34:35 archlinux systemd[1]: Failed to start Bluetooth service.
uname -r
5.15.2-arch1-1

im using vanilla arch (Gnome)

Thanks, i’m reading now

Looks like a common failure of the bluetooth.service deamon not able to initiate a dbus interface to the bluetooth dongle or which ever bluetooth adapter you are trying to use. Do you currently have the gnome gui working ? If yes, then after plugging in the dongle, open bluetooth settings and see if the adapter atleast shows up or not. For the tp-link UB500 specifically, the adapter itself shows up but it cannot search for any bluetooth devices. Also which buletooth device are you using ? UB500 ?
Also please note that the module building and patching process is a bit different for manjaro and vanilla arch. This article is specifically for manjaro. I haven’t tried building the module in vanilla arch. Please refer to the arch linux forums for your specific problem.

1 Like

Yes i have Gnome and UB500.
In bluethooth settings there is a switch to activate it but it is locked.

When I didn’t have the patch and ran btusb it was possible to activate it but nothing appeared.

Thanks for your help

If you followed the tutorial in this article, when you did makepkg --nobuild the imidiate output of the command should show the kernel verion for which it is downloading the source files.
Since your kernel version is 5.15.2-arch1-1 the the above command should show :-

~/build/linux515/master > makepkg --nobuild                                          ✔ 
==> Making package: linux515 5.15.2-arch1-1 (Saturday 19 November 2021 12:10:56 PM)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading linux-5.15.tar.xz...

Please make sure your kernel version and the version shown in the makepkg --nobuild command is the exact same.
(I edited the above command output to match your kernel version, your actual command output should look fairly similar to this.)

In case the kernel version in the makepkg output is different than your kernel version, then you have to start fresh, and BEFORE doing makepkg --nobuild you have to enter this command git reset iCommitNumber --hard where iCommitNumber is the EXACT git commit that has your EXACT kernel version. You said that you pulled the source files from here.
This branch has the source for kernel version 5.15.2-arch1 where your kernel version is 5.15.2-arch1-1. See ? Your kernel version has an extra -1 at the end, that means it is not the same as the one in github.


I think this is why you are facing the error. I think you should try to find the source files for your exact kernel or revert to 5.14 kernel and find its source files from github or aur.
Edit : I just checked the linux 5.16 kernel source files, and they have added the support for UB500 ! So if you cannot get the module to work, then just wait for the 5.16 kernel !

1 Like

The patch for /drivers/bluetooth/btusb.c has been added to kernel 5.16rc1
btusb.c - drivers/bluetooth/btusb.c - Linux source code (v5.16-rc1) - Bootlin

And kernel v5.16rc1 is available in all Manjaro branches
Manjaro Branch Compare - Linux516

2 Likes

Yeah I saw that just yesterday ! I will try out the 5.16 kernel soon.

Another day to try to fix my problem…
Meanwhile the Arch kernel has moved to 5.15.3-arch1-1

I discovered these commands that allow me to download the sources corresponding to my version::

$ asp export linux
$ cd linux
$ makepkg -od

(installed asp package first)

I checked that the two versions matched, buided modules and replaced btusb.ko

btusb no longer gives that error and I am able to toggle the switch on gnome-settings

The DBUS error remains, I have tried with dozens of solutions and nobody responds to the Arch forum

Some output:

sudo dmesg | grep -i bluetooth
[sudo] password di fabrixx: 
[    4.724290] Bluetooth: Core ver 2.22
[    4.724301] NET: Registered PF_BLUETOOTH protocol family
[    4.724302] Bluetooth: HCI device and connection manager initialized
[    4.724303] Bluetooth: HCI socket layer initialized
[    4.724304] Bluetooth: L2CAP socket layer initialized
[    4.724305] Bluetooth: SCO socket layer initialized
[  287.650253] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  287.650255] Bluetooth: BNEP filters: protocol multicast
[  287.650257] Bluetooth: BNEP socket layer initialized
[fabrixx@archlinux ~]$
 /usr/lib/bluetooth/bluetoothd -n -d  
bluetoothd[4547]: Bluetooth daemon 5.62
bluetoothd[4547]: src/main.c:parse_config() parsing /etc/bluetooth/main.conf
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “DiscoverableTimeout” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “AlwaysPairable” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “PairableTimeout” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “Privacy” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “JustWorksRepairing” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “TemporaryTimeout” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “Name” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “Class” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “DeviceID” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “ReverseServiceDiscovery” in group “General”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “Cache” in group “GATT”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “KeySize” in group “GATT”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “ExchangeMTU” in group “GATT”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “Channels” in group “GATT”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “SessionMode” in group “AVDTP”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “StreamMode” in group “AVDTP”
bluetoothd[4547]: src/main.c:parse_config() Key file does not have key “RSSISamplingPeriod” in group “AdvMon”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “PageScanType” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “PageScanInterval” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “PageScanWindow” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “InquiryScanType” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “InquiryScanInterval” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “InquiryScanWindow” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “LinkSupervisionTimeout” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “PageTimeout” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “MinSniffInterval” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “MaxSniffInterval” in group “BR”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “MinAdvertisementInterval” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “MaxAdvertisementInterval” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “MultiAdvertisementRotationInterval” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanIntervalAutoConnect” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanWindowAutoConnect” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanIntervalSuspend” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanWindowSuspend” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanIntervalDiscovery” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanWindowDiscovery” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanIntervalAdvMonitor” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanWindowAdvMonitor” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanIntervalConnect” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ScanWindowConnect” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “MinConnectionInterval” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “MaxConnectionInterval” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ConnectionLatency” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “ConnectionSupervisionTimeout” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “Autoconnecttimeout” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “AdvMonAllowlistScanDuration” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “AdvMonNoFilterScanDuration” in group “LE”
bluetoothd[4547]: src/main.c:parse_mode_config() Key file does not have key “EnableAdvMonInterleaveScan” in group “LE”
D-Bus setup failed: Name already in use
bluetoothd[4547]: src/main.c:main() Unable to get on D-Bus
× bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: disable>
     Active: failed (Result: exit-code) since Sun 2021-11-21 19:35:32 UTC; 15min ago
       Docs: man:bluetoothd(8)
    Process: 1789 ExecStart=/usr/lib/bluetooth/bluetoothd (code=exited, status=1/FAILURE)
   Main PID: 1789 (code=exited, status=1/FAILURE)
     Status: "Starting up"
        CPU: 6ms

nov 21 19:35:32 archlinux systemd[1]: Starting Bluetooth service...
nov 21 19:35:32 archlinux bluetoothd[1789]: Bluetooth daemon 5.62
nov 21 19:35:32 archlinux bluetoothd[1789]: D-Bus setup failed: Connection ":1.97" is not allow>
nov 21 19:35:32 archlinux bluetoothd[1789]: src/main.c:main() Unable to get on D-Bus
nov 21 19:35:32 archlinux systemd[1]: bluetooth.service: Main process exited, code=exited, stat>
nov 21 19:35:32 archlinux systemd[1]: bluetooth.service: Failed with result 'exit-code'.
nov 21 19:35:32 archlinux systemd[1]: Failed to start Bluetooth servic

e.

After downgrading bluez (resding about some problems in atch forum) and with dfeet tool im now finally able to scan for devices i have bluetooth icon on my panel

Status is on now:

● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: disabled)
     Active: active (running) since Sun 2021-11-21 20:19:28 UTC; 7min ago
       Docs: man:bluetoothd(8)
   Main PID: 4017 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 19069)
     Memory: 1.2M
        CPU: 24ms
     CGroup: /system.slice/bluetooth.service
             └─4017 /usr/lib/bluetooth/bluetoothd

nov 21 20:19:28 archlinux bluetoothd[4017]: Starting SDP server
nov 21 20:19:28 archlinux bluetoothd[4017]: Bluetooth management interface 1.21 initialized
nov 21 20:19:28 archlinux bluetoothd[4017]: Endpoint registered: sender=:1.88 path=/MediaEndpoint>
nov 21 20:19:28 archlinux bluetoothd[4017]: Endpoint registered: sender=:1.88 path=/MediaEndpoint>
nov 21 20:19:28 archlinux bluetoothd[4017]: Endpoint registered: sender=:1.88 path=/MediaEndpoint>
nov 21 20:19:28 archlinux bluetoothd[4017]: Endpoint registered: sender=:1.88 path=/MediaEndpoint>
nov 21 20:19:28 archlinux bluetoothd[4017]: Endpoint registered: sender=:1.88 path=/MediaEndpoint>
nov 21 20:19:28 archlinux bluetoothd[4017]: Endpoint registered: sender=:1.88 path=/MediaEndpoint>
nov 21 20:19:28 archlinux bluetoothd[4017]: Endpoint registered: sender=:1.88 path=/MediaEndpoint>
nov 21 20:19:28 archlinux bluetoothd[4017]: Endpoint registered: sender=:1.88 path=/MediaEndpoint>
~
~

Another good news, The patch is backported to linux kernel 5.15.4, and it is also on manjaro unstable.

2 Likes

Omg i can install it now!!
https://archlinux.org/packages/core/x86_64/linux/

I had better wait but I had a good experience on compiling the kernel …
Work perfectly, I have paired the google home mini and am using it as a speaker

Nice ! Thanks for the info.

1 Like

Very good ! Enjoy using it !

1 Like

Which Bluetooth version is it working as? Just bought the same adapter and it works, but only as Bluetooth 4.1.

I don’t think the adapter you bought is the same adapter mentioned in this tutorial. Tp-Link UB500 has ONLY bluetooth Version 5.0 and not bluetooth version 4.1. I think the adapter you bought is the UB400 model. Also, UB400 bluetooth adapter has been supported on linux for a long time. The problem arises only with UB500 because the adapter was launched only recently. And also with the latest manjaro 5.15 stable kernel, UB500 adapter is also now officially supported. If your bluetooth adapter is workin fine with BLUETOOTH 4.1, then it’s likely NOT UB500 but UB400. Both adapters look almost identical.
TLDR :-
Please recheck the box of your adapter as it surely is UB400 and NOT UB500. Also, if your adapter works fine, meaning you can connect and use bluetooth devices with it. Then I don’t see you having to need this tutorial in anyway. :slight_smile:

I’m trying GNOME 42 alpha and the bluetooth disconnects after a few seconds and won’t start

You have to configure bluetooth configuration file located in /etc I think ? Go through this github link : Keychron K2 Linux BLUETOOTH FIXES. Use the ‘Bluetooth fixes’ section and see if your problem resolves. If not, then I think it is a bug in the Software (since it is in alpha version). Hope it helps !!