Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save deebuls/36c7497be801bc6dd12de37bb0985c53 to your computer and use it in GitHub Desktop.

Select an option

Save deebuls/36c7497be801bc6dd12de37bb0985c53 to your computer and use it in GitHub Desktop.
[Ubuntu Blueman ERROR Fix] Failed to change profile to headset_head_unit

My earbuds SoundBuds Flow was connecting and audio working but microphone was not working.

It gets connected as A2DP audi sink, when you try to convert to Headset Head unit it gives the error "Failed to change profile to headset_head_unit".

The fix as per [1]

Install ofono:

sudo apt install ofono

Config pulseaudio to use ofono:

Goto /etc/pulse/default.pa find the line load-module module-bluetooth-discover and change it in load-module module-bluetooth-discover headset=ofono.
Add the user pulse to group bluetooth to grant the permission: sudo usermod -aG bluetooth pulse (probably it's already correct)
VERY IMPORTANT: To grant the permission, add this to /etc/dbus-1/system.d/ofono.conf (before </busconfig>):
Provide phonesim to ofono. In order to make ofono work, you have to provide a modem to it! You can install a modem emulator called phonesim (implemented by ofono) to make it work:

install ofono-phonesim (in some distros it is called phonesim). in Ubuntu 18.04
for Ubuntu 20.04
sudo add-apt-repository ppa:smoser/bluetooth

sudo apt-get update sudo apt-get install ofono-phonesim

sudo apt install ofono-phonesim

Configure phonesim by adding the following lines to /etc/ofono/phonesim.conf:

[phonesim] Driver=phonesim Address=127.0.0.1 Port=12345

Restart ofono:

sudo systemctl restart ofono.service

Start phonesim:

ofono-phonesim -p 12345 /usr/share/phonesim/default.xml

Note that the command can be phonesim. To make sure phonesim is started correctly you can clone the ofono repo and use their test scripts:

cd /tmp git clone git://git.kernel.org/pub/scm/network/ofono/ofono.git cd ofono/test ./list-modems

You should see the modem in the result. You might have to first enable the modem by executing enable-modem and online-modem scripts in the same directory.

Once the modem is enabled, you should be able to enable HFP profile.

4.autostart phonesim. Since you have executed phonesim manually, after every restart you should execute it again. Instead you can install ofono-phonesim-autostart which will start the phonesim as a service.

[1] https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment