DEV Community

Cover image for Common Bluetooth Problems in Ubuntu and How to Fix Them
Jack Millner
Jack Millner

Posted on

Common Bluetooth Problems in Ubuntu and How to Fix Them

From time to time when you are using Ubuntu Linux and you want to use your Bluetooth headset to watch Netflix or YouTube videos you may experience some problems with the Bluetooth connection on Linux.

The Bluetooth in Linux functions thanks to the interaction of different modules like the Linux kernel, the drivers, client apps, pulseaudio and Bluez. To learn more about Bluetooth please refer to this article.

Problem #1 Bluetooth isn’t available when you wake up the system

When you put your system to sleep, there are chances Bluetooth won’t be available when you wake it up. In order to make everything work fine as before in most cases you will need to restart the system.

On the other hand, sometimes you will need to disconnect the device and pair it up again with your system.

One of the main reasons for such behavior was a bug in the Bluez version 4.48. The bug was responsible for the situation described above and other common actions like connecting, disconnecting and pairing. Luckily. Most bugs including this one were fixed in the next versions of Bluez.

Quick Fix

In order to fix this issue, we need to launch the Terminal and check whether we have the 4.48 version of Bluez. You can easily do that with this command:


 --status bluez | grep '^Version:'

Enter fullscreen mode Exit fullscreen mode

When you see the results, use the following commands to update to the latest version:


 add-apt-repository ppa:bluetooth/bluez
sudo apt-get update

Enter fullscreen mode Exit fullscreen mode

After these commands, you will be able to update the Buez using:


 apt upgrade

Enter fullscreen mode Exit fullscreen mode

A new version of Bluez will provide better behavior during the actions mentioned above and you should still have access to your Bluetooth connection when you wake up the system.

Problem #2 Bluetooth headset won’t play in A2DP (High Fidelity)

Quick Fix

In order to fix this issue, you will need to make your system detect the right type of Bluetooth device by adding a simple configuration file.

First, let’s check whether we have all the dependencies installed:


 apt install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth

Enter fullscreen mode Exit fullscreen mode

When we verify it, we need to create or edit this audio config file:


 gedit /etc/bluetooth/audio.conf

Enter fullscreen mode Exit fullscreen mode

Include the next lines:


 section contains general options
    [General]
    Enable=Source,Sink,Media,Socket

Enter fullscreen mode Exit fullscreen mode

Now it’s time to save the file and start the Bluetooth service again.


 service bluetooth restart

Enter fullscreen mode Exit fullscreen mode

You are good to go. Now you will be able to listen to your Bluetooth audio at a2dp (high fidelity) mode. Enjoy!

Problem #3 After automatic pairing when the system booths Bluetooth won’t play sounds in Bluetooth headset

In most cases the first thing we do after we boot up our system is turning on the Bluetooth headset. Sometimes the system and the device pair up well but no sound. If you use the command journalctl -f you will receive the next message:


 [pulseaudio] module-bluez5-device.c: Profile a2dp_sink has no transport
pulseaudio[1148]: [pulseaudio] module-bluez5-device.c: Refused to switch profile to a2dp_sink: Not connected

Enter fullscreen mode Exit fullscreen mode

Connecting the device again will usually resolve the issue, but this isn’t something we would like to do often. The reason for that is that the Bluetooth device must work immediately after the system boots up.

Quick Fix

One of the solutions is to press the Play/Pause button after you pair the system and the device. This will make the gnome sound manager have the A2DP available. With this option on you can easily set the audio output in the menu. Although this solution isn’t ideal, it does the job.

To make the process easier you can add a shortcut to set this output when the pairing completes and the Play/Pause button is pressed. Here is the command:


 .bashrcThen add the following line at the end:
alias soundon = 'pacmd set-card-profile device_name a2dp_sink'

Enter fullscreen mode Exit fullscreen mode

Please note that you can replace the “Device_name”. Once the pairing completes you can identify your device with this command:


 list-cards

Enter fullscreen mode Exit fullscreen mode

This will appear as a result:

Alt Text

As you can see the device is identified as “bluez_card.00_16_94_0B_5F_DE”. So, you need to replace the device_name with bluez_card.00_16_94_0B_5F_DE. This is just an example, replace the device name with the result you receive after you use the command.

Top comments (7)

Collapse
 
jrmejiaa profile image
Jairo R. Mejia-Aponte • Edited

I have the first problem and I my version of Bluez is quite new compare to the version that has the problem. However, there are sometimes when I suspend my computer that the system does not respond well. Any other thoughts

$ dpkg --status bluez | grep '^Version:'
Version: 5.53-0ubuntu3.1
$ uname -a
Linux jairom-X455LAB 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Enter fullscreen mode Exit fullscreen mode
Collapse
 
prashantnirgun profile image
Prashant Nirgun

getting error Ign:7 ppa.launchpad.net/bluetooth/bluez/... impish InRelease
Err:8 ppa.launchpad.net/bluetooth/bluez/... impish Release
404 Not Found [IP: 91.189.95.85 80]
Reading package lists... Done

E: The repository 'ppa.launchpad.net/bluetooth/bluez/... impish Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Collapse
 
teteration profile image
Mi_iW

Laptop: Dell precision M6800
OS: ubuntu 22.04 LTS
handsfree: Haylou T19

my system is good at any wireless handsfree but with this handsfree i feel something like packt lost in network and the sound does not play continuously and there are interruptions in the sound.

i pretty sure that the handfree is not damaged and i try other handsfree with same model and the result was same and there were interruption in sound. but as i said, my os is good at any other model of wireless handsfree.

please help me :)

Collapse
 
ahmardiy profile image
AhmardiY

Problem #2 quick fix worked for me.
Thanks man :)

Collapse
 
matheusviniciussv profile image
Matheus Vinicius

For me too, thx bro.

Collapse
 
madicnikola profile image
Nikola Madic

Was searching for the solutions for auto-reconnect to the headphones for a while.
Thanks a lot man!

Collapse
 
eleonorsomosot_72 profile image
Eleonor Somosot

Thanks a bunch! This worked perfectly!