How to Stop Ubuntu Linux from Automatically Reconnecting to Bluetooth Devices

The Bluetooth Tug-of-War

Bluetooth headphones and speakers are incredibly convenient, but they often struggle when paired with multiple devices. If you have a pair of headphones paired to both your smartphone and your Ubuntu Linux laptop, you might experience a frustrating tug-of-war. Every time you turn your headphones on to listen to your phone, your sleeping Ubuntu laptop detects the signal, wakes up its Bluetooth radio, and aggressively steals the connection away. To stop this, you must configure the BlueZ daemon to stop automatically connecting to known devices.

How to Edit the BlueZ Configuration File

The core Bluetooth service in Ubuntu is called BlueZ. By default, its policy is to automatically connect to any trusted device it sees broadcasting. You can change this policy in its main configuration file.

1. Open your terminal application (Ctrl+Alt+T).

2. Open the main Bluetooth configuration file using a text editor with root privileges:

sudo nano /etc/bluetooth/main.conf

3. Scroll down through the file until you find the [Policy] section. It is usually located near the very bottom.

4. Look for a line that says AutoEnable=true.

5. Change this line to:

AutoEnable=false

(If the line has a `#` symbol at the very beginning, delete the `#` to uncomment it and make the rule active.)

6. Save the file by pressing Ctrl+O, then Enter. Exit by pressing Ctrl+X.

7. You must restart the Bluetooth service for the new policy to take effect. Run the following command:

sudo systemctl restart bluetooth

Understanding the New Behavior

Setting AutoEnable=false stops the Bluetooth controller from automatically powering on and aggressively reaching out to paired devices when the system boots up or wakes from sleep.

When you want to use your headphones with your Ubuntu laptop, you will now need to manually click the Bluetooth icon in the top right corner of your screen, click your headphones in the list, and select Connect. Your laptop will no longer hijack the connection when you are trying to use the headphones with your phone.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.