With the increasing prevalence of Bluetooth peripherals such as mice, keyboards, and headsets, it can be difficult to imagine using the wired versions of these devices sometimes. On some Linux distributions, Bluetooth is set up perfectly for you straight out of the box. Distributions like Ubuntu and Elementary make it easy for you to get Bluetooth set up and working on your machine. However, other distributions like Fedora and Arch Linux require you to do some setup before you’re able to fully enjoy the benefits of Bluetooth on your machine. Here is how you can set up Bluetooth in Linux.
How to Set Up Bluetooth on Your Linux Machine
The steps will vary a little across distributions, but the basic steps are the same. If your distribution doesn’t already have Bluetooth set up for you, you will first need to install
Bluez, which contains the driver stack for Bluetooth adapters as well as utilities for the CLI administration of Bluetooth.
Bluez, you may need to install a Bluetooth manager. Some desktop environments have built-in Bluetooth managers. For example, KDE Plasma has the KDE Bluetooth client. Gnome also has a built-in client. If you are using a desktop environment that doesn’t have a built-in client, you can install the
How to Install Bluez
Below are instructions on how to install Bluez on a few different distributions.
Debian and Ubuntu
sudo apt install bluez*
With OpenSUSE, you have to install bluez with the Open Build Service.
sudo dnf install bluez bluez-tools
sudo pacman -S bluez bluez-utils
Other Package Managers
Bluez works with all Linux distributions. If you have a different package manager than the distributions above, have no fear. You will just need to search for bluez in your package manager, then install everything that includes the term bluez.
How to Install Blueman
Find out how to install Blueman on various Linux distributions below.
Debian and Ubuntu
sudo apt install blueman
sudo zypper install blueman
sudo dnf install blueman
sudo pacman -S blueman
To install Blueman on your Linux distributions, you should search the package manager in the distribution being used for Blueman, then install all of the relevant packages.
After installation, you will need to activate and start the Bluetooth service. If you are using a Bluetooth dongle, you will first have to run the following command:
To enable the Bluetooth service, run the following command:
sudo systemctl enable bluetooth.service
To start the Bluetooth service, use this command:
sudo systemctl start bluetooth.service
After doing this, you’ll be able to start using Bluetooth on your system.
Connect to Devices Using Blueman
The connection process will vary depending on the desktop manager you’re using. However, we show how it’s done using Blueman since it’s fairly representative of the process across the board.
To connect to a device, open “Bluetooth Manager” in your applications and hit search. Make sure that the device you want to connect to is discoverable. When you see it in the device list, right-click on it and hit “Connect.” You may have to enter a passcode, but this information will be in the user’s manual of your device.
Set up Bluetooth Devices in GNOME Linux
Gnome comes with Bluetooth support from the start, and you can easily set up Bluetooth devices without installing any other tools.
- Click on the status icons on the top-right corner of your screen. Doing this will bring up a small menu where you can choose how your machine connects to the network.
- Click on the “Bluetooth” entry to bring up a drop-down menu where you can choose to toggle Bluetooth or access the appropriate settings for it. Choose to access the Settings.
- The Bluetooth Settings window will display all the devices that you can connect to. In this example, I can select my phone to pair it with my machine.
- GNOME will display a window showing a six-digit PIN that you need to match with your device to ensure that you are pairing the right devices together.
One important thing to note, however, is that the six-digit PIN will only show up on non-peripheral devices, as GNOME will automatically pair with any Bluetooth keyboard and headphones.
Connect to Bluetooth Devices in KDE Plasma
It is also possible to set up Bluetooth out of the box through the Plasma desktop in Linux.
- Click the Bluetooth icon in the lower-left corner of your screen to bring up a small menu where you can configure how Bluetooth works in your machine.
- Click the “+ Add New Device…” button in the middle of the window.
- Plasma will start its Bluetooth discovery program and search for every active nearby device and will list all found devices in a small window.
- Select your device and press “Next” to start the Bluetooth pairing process. Plasma will display a small window with a six-digit PIN that you need to match with your device.
Set Up the Bluetooth CLI Utility in Linux
It is also possible to connect a device through a dedicated Bluetooth CLI utility, a program that comes with Bluez that allows you to pair and control devices straight from your command line. It can be especially useful for devices that do not have a display, such as Raspberry Pi.
- Run the
bluetoothctlprogram to load the Bluez CLI utility. This will change your prompt to
- Start the internal Bluetooth transmitter by powering it on:
- Tell the transmitter to scan for any active Bluetooth device in the area by running these two commands:
scan on agent on
- Look for the device you want to pair with your computer by telling the transmitter to list all the devices that it detected during the scan:
- Use the MAC address of your device to pair it with your computer by running these two commands:
pair [MAC address] connect [MAC address]
One important thing to note, however, is that unlike the methods described above you need to type the PIN displayed on the device.
Frequently Asked Questions
I have a Bluetooth USB Dongle that cannot pair with any device. Is my computer broken?
No! This is most probably due to either incompatible or unsupported hardware. While Linux supports most Bluetooth devices, there are still some generic models that will not work under Linux. One way to deal with this issue is to use receivers that have chips that you know will work.
How can I set up my phone through Bluetooth if it does not recognize my Linux machine?
By default, your phone should be able to see your Linux machine if you have Bluetooth enabled on both devices. One reason your phone will not see your Linux machine may be that it is not discoverable.
One way to fix this is by telling
bluetoothctl to force your computer to be discoverable by running the following command:
sudo bluetoothctl discoverable on.
Is it possible to fix the audio skipping with Bluetooth headphones?
Yes! To fix this, make sure that the Bluetooth receiver is the only device in a particular USB bus. For example, you should not plug the headphones receiver into a USB hub, as it will share the same data line with other USB devices.
This is partly due to how Linux manages data through USB, as well as how PulseAudio interprets that same data. Some USB peripherals such as mice and keyboards tend to crowd the USB bus, leaving the audio receiver waiting for those peripherals to finish which, in turn, stutters the audio.
Image credit: Unsplash, altered by Ramces Red. All screenshots by Ramces Red
Our latest tutorials delivered straight to your inbox