Skip to content

Instantly share code, notes, and snippets.

@bitmand
Last active February 26, 2025 21:11
Show Gist options
  • Save bitmand/76f7bd5cbb22cb51ef1e82db320eadc6 to your computer and use it in GitHub Desktop.
Save bitmand/76f7bd5cbb22cb51ef1e82db320eadc6 to your computer and use it in GitHub Desktop.
Reconnect patch for bluez on Ubuntu 24.04 noble

Reconnect patch for bluez on Ubuntu 24.04

on 20. January 2024

Bose QC45 headphones won't reconnect after reboot - running bluez version 5.72-0ubuntu5 before patch.

Download patch

mkdir bluez-noble-fix && cd bluez-noble-fix
wget https://launchpadlibrarian.net/757506303/bluez-fix-address.patch

Patch and build bluez package

# start container
docker run -it --rm -v "$(pwd)":/build ubuntu:24.04 /bin/bash

# add src repositories
cd /build
cat /etc/apt/sources.list.d/ubuntu.sources | sed 's/^Types: deb$/Types: deb deb-src/g' > ubuntu.sources
mv ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources

# update, upgrade and install build tools
apt-get update && apt-get upgrade -y && apt-get install -y dpkg-dev devscripts build-essential fakeroot vim

# install bluez build dependencies
apt-get install -y debhelper-compat flex bison libdbus-1-dev libglib2.0-dev libdw-dev libudev-dev libreadline-dev libical-dev libasound2-dev libell-dev libjson-c-dev python3-docutils python3-pygments udev check systemd systemd-dev

# get bluez source and patch src/adapter.c
apt-get source bluez
cd bluez-5.72
patch -u src/adapter.c ../bluez-fix-address.patch

# commit, update changelog and build new package
dpkg-source --commit
dch -i
debuild -us -uc

# exit container
exit

Install patched bluez package

sudo dpkg -i bluez_5.72-0ubuntu6_amd64.deb
@medienintegration
Copy link

Works like a charm. Thank you!

@jhakonen
Copy link

jhakonen commented Feb 3, 2025

Tried with Kubuntu 24.04 and Sony WH-1000XM3 headset and the fix worked perfectly. Thank you!

@gjcarneiro
Copy link

Works great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment