30

The Pavucontrol on my Xubuntu 13.10 detects my bluetooth headset, but only after I type the commands :

pulseaudio -k
sudo alsa force-reload

After a few seconds the headset appears in the configuration tab.

I have also tried inserting the line

load-module module-switch-on-connect

in the /etc/pulse/default.pa but it doesn't help. I have tried purging and autoremoving and reinstalling everything right from alsa to pulseaudio and pulseaudio-module-bluetooth. Nothing works.

Is there a workaround to load the headset without using the command force-reload ? To make the pulseaudio daemon recognize the device automatically ?

I tried adding :

    pcm.bluetooth {
    type bluetooth
    device "XX:XX:XX:XX:XX:XX"
    profile "auto"
   }

to a file .asoundrc in my home directory but it doesn't make a difference

After killing the pulseaudio daemon, my even volume hotkeys stop working. I have to assign

amixer set Master 4%- -q unmute
amixer set Master 4%+ -q unmute

to some other key combination to manage the volume from keyboard. Assigning the commands to the hotkeys doesn't work. How are the volume keys bound to the daemon ? Is there any other way of binding the keys to the new daemon (after restarting) ?

UPDATE

Found the problem. Using the command

pactl list | grep -i module-bluetooth-discover

I found out that the bluetooth discover module was not loaded.

But my default.pa file in /etc/pulse contains the lines

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

So why does the module not load on pulseaudio startup ?

After issuing the command

sudo pactl load-module module-bluetooth-discover

The bluetooth headset works properly and is detected automatically, without killing and restarting alsa.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • I have the same problem. – Borivoje Petrovic Dec 05 '13 at 14:25
  • @BorivojePetrovic, Although I did not find the solution, I did find a workaround. First, load the modules using the commands : sudo pactl load-module module-bluetooth-discover ;

    sudo pactl load-module module-switch-on-connect

    Then, connect your bluetooth headset. In case the headset is connected but pulseaudio doesn't show it, use the commands sudo killall -9 pulseaudio ;

    sudo alsa force-reload ;

    sudo killall -9 xfce4-volumed ;

    xfce4-volumed ;

    This will reload pulseaudio and also your volume keys will start working. Hope this helps :)

    – adityap174 Dec 06 '13 at 03:37
  • I managed it to work. The problem with many issues in PulseAudio sound is sound device sharing. Turning the shares off fixed my problem with bluetooth headset. A very nice app that records audio an is not Gnome's bloaty sound recorder is Audio Recorder, which is availlable from a PPA. – Borivoje Petrovic Dec 07 '13 at 13:39
  • Could you add that as answer? – Braiam Dec 27 '13 at 21:02
  • I have a similar problem, except pactl DOES list module-bluetooth-policy and module-bluetooth-discover ! Again, playback through KDE apps works fine, but playback through pulseaudio does not. Anyone have a clue? – Asfand Qazi Sep 15 '15 at 06:14
  • https://wiki.debian.org/BluetoothUser/a2dp (Troubleshooting) This work for me. – Berg Ginú May 26 '17 at 10:31
  • most of these answers are incredibly outdated so be careful executing them in modern distros – Rainb Feb 11 '24 at 12:59

9 Answers9

17

I found a fix for this on another answer, the problem is that the pulseaudio bluetooth module is loaded before X11, changing a couple of config files do the trick: PulseAudio can not load bluetooth module 15.10/16.04/16.10

vim /etc/pulse/default.pa

Comment out (with an # at the beginning of the line) the following line:

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

Now edit the file /usr/bin/start-pulseaudio-x11 find the following lines:

   if [ x”$SESSION_MANAGER” != x ] ; then
    /usr/bin/pactl load-module module-x11-xsmp “display=$DISPLAY session_manager=$SESSION_MANAGER” > /dev/null
   fi

and change them to this:

   if [ x"$SESSION_MANAGER" != x ] ; then
    /usr/bin/pactl load-module module-x11-xsmp "display=$DISPLAY session_manager=$SESSION_MANAGER" > /dev/null
   #
   # Added per StackExchange http://askubuntu.com/questions/366032/pulseaudio-not-detecting-bluetooth-headset-automatically
   #
    /usr/bin/pactl load-module module-bluetooth-policy
    /usr/bin/pactl load-module module-bluetooth-discover
   fi

This way the Pulse audio’s Bluetooth modules will not be downloaded at boot time but after x11 is started.

This fix goes against the current suggestion at: https://freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/

Zanna
  • 70,465
SivArt
  • 171
  • In my case I simply needed to use pavucontrol to sele ct output device. Blueman didnt solve my problem – Peter Chaula Nov 02 '17 at 20:01
  • 2
    Your patch is very important because both module-bluetooth-policy and module-bluetooth-discover provide the best experience (and the obvious one). When I connect to my headset, my expectation is to get sound there automatically otherwise I just unpair it – develCuy Aug 24 '18 at 16:07
  • In my case this was not working. I added following to ~/.bashrc pactl load-module module-bluetooth-discover – Aleksandr Ryabov Jul 20 '19 at 21:39
  • Worked perfectly! – Otavio Macedo Mar 21 '20 at 20:59
7

This:

sudo apt-get install pulseaudio-module-bluetooth 
sudo pactl load-module module-bluetooth-discover

worked for me on Ubuntu 14.10 (Lenovo x240) to have at least my bluetooth device listed in pulseaudio.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
4

It seems there is an issue with some (legacy?) code in Blueman which deliberately unloads module-bluetooth-discover on startup (i.e. after it's been loaded from /etc/pulse/default.pa. For more details see here: https://github.com/blueman-project/blueman/issues/64.

simon
  • 624
3

I know this is a bit of an old post. But as I recently had the same problem I came across a rather simple solution: just install pulseaudio-module-bluetooth

sudo apt-get install pulseaudio-module-bluetooth

http://ubuntuforums.org/showthread.php?t=1909957

good luck with that :)

Christian
  • 161
  • 6
2

After analize tons of post my conclusion is that blue man is unloading deliberately the module module-bluetooth-discover, so in my case the solution was uninstall blueman from my system. After that, everything works ok.

1
sudo apt-get install pulseaudio-module-bluetooth

Worked for me too, but it was not persistent after a reboot, and I also had to manually set the default audio device in volume control each time.

Adding it to .profile also didn't work - unless it was preceded with an 8 second sleep delay.

Found a solution that worked persistently with just a few clicks:

Right-click the blueman icon -> Plugins

And disable the PulseAudio plugin.

Mtl Dev
  • 175
  • When I do this, it does indeed seem to be possible to select the device as audiosink (i.e. you don't get the usual error "Stream setup failed" when choosing "Connect to Audio Sink in BlueMan). However, no audio is actually streamed to the device, and the bluetooth device is not listed in the sound settings dialog. – Joris Bierkens Oct 28 '15 at 14:50
  • @user203621 Try run pavucontrol go the Configuration tab, add see if you can set your bluetooth device profile to A2DP there? (When troubleshooting bluetooth, on the same configuration tab I often set built in audio to none as well) – Mtl Dev Oct 28 '15 at 18:12
0

[UPDATE]

On KXStudio there is an special setup with Cadence, the right files to edit are located at /usr/share/cadence/pulse2jack/, there are 2 files play.pa and play+rec.pa. Add this to both:

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

[Original - good for debugging]

On Ubuntu+KDE and KXStudio I'm using an autostart script like this:

#!/usr/bin/env sh
sleep 10
/usr/bin/pactl load-module module-bluetooth-policy
/usr/bin/pactl load-module module-bluetooth-discover

ALSO, make sure you did this as well:

sudo apt install pulseaudio-module-bluetooth pavucontrol

It is very important to have pavucontrol in order to switch among profiles (high fidelity A2DP or headset HSP/HFP)

AND, if you are unlucky, then it might be due to your antenna settings, so try this:

sudo rfkill unblock 0
sudo hciconfig hci0 up

Now enjoy your wireless headset!

develCuy
  • 124
0

Running Xubuntu 13.10 64bit I had the same problem. Loading module-bluetooth-discover manually fixes the problem. I it also fixes it permanently. I rebooted and the headset worked without loading module-bluetooth-discover. Seems it has to be successfully connected once and then it's working fine.

I wonder why default.pa contains module-bluetooth-discover and the module is present on disk but it is not listed in pactl list?

Also look at configuration tab in pavuvontrol and set the profile of the headset. I have the choice between off/a2dp/hfp, default was off, so no pulseaudio input or output appeared even though the headset was connected.

Adam
  • 71
  • 2
  • Thanks for answering but after reboot, using the command : 'pactl list | grep -i module-bluetooth-discover' does it show that the module is loaded, after reboot, everything gets reset and I have to issue those commands every time. When connecting the headset through blueman, I switch the profile to a2dp. – adityap174 Dec 09 '13 at 04:14
  • After reboot 'pactl list | grep -i module-bluetooth-discover' yields nothing, and the headset is not recognized. Bot loading module-bluetooth-discover once, log out an log in again, a new pulse server is started, without module-bluetooth-discover loaded, but the headset works. ??? – Adam Dec 11 '13 at 16:29
0

I also have this problem on ubuntu 14.04. The simpliest solution is just add official blueman devs ppa:
https://launchpad.net/~blueman/+archive/ubuntu/ppa
It works for me after update.