How to fix “Bluetooth device doesn’t auto-connect” in Linux

If you have been using Linux for a while, you would know Bluetooth and Linux don’t go hand in hand. Whatever may be the reason, it’s always a hassle to connect Bluetooth devices to your Linux system. Recently, since myupgrade to Ubuntu 20.04, I have come to notice that Bluetooth devices don’t just auto-connect back to my system. I dug on it a lot and here are ways to fix “Bluetooth device doesn’t auto-connect in Ubuntu”.

Fix “Bluetooth device doesn’t auto-connect” in Ubuntu

There is no one-stop solution to this problem and your issue might differ from mine. For instance, my Bluetooth headphones auto-connect back to my Ubuntu system as soon as I power it on. But, the next second, it disconnects again and I have to connect it every time manually.

So, whatever may be the Bluetooth device, here’s a step-by-step fix and do comment and let me know which of them works for you.

sudo-nano-bluetooth

Step 1. AutoEnable

Foremost, you need to ensure that you have a working Bluetooth module and it’s turned on. Once, we have that out of the way, we need to check if AutoEnable is turned on. Auto enable ensures that the Bluetooth module is turned on after every restart. Additionally, if you plug in a Bluetooth USB device or module, AutoEnable ensures that it can start without a reboot.

To ensure AutoEnable is turned on, we need to dig in the Bluetooth configuration file. To do that, use the following command.

auto-enable-bluetooth.conf

In the Bluetooth configuration file, navigate to the bottom. In case you see a line stating“AutoEnable=true”, it’s all good. In case you don’t, AutoEnable is turned off. Hence, we’ll have to add the following line at the end of the file.

This step is not that important for a Bluetooth audio device but can fix a Bluetooth mouse, webcam, or keyboard auto-connect issue.

bluetooth-settings-bluetooth

Read:How to Fix AirPods not Working on Ubuntu

Step 2. Trust Device

If the above method didn’t solve the problem, a reason might be that the Bluetooth device isn’t trusted by Ubuntu. This causes an authentication failure when the device tries to auto-connect. To ensure your Bluetooth device is trusted, we need to add it to the trusted list.

To do that, we would foremost need the Bluetooth device MAC address. To get the MAC address, you need to connect your Bluetooth device with your system or at least make it discoverable. Next, head over to the top bar and click on the battery icon. From the extended drop-down, click on theBluetoothicon and thenBluetooth Settings.

bluetooth-device-mac-address

Under Bluetooth settings, look for your Bluetooth device name and click on it. From the pop-up menu, you will get the device MAC Address.

Once we have the device MAC address, hit the “Alt+Ctrl+T” to open the terminal. On the terminal, type the following command and hit Enter.

bluetoothctl-trust-device

To verify the device is added to the trusted list, hit the following command.

Now, try and restart your Bluetooth service, the device should auto-connect now.

Step 3. Re-pair Bluetooth device

In case things don’t work out, you can try removing the Bluetooth device and pairing it back again. At times, Ubuntu can mistake the Bluetooth device type or class. For instance, it can take the headphone device class as a Bluetooth keyboard. This issue can be fixed by a re-pairing. You can do that through the GUI by removing the device but if you are a keyboard ninja like me, below is the command.

Put your headphones into pairing mode and run the following command

Once done, restart your Bluetooth and see if the device auto-connects.

Step 4. Reinstall Bluetooth

This is the last resort if things don’t work out. A reinstall might fix the Bluetooth and other driver issues.BlueZis the official Linux Bluetooth stack. To reinstall Bluetooth, we need to reinstall the BlueZ package. To do that, use the following command.

Read:How to Uninstall An Application In Ubuntu

Once you have reinstalled Bluez, enable and start the Bluetooth service by using the following command.

Now, this might help you to fix the automatic reconnect of the Bluetooth device. In case, it doesn’t lets move to the next step.

Step 5. Script

In case the above steps didn’t work you, we are in the same shoes. While I was about to give up on this article altogether, I stumbled upon a Python script on GitHub calledbluetooth-autoconnect. It’s a python script that automatically connects to all paired and trusted Bluetooth devices. However, the script is not available to install directly on Flatpak or Apt repository. Hence, we need to manually download and configure the service.

First of all, download the zip file from GitHub or use the following command to clone the repository to your home directory.

Now that we have the repository downloaded we need to move the service and scripts to their respective location before we start the service. In my case, I am using systemd architecture, hence the file destinations mentioned would be applicable to distros like ArchLinux, Ubuntu, Debian, etc. In case you use non-systemd distros, kindly google your service directories.

Once, we have successfully copied the service to the respective directories, let’s enable and start the service. To do that, use the following command.

Now, that we have the service started, it’ll try to reconnect to every paired and trusted Bluetooth device. The only caveat with this method is that you won’t be able to pair your Bluetooth device with other systems without switching off your Linux machine’s Bluetooth. Since the device would always try to connect with your Bluetooth device.

Visitbluetooth-autoconnect GitHub

Closing Words

This article took me through dozens of forums and articles on the web. I tried udev scripts to PulseAudio to Bluez Manager but none of them could do the autoconnect job. Hence, I omitted them from this article. In my journey with Linux systems, apart from the lack of good professional apps, Bluetooth has been the second-most problem. I could never arrive at the conclusion that whether it’s the manufacturer driver issue or something Linux hasn’t figured it out yet.

Let me know your experience down in the comments and we could work out a solution together.

Also Read:7 Best Equalizer Apps for Android For Every Music Lovers

Pratik works as an In-house writer and video host at TechWiser. Former Programmer, Current writer. Loves tech in any form, quite optimistic about AI, data science and IoT. Talks extremely less but you betcha can geek out over anything on Twitter.

How to Use Custom Mouse and Keyboard Shortcuts on Chromebook

What’s the Difference Between Chromebook and Chromebook Plus

How to Stream Apps From Android Phone to Chromebook

8 Unique ChromeOS and Android Integrated Ecosystem Features

20 Best Keyboard Shortcuts for Chromebook for Home Users

13 Tips to Customize and Personalize Your Chromebook

How to Edit a Picture or Screenshot on Chromebook

How to Add, Delete and Edit Payment Methods on Chrome

14 Best Fixes for Chromebook Microphone Not Working

How to Change Chromebook System and Keyboard Language

You must belogged into post a comment.