Published May 20, 2023, 2:30 PM EDT
Debarshi Das is an independent security researcher and a Cybersecurity Trainer with a passion for writing about cybersecurity and Linux. With over half a decade of experience as an online tech and security journalist, he enjoys covering news and crafting simplified, highly accessible explainers and how-to guides that make tech easier for everyone. While he's programming and publishing by day, you'll find Debarshi hacking and researching at night.
Ubuntu, by default, does not feature the latest version of a lot of software. One such software is BlueZ, an open-source Bluetooth protocol stack. Ubuntu ships with a stable yet, outdated version of BlueZ. This is done to ensure that although the software version is outdated, it's well-tested and free from security flaws. However, the stability comes at the cost of missing out on new features.
In case, you want to install the latest version of BlueZ, you'll need to do that yourself. Let's learn how to manually install the latest version of BlueZ on Ubuntu.
Step 1: Uninstall the Default BlueZ Version
Before you proceed with installing a newer version of BlueZ, you need to get rid of the current one first. You can easily uninstall the default version of BlueZ using the APT package manager on Ubuntu. Here's the command to uninstall BlueZ:
sudo apt autoremove bluez
Type in Y and hit Enter when prompted to confirm your decision.
Step 2: Downloading the Latest BlueZ Source Files
Now that you've uninstalled the current version of BlueZ, you need to download the latest BlueZ source files.
You cannot use the APT package manager because the official Ubuntu repository contains an outdated version, the one you just uninstalled. So you'll have to first grab the source, prepare build files, and then manually install BlueZ.
Download the source files for the latest version of BlueZ from the official website. Either navigate to the site using a web browser or, in true Linux fashion, make use of the wget command in the terminal:
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.66.tar.xz
Make sure that you replace the version number in the above command with the latest BlueZ version.
Download: BlueZ
Step 3: Installing the Required Dependencies
Before moving on to the installation process, you need to install a few dependencies required by BlueZ. Without these installed, the BlueZ build will fail, and you won't be able to install it.
Here's the command to install these dependencies using APT on Ubuntu:
sudo apt install build-essentials libreadline-dev libical-dev libdbus-1-dev libudev-dev libglib2.0-dev python3-docutils
Step 4: Building the Source and Installing BlueZ
Untar the downloaded BlueZ TAR archive using the tar command and move into the new directory using the cd command:
tar -xzvf bluez-* && cd bluez*
Once in the directory, prepare the build files by running the configure script and then proceed to install BlueZ using make and make install:
./configure
make
sudo make install
That's all the steps required to build and install the latest version of BlueZ on Ubuntu.
Step 5: Configure and Enable BlueZ Services
With the latest version of BlueZ installed, it's time to make some final configurations to ensure that it works as intended.
Start by creating a new BlueZ service to enable experimental features. To do that, first, open the bluetooth.service systemd service file using the text editor of your choice and add --experimental to ExecStart:
sudo nano /lib/systemd/system/bluetooth.service
Modify the ExecStart line so it looks like this:
ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental
Then, using the systemctl command, enable and start up the Bluetooth service:
sudo systemctl daemon-reload
sudo systemctl unmask bluetooth.service
sudo systemctl restart Bluetooth
Check if it's working by using the systemctl status command:
sudo systemctl status Bluetooth
This should return a positive output. Now, to check if BlueZ is working correctly, fire up a new terminal, type in the bluetoothctl command, and hit Enter.
sudo bluetoothctl
That's all the steps required to install and set up the latest version of BlueZ on Ubuntu. Now you can try out the new features of the release at will without having to wait for the latest version to be added to Ubuntu's official repositories.
Installing the Latest Version of BlueZ on Ubuntu
Now you have successfully installed the latest version of BlueZ, the open-source Bluetooth protocol stack, on Ubuntu. This upgrade brings a host of new features and improvements, allowing you to take full advantage of Bluetooth technology.
Moreover, installing the latest version of Bluetooth software is one of the many ways of troubleshooting Bluetooth connectivity on Linux.