Compile and install BlueZ on Ubuntu 21.10

Install essential packages

sudo apt install build-essential libglib2.0-dev libdbus-1-dev libudev-dev libical-dev libreadline-dev python3-docutils

Download, compile and install latest BlueZ

BlueZ » Download
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.63.tar.xz
tar xvf bluez-5.63.tar.xz
cd bluez-5.63
./configure
make
sudo make install

Enable BlueZ experimental

sudo nano /lib/systemd/system/bluetooth.service
ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
sudo systemctl status bluetooth
● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-03-05 11:07:12 HKT; 10s ago
       Docs: man:bluetoothd(8)
   Main PID: 39772 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 9263)
     Memory: 476.0K
     CGroup: /system.slice/bluetooth.service
             └─39772 /usr/local/libexec/bluetooth/bluetoothd --experimental

Usage

sudo bluetoothctl
[bluetooth]# list

hcitool is deprecated. Please use bluetoothctl.

In case of bluetooth interface problem

Check if rfkill blocking the bluetooth device

sudo rfkill list
0: phy0: Wireless LAN
        Soft blocked: yes
        Hard blocked: no
1: hci0: Bluetooth
        Soft blocked: yes
        Hard blocked: no

If so

sudo rfkill unblock bluetooth

If the problem still exists, make sure no service uses Bluetooth. Reboot.

Reference

Subscribe to theMatrixDev

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe