[HowTo] Bluetooth headphones paired, but no sound after a while

Difficulty: ★☆☆☆☆


Greeting fellow Linux users!

Are you experiencing this strange behaviour when you have your precious Bluetooth headphones connected, but after a few minutes of no audio playing and you start a video or audio, it seems that there is no sound coming out your headphones although they are still paired?


Using pavucontrol may help keeping the line up, but it is not the ideal solution, shall I say.

Then what else can solve this mysterious annoyance?

Indeed, if your headphones are connected, the modules are successfully loaded. Sometimes, the issue is that Pulseaudio gets started before Bluetooth. Other times, the Bluetooth audio module just does not stay active, which launching pavucontrol usually keeps it alive.

Okay, but how to fix this issue, you might ask.


Let’s start by entering sudo nano /etc/pulse/default.pa into a terminal. Pretty straight forward at this point, isn’t it?

Now the fun begins. You may find the section starting with:
### Automatically load driver modules for Bluetooth hardware

Got it? Fantastic!

Now shall you comment the corresponding lines as shown bellow. Commenting a line usually means adding a specific character before a phrase, so that the software will not read it or interprete it. In that case, the comment symbol we use is the pound #.

### Automatically load driver modules for Bluetooth hardware
#.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
#.endif

#.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
#.endif

After that, search for load-module module-suspend-on-idle and comment it so it looks like the following:

### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle

Great! Now the for the last step, you may go completely to the bottom, and add the script below!

# automatically switch to newly-connected devices
load-module module-switch-on-connect
# or switch also to newly-connected virtual devices
load-module module-switch-on-connect ignore_virtual=no

To save your changes, hit the ctrl and s keys on your keyboard simultaneously, followed by ctrl and x to leave the editor.

To make sure the changes are fully applied, we will restart the pulse audio process by executing pulseaudio --k in the terminal, followed by pulseaudio --start.You may also reboot if you want to be certain that the changes are applied.


For GNOME users!

Next, we will prevent Pulseaudio from automatically starting a server if there are none running, as many Desktop Managers will start their own PulseAudio instance.

Let’s proceed by entering sudo nano /var/lib/gdm/.config/pulse/client.conf into the terminal.

Ready? Great!

You may now add the following lines:

autospawn = no
daemon-binary = /bin/true

Once again, to save your changes, hit the ctrl and s keys on your keyboard simultaneously, followed by ctrl and x to leave the editor.

We will also make sure that Systemd does not decide to start PulseAudio randomly by executing sudo -ugdm mkdir -p /var/lib/gdm/.config/systemd/user in a terminal, followed by sudo -ugdm ln -s /dev/null /var/lib/gdm/.config/systemd/user/pulseaudio.socket .

Finally, execute pgrep -u gdm pulseaudio in the terminal!


Voilà! This clumsy behaviour with Bluetooth headphones should now be eliminated, not interrupting your majestic jam playback anymore!

I hope this helped, and as always, have a wonderful day! :sunglasses:

-The Quantum Alpha

11 Likes

Wouldn’t a better solution be to make sure Bluetooth is always started before Pulseaudio?
Also because your info later on is specific to gdm i would suggest to put that in your title also, because there are many other DM’s used :wink:
(I’m using Manjaro-KDE, who uses sddm)

Oh, my bad about the gdm, my friend suggested me to add the gdm part… ( Pinkisjustnumbers)

Oh, that’s the process above! :sweat_smile:

Uhmmm

### Automatically load driver modules for Bluetooth hardware
#.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
#.endif

#.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
#.endif

This only eliminates the check if those files exist before loading those modules…
Which will make it error-out if one of those two module-files are missing, because now they are tried to be loaded unconditionally…

Unfortunately this tutorial didn’t help me as I am having trouble right now with pairing as we speak:


I only did the first part but the gdm folder unfortunately doesn’t exist on Manjaro XFCE (which is what I am using)
Still hoping for a reply on my own thread, thanks for the tutorial anyhow, I sure hope it’ll help others :smile: !

That’s still a step towards the goal, but as I wanted to keep it the most less technical person friendly, we deemed unnecessary to include further steps, and will not add it as a step.
Therefore, I may thank you anyway for the suggestion!

1 Like

Noticing you mentioning /var/lib/gdm/.config/systemd/user/pulseaudio.socket i guess you have a pulseaudio.service and pulseaudio.socket somewhere…

Those could be configured with a single line addition to force it/them to start after the bluetooth.service or vice-versa…
That solution would be even easier/correct :wink:
But it’s your how-to ofcourse…gl

Here is a revised version with steps added, as requested!

Thanks @The_Quantum_Alpha. Your [How to] was easy to understand and resolved my issue

1 Like

:partying_face: oh! You are very welcome! !

Glad it helped! :grin:

You’re a good man!
I just bought these bluetooth headphones and they work flawlessly on Android.
On Manjaro KDE the bluetooth crashes five seconds after connection.
Damn Linux I was swearing, but then found this topic! Problem solved, thanks :muscle:

I paste the error for SEO to help fellow users searching for this:

nov 09 11:24:58 my-computer bluetoothd[852]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 00:00:00:00:00:00: Software caused connection abort (103)

and

nov 09 11:08:19 my-computer bluetoothd[852]: src/profile.c:record_cb() Unable to get Headset Voice gateway SDP record: Software caused connection abort
1 Like

This is wonderful news to me! :smile:

I’m glad that this can help you!

I wish you a wonderful day!

It works perfectly!

2 Likes

I think this technique helped my audio but it didn’t fix it. I’m trying to connect my Airpods Pro to my laptop. I can hear audio for a few seconds to a couple of minutes but audio starts to cut out and glitch, then stop altogether. I’ve tried a few techniques from the Arch forums on PulseAudio/Troubleshooting but nothing seems to fix my problem.

worked for me thank you :smiley :smiley:

2 Likes

Thanks man! I can now use my bluetooth earphones. I really appreciate it. :blush:

1 Like

That didn’t work for me, but here is what I did on top of that to make it work.

I have headphones that can also be switched off with button. After switching back on, they still didn’t auto connect.

I’ve done all what was said in the instructions, rebooted, nothing changed.

On top of that I edited sudo nano /etc/bluetooth/main.conf and on the very bottom of the file uncommented these lines:

AutoEnable=true
ResumeDelay = 2

Also I edited sudo nano /etc/pulse/system.pa and on the bottom added these lines:

load-module module-bluetooth-policy
load-module module-bluetooth-discover

Now when I switch on/off my headphones they autoconnect and work just fine.

Most Manjaro users are not running PulseAudio in system mode and should not need to change /etc/pulse/system.pa

What Is Wrong With System Wide | freedesktop.org/PulseAudio/Documentation

For most users It would be more effective to add changes to /etc/pulse/default.pa or create a custom user configuration ~/.config/pulse/default.pa

thanks…very informative tutorial…it help a lot…