Pair bluetooth in linux

How to Set Up Bluetooth in Linux

Set Up Bluetooth Linux 00 Featured Image

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.

Content

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.

After installing 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 Blueman client.

How to Install Bluez

Below are instructions on how to install Bluez on a few different distributions.

Debian and Ubuntu

With OpenSUSE, you have to install bluez with the Open Build Service.

sudo dnf install bluez bluez-tools
sudo pacman -S bluez bluez-utils

Set Up Bluetooth Linux 01 Install Bluez

Other Package Managers

Читайте также:  Поменять время linux консоль

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 zypper install blueman

Other Distributions

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.

Enable Bluetooth

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

Set Up Bluetooth Linux 02 Enable 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 Linux 03 Blueman Utility

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.

Set Up Bluetooth Linux 04 Gnome Desktop Ubuntu

  1. 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.

Set Up Bluetooth Linux 05 Gnome Bluetooth Menu

  1. 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.
Читайте также:  Dos commands and linux commands

Set Up Bluetooth Linux 06 Select Bluetooth Settings

  1. 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.

Set Up Bluetooth Linux 07 One Pairable Device

  1. 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.

Set Up Bluetooth Linux 08 Pairing Code

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.

Set Up Bluetooth Linux 09 Device Connected Gnome

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.

Set Up Bluetooth Linux 10 Kde Desktop

  1. 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.

Set Up Bluetooth Linux 11 Kde Bluetooth Menu

Set Up Bluetooth Linux 12 Kde Add New Device

  1. Plasma will start its Bluetooth discovery program and search for every active nearby device and will list all found devices in a small window.

Set Up Bluetooth Linux 13 Select Bluetooth Phone

  1. 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 Bluetooth Linux 14 Kde Pairing Code

Set Up Bluetooth Linux 15 Kde Paired 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.

Set Up Bluetooth Linux 16 Sample Terminal Screen

  1. Run the bluetoothctl program to load the Bluez CLI utility. This will change your prompt to [bluetooth]# .

Set Up Bluetooth Linux 17 Bluetoothctl Loaded

  1. Tell the transmitter to scan for any active Bluetooth device in the area by running these two commands:
  1. 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:

Set Up Bluetooth Linux 18 Bluetoothctl List Devices

  1. 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.

Читайте также:  Can linux boot extended partition

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

Ramces is a technology writer that lived with computers all his life. A prolific reader and a student of Anthropology, he is an eccentric character that writes articles about Linux and anything *nix.

Our latest tutorials delivered straight to your inbox

Источник

Оцените статью
Adblock
detector