Fix “stream setup failed” error with blueman audio sync on Ubuntu

ubuntu_logo_81x81Since I grabbed a bluetooth speaker, I was facing the “Connection Failed: Stream setup failed” error with blueman-applet. The device would get connected in the Headset mode but the Audio Sync connection will always fail. The workaround was to kill pulseaudio with pulseaudio -k. In addition, I had to kill pulseaudio using killall -9 pulseaudio for my latop speakers to work once I disabled bluetooth. I am using a minimal LXDE desktop environment and am stuck with the blueman-applet.

Today I took a stab at the problem. I referred to similar issue reports with audio headsets as well. I have the latest updates on Ubuntu 14.04.2 but users reported the problem on Ubuntu 13.10 as well. Without further ado, here’s how I fixed it:

  1. Edit /etc/bluetooth/audio.conf and uncomment the following line:
    AutoConnect=true
  2. Run the following command to install latest packages forblueman and related modules:
    $ sudo add-apt-repository ppa:blueman/ppa
    $ sudo apt-get update
    $ sudo apt-get upgrade blueman
  3. You will need to install the pulseaudio bluetooth module if it’s not installed already:
    $ sudo apt-get install pulseaudio-module-bluetooth
  4. Check if the following lines are added in /etc/pulse/default.pa:
    .ifexists module-bluetooth-discover.so
    load-module module-bluetooth-discover
    .endif

    If not, add the lines.

  5. Run blueman-applet. Right click on the panel applet and turn bluetooth on.
  6. The old profie of you bluetooth device would still be there, remove it. Right click on the blueman-panel applet and select Setup New Device. Complete the wizard for your device.
  7. Logout and login.

Now my device gets automatically connected and pavucontrol switches automatically to the bluetooth speaker (from laptop speaker or earphones).

In case you see a WiFi connection drop after connecting to the bluetooth device run the following command:

$ echo "options iwlwifi 11n_disable=1 bt_coex_active=0 power_save=0 auto_agg=0 swcrypto=1" | sudo tee -a /etc/modprobe.d/iwlwifi.conf > /dev/null

Leave a comment on how the procedure works for you.

46 thoughts on “Fix “stream setup failed” error with blueman audio sync on Ubuntu”

  1. Thank you, I finally suceed because of your blog post, thank you and now i can listen my music on my speaker 🙂 thank you again

  2. Hi
    I installed the new version a blueman. Before uppgrade i have no connection. I’ts better now, but after a few seconds bluetooth connection go down.
    Can anything be done ?

  3. Does not work for me.. 🙁
    Followed the procedure above, but got it connected once for 15 seconds. Otherwise the usual:
    “Connection Failed: Stream setup failed”

    1. I used to have wifi issues with the earlier version but the latest version works fine. Never faced any issue with mice.
      Can you please raise a bug on the project with specifics?

      1. i have just clean install , sorry, cannot raise a bug on the project.

        i really concern about linux and opensource, i often bump into a set of instructions that meant to help us out, but it fail to do so…..

        i tried the following command and it work fine, i hope you don’t mind my posting here

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

        i got it when i google for bluetooth ubuntu audio sink fail…..

        1. Thank you very much! You just created an example of the beauty of opensource and community work. I’ll add it right away! 🙂

          I also noticed that the following are added by default in my /etc/pulse/default.pa:

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

          pulseaudio-module-bluetooth was installed already from the last iteration of trials with old blueman-applet. Which is why I didn’t face the issues you did.

          In my case despite having those lines (i.e. the module being loaded), automatic audio sync had problems with the older version of blueman-applet.

          Anyway, I think the solution is near-complete now. The problems are not the same for all users and that was the intention behind the last line: “Leave a comment on how the procedure works for you.”

  4. Hey thanks so much, all the other “solutions” on the web don’t work. Thanks so much!

    I am using Xubuntu 15.05 and I needed to do the following

    Volume Control –> Configuration

    Here, I had to set the Profile to “High Fidelity Playback (A2DP)” for my BT speaker box.

    Thanks again, you rock!

  5. I had same problem, now works perfectly. I have Ubuntu Studio 14.04 LTS. But I didn’t kill pulseaudio at all, only started from number 1.

  6. Hey, thanks for the detailed instructions, I followed them.. still it doen’t work unfortunatley. My Bluetooth Speaker is connected and all, but Sound is still coming through the built in speakers.
    When I try “pactl load-module module-bluetooth-discover” the initialzing fails.. I’m kind of desperate after hours of trying… any suggestions? Thank you anyway..

  7. My bluetooth speaker was connected for a while, but then it cut out and suddenly I am not longer able to get it to work. I can connect it using the blueman-applet, but the audio sink fails. If is pulseaudio -k the audio sink works, but then no sound comes out at all. I tried going to /etc/bluetooth/audio.conf to uncomment AutoConnect=true but I couldn’t find it there. Would you posting a screen shot of your terminal window while you’re editing the conf?

    Thanks

    1. Here’s the full conf:

      # Configuration file for the audio service
      
      # This section contains options which are not specific to any
      # particular interface
      [General]
      
      # Switch to master role for incoming connections (defaults to true)
      #Master=true
      
      # If we want to disable support for specific services
      # Defaults to supporting all implemented services
      #Disable=Gateway,Source,Socket
      
      # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
      # Defaults to HCI
      #SCORouting=PCM
      
      # Automatically connect both A2DP and HFP/HSP profiles for incoming
      # connections. Some headsets that support both profiles will only connect the
      # other one automatically so the default setting of true is usually a good
      # idea.
      AutoConnect=true
      
      # Headset interface specific options (i.e. options which affect how the audio
      # service interacts with remote headset devices)
      [Headset]
      
      # Set to true to support HFP, false means only HSP is supported
      # Defaults to true
      HFP=true
      
      # Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
      MaxConnected=1
      
      # Set to true to enable use of fast connectable mode (faster page scanning)
      # for HFP when incoming call starts. Default settings are restored after
      # call is answered or rejected. Page scan interval is much shorter and page
      # scan type changed to interlaced. Such allows faster connection initiated
      # by a headset.
      FastConnectable=false
      
      # Just an example of potential config options for the other interfaces
      #[A2DP]
      #SBCSources=1
      #MPEG12Sources=0
      
  8. Thanks for that, I found the line in the config and uncommented it. Unfortunately I went through the whole procedure step for step and it still doesn’t seem to be working (unless I’m missing something really obvious).

    As it is now, blueman is saying that my headset is successfully added but fails to connect. The odd thing is that if I remove the headset and then go back through the “set up new device” procedure, the audio sink works (i.e. I get the message: “Device added and connected successfully”), but then when I play music it just plays through the laptop speakers.

    Perhaps the issue is to do with pairing? When I get to that section in the setup wizard I skip the pairing, because it just says “pairing device” forever, and doesn’t seem to be progressing.

    Any ideas? Like I said it was working earlier this morning, but then the headset lost power so I had to charge it for a while. After charging I reconnected and from then on it won’t connect.

    Thanks for your help.

    1. Can’t hint much without touching the hardware. In my experience the bluetooth issue is a very hardware and setup specific one. Going through the comments in this article might be of help. Few readers faced similar issues and solved them with additional steps. If nothing helps, please raise a bug on blueman. They should be able to move it to the right component.

      1. Hey I fixed it! Simple solution but I’m not too savvy so I didn’t think to look for it. I followed these two steps:

        * Open Puleseaudio volume control (pavucontrol), browse to “configuration” , use the dropdown to turn the Built-in audio profile “off”
        * use the other dropdown to set the bluetooth device to use A2DP

        Seems so obvious when I finally found it. Anyway, I appreciate your help, so thanks!

  9. Thanks so much, for me your solution worked!! This problem haunted me for so long now. Every Ubuntu I tried since 2 years or so had the same problem. Now I finally have BT Sound! You’re really great, and I think you should propose your solution to the maintainers if you didn’t try already!
    What might be of interest is that in Linux Mint 17.x, BT sound always worked out of the box. Obviously somebody there took care about that…

    Thanks again

    Ansgar

  10. Brilliant! Many thanks.
    It was peeing me off that any android smart phone could connect to my BT speakers & NAS from anywhere in the world but my Linux mint Couldn’t.
    Now to fix the network access!!

  11. Followed when I had “Connection Failed: Stream setup failed” return from trying to establish A2DP connection on my paired Motorola S10-HD on a Toshiba laptop running Linux Mint 17.3 Rosa 64-bit. I was able to successfully re-pair the S10-HD and connect it as A2DP. It then made an appearance in the selections presented in Sound Preferences Output tab and I was able to play stereo sound through the headset once it was selected.
    The side effect noticed so far is the disappearance of the speaker volume controls from the launch bar. The volume control is functional in the sound applications used and through Sound Preferences so not a big issue, but it would be nice to track down why.

    1. I guess there is some issue between volume control and bluetooth A2DP. But didn’t dig much into that. Would love to see how it works in 16.04, the next LTS.

  12. Worked for me on my Asus Zenbook Prime UX31A running Ubuntu 14.04, while several other suggested solutions did not. Thanks, friend!

  13. I can’t believe my bluetooth headset is finally working on Ubuntu! This is perfect.
    * Although after restart something happened with the boot and i got the error “Secure boot violation”. Anyway, I managed to get to the UEFI menu from Windows and disable secure boot. Now everything works just fine. Thanks!

      1. Yes, it shouldn’t! That’s probably because when I ran “sudo apt-get upgrade blueman”, it updated many other modules as well, I don’t know why.

        1. Bad news 🙁
          Bluetooth stopped working completely. When I choose Turn bluetooth on from Bluetooth Manager, its icon disappears and nothing happens. Opening the standard bluetooth menu I can turn bluetooth on but I can’t connect to anything, and opening bluetooth manager gives me a blank screen with no devices and only the option to “Activate” the Adapter or Devices which does nothing.

Leave a Reply

Your email address will not be published. Required fields are marked *