Upgrade BlueZ on Ubuntu for use with Home Assistant Bluetooth

I recently tried to add Bluetooth support to Home Assistant Container using the new Bluetooth integration. It should have been relatively easy, but I ran into an annoying error message.

Failed to start BlueTooth: [org.bluez.Error.InvalidArguments] Invalid arguments in method call

Luckily I came across a GitHub issue that seemed similar and suggested that the version of BlueZ (which is required by the Bluetooth integration) on my system might be old and incompatible.

This turned out to be true, the version installed on my Ubuntu server was 5.37, compared to the latest version which was 5.64

Here are the steps I took to upgrade BlueZ to the new version on my Ubuntu system. You'll need to SSH into the Ubuntu server to run these commands.

First, uninstall the old verison of BlueZ

sudo apt-get remove bluez

I then had to install some dependencies that were not available on my system.

sudo apt install glib2.0 dbus-1-dbg build-essential libdbus-glib-1-dev libgirepository1.0-dev libudev-dev libical-dev libreadline-dev python-docutils

Then I was able to download and extract the newest version of BlueZ onto my system (Version 5.64 at the time of posting)

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.64.tar.xztar xf bluez-5.64.tar.xz

Then you need to change to the extracted directory and build the new version of BlueZ

cd bluez-5.64./configuremake

Once it's built, you can install it with

sudo make install

For some reason this broke my Bluetooth service, and made it masked (whatever that is). I fixed this by running

sudo systemctl unmask bluetooth

Then I was able to restart the Bluetooth services

sudo systemctl daemon-reloadsudo systemctl restart dbus bluetooth

If that all worked properly, you should be able to remove and re-add the Bluetooth integration in Home Assistant, and it should work as expected.

Previous
Previous

Failed to start Bluetooth: [org.bluez.Error.NotReady] Resource Not Ready

Next
Next

Installing Z-Wave JS with Docker and Home Assistant