Categories: TutorialsUbuntu

How to use Bluetooth Headset on Ubuntu 20.04

By Simon Zambrovski, As more users switch to Linux for their daily computing needs, seamless remote communication has become essential. However, some users encounter challenges when trying to use Bluetooth headsets for conferencing.

Specifically, the current version of PulseAudio faces an issue with supporting Bluetooth headsets in both the A2DP profile (headphone mode with disabled microphone) and the HSP/HFP profile (lower headphone quality but with an enabled microphone). In this article, we explore potential solutions to address this issue and enhance the usability of Bluetooth headsets on Linux systems.

Steps
Sponsored
to Enable Hands-Free Mode for Your Headset:

  1. Install Ofono
  2. Configure PulseAudio
  3. Set Up ofono-phonesim
  4. Configure Services Autostarts

1 Install Ofono : Open your console and run the following command:
sudo apt install ofono

2 Configure PulseAudio:

: In the file /etc/pulse/default.pa, locate the section where module-bluetooth-discover is loaded. Modify it as follows:

.ifexists module-bluetooth-discover.so

load-module module-bluetooth-discover headset=ofono

.endif

Execute the following command to add the user “pulse” to the “bluetooth” group:
sudo usermod -aG bluetooth pulse

Grant Permissions for ofono: Edit the file /etc/dbus-1/system.d/ofono.conf and add the following block as the last policy:

Read: How to manage sounds using PulseAudio on Ubuntu 18.04

3 Set Up ofono-phonesim

Install ofono-phonesim by running the following command:
sudo apt install ofono-phonesim

To create a virtual modem, create a new file named /etc/ofono/phonesim.conf with the following content:
[phonesim]

Driver=phonesim

Address=127.0.0.1

Port=12345

Feel free to choose a different port if you’re unable to use port 12345.

Manual mode

System Setup Completion: Your system setup is now complete for manual usage.

Start ofono-phonesim and Restart Bluetooth Stack: To use it, follow these steps:

Start ofono-phonesim by running the command:
ofono-phonesim -p 12345 /usr/share/phonesim/default.xml &
sudo service ofono restart
sudo service bluetooth restart

Test the Phonesim Modem: As a test, run the command:
/usr/share/ofono/scripts/list-modems

You should see the phonesim modem initialized.

Configure Bluetooth Settings: Open your Bluetooth settings (you can use Blueman or the built-in Ubuntu settings). Connect your Bluetooth device and switch it to the HSP/HFP profile.

Read: How to troubleshoot sound issues in Ubuntu 22.04

Setup automation

System Setup Completion: If your manual mode is functioning correctly, you’re almost there. However, manually executing the steps each time can be tedious. Let’s optimize your system startup to streamline this process.

Creating a systemd Unit File for Phonesim: To automatically start Phonesim when your system boots up, follow these steps:

  • Create a new file named phonesim.service in the directory /etc/systemd/system/.
  • Add the following content to the phonesim.service file:

Sponsored

Read: How to display your sound card details using the terminal on Ubuntu 22.04

Adjusting Port Settings: If you’ve modified the port in your modem definition, ensure that you update it accordingly.

Also, verify that the line containing ExecStart is correctly formatted.

Configuring ofono Service: To establish a dependency between ofono.service and phonesim.service, follow these steps:

Copy the original unit definition for ofono.service to /etc/systemd/system/ofono.service.

Modify the content of the copied file to:

Create the Unit File for Phonesim Modem:

Create a new unit file named /etc/systemd/system/ofono-modem.service.

Add the following content to the ofono-modem.service file:
[Unit]

Description=Enables Phonesim Modem

After=ofono.service

Requires=ofono.service

[Service]

Type=oneshot

ExecStart=/usr/share/ofono/scripts/enable-modem /phonesim

[Install]

WantedBy=multi-user.target

This service will run just after ofono.service and enable our modem during system boot.

Activate the Services on Boot:

Reload your systemd configuration and enable them by executing:

sudo systemctl daemon-reload

sudo systemctl enable phonesim

sudo systemctl enable ofono

sudo systemctl enable ofono-modem

Finally, reboot your system.

After the reboot, verify if the modem is directly connected by running the command: /usr/share/ofono/scripts/list-modems.

You should observe output similar to the following:

 

The post How to use Bluetooth Headset on Ubuntu 20.04 appeared first on net2.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

3 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

4 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

4 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

5 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

5 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago