After updating to 16.04, bluetooth audio A2DP mode stopped working

Solution 1:

What works for me is to connect the bluetooth device, switch to HSP/HFP mode, disconnect, reconnect and then switch to A2DP mode.

Solution 2:

There are several bugs opened about this, check for example this one (started in 15.05) and this other one, quite older; the causes in general are not well understood.

Before starting modifying system files, you can also check Bluetooth speaker no sound in Ubuntu 16.04 (seems a different bug) and A2DP bluetooth doesn't work on 16.04 (solved in comments by a kernel upgrade).

The fix that worked for me is the following --- thanks to user RobertFM in launchpad and SimFox3 in Arch forums. All the following instructions must be executed from a root shell (sudo -i). Take care and triple check.

  1. First of all, make a backup of these files (you never know):

    cp /etc/bluetooth/audio.conf /etc/bluetooth/audio.conf.bak
    cp /etc/pulse/default.pa /etc/pulse/default.pa.bak
    cp /usr/bin/start-pulseaudio-x11 /usr/bin/start-pulseaudio-x11.bak
    
  2. Edit /etc/bluetooth/audio.conf and make it similar to this one:

    # Configuration file for the audio service
    # This section contains options which are not specific to any
    # particular interface
    [General]
    Enable=Gateway,Source
    
    # 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
    Disable=Socket
    
    # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
    # Defaults to HCI
    #SCORouting=HCI
    
    # 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=2
    
    # 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=true
    
    # Just an example of potential config options for the other interfaces
    #[A2DP]
    #SBCSources=1
    #MPEG12Sources=0
    
  3. Edit /etc/pulse/default.pa and comment out the line

    #load-module module-bluetooth-discover
    

    (you really only need to add the # at the start)

  4. Edit /usr/bin/start-pulseaudio-x11 and add the line /usr/bin/pactl load-module module-bluetooth-discover after the loading of the module module-x11-xsmp; in practice you should edit the file near the end to have a stanza like

    if [ x"$SESSION_MANAGER" != x ] ; then
        /usr/bin/pactl load-module module-x11-xsmp "display=$DISPLAY session_manager=$SESSION_MANAGER" > /dev/null
        # add this line here:
        /usr/bin/pactl load-module module-bluetooth-discover
    fi
    
  5. Reboot.

    Now you should be able to set your device to A2DP and enjoy high quality music:

    Sound settings

    Notice that sometime you need to Disconnect and Reconnect your device to re-enable A2DP:

    Bluetooth devices

    ...yes, it's a can of bugs. But when it works it works beautifully.

  6. Troubles after reboot

    After all of this, sometime the trick seems to work just only after the next reboot. In such a case, try to follow rmfought's answer:

    What works for me is to connect the bluetooth device, switch to HSP/HFP mode, disconnect, reconnect and then switch to A2DP mode.

    ...works for me too (again, sometime). I had to even un-pair a re-pair the dongle once.

  7. If it still doesn't work...

    If this also isn't working for you, you can try with this script --- its author is keeping it up-to-date.

Solution 3:

This is not necessarily a solution for those who need the mic, but this worked in Ubuntu 16.04 for me:

sudo nano /etc/bluetooth/audio.conf

And then add Disable=Headset under [General].

[General]
Disable=Headset

And restart the bluetooth service

sudo service bluetooth restart

And all the creds to this guy: https://jimshaver.net/2015/03/31/going-a2dp-only-on-linux/