In this guide, we will walk you through the steps to solve Bluetooth connectivity on Ubuntu 22.04 issues step by step. Whether you’re struggling to pair your devices, experiencing problems connecting, or dealing with annoying disconnections, we’ll share some troubleshooting techniques that will help you fix common Bluetooth issues on your Ubuntu system.
Turning on the Bluetooth Feature
In Ubuntu Linux, there is a Bluetooth service that runs in the background to ensure that your Bluetooth system works perfectly. Here is how you can check whether the Bluetooth service is running.
sudo systemctl status bluetooth.service
Ubuntu bluetooth not working
As you can see from the snapshot above, the bluetooth service is currently inactive. If Bluetooth is turned off for some reason, it won’t work until you turn it on. You’ll want to make sure it’s set to start automatically every time your system boots up. Luckily, this is easy to do with the command below:
sudo systemctl enable bluetooth.service
Once you’ve turned on the Bluetooth feature, you’ll need to start the service again using systemctl. This can be done by executing the command below :
sudo systemctl start bluetooth.service
Read: How to set up Bluetooth on Ubuntu 18.04
If the previous steps did not resolve the issue, it’s possible that the Bluetooth connection has been interrupted and needs to be restarted. To do so, follow the steps below.
Begin by restarting Bluetooth with the command:
sudo service bluetooth restart
Now that we have completed the previous step, we can proceed by running the command to load the modules from the kernel, which is:
sudo rmmod btusb
If you receive an error saying that the module is not loaded (“modprobe: ERROR: could not insert ‘btusb’: Exec format error”), make sure first to find which folder contains the bluetooth directory.
In my case, it was the folder “5.19.0-32-generic”:
Read: How to fix Wifi issues on Ubuntu 22.04 – A complete guide
Then, run :
cd kernel
Next, execute the following commands:
- sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) clean
- sudo cp /usr/src/linux-headers-$(uname -r)/.config ./
- sudo cp /usr/src/linux-headers-$(uname -r)/Module.symvers Module.symvers
- sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
- sudo cp btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth
- sudo modprobe -r btusb
- sudo modprobe -v btusb
If now, you try again the previous command .i.e.:
sudo rmmod btusb
You will likely succeed.
As you can see in the snapshot below, our Bluetooth is up and running after it was inactive:
Try again to run the command:
sudo systemctl start bluetooth.service
Read: How to speed up Linux
Setting up Bluetooth on Ubuntu
In Ubuntu 22.04, you can find most of the Bluetooth configurations in the /etc/bluetooth/main.conf file. There are a handful of parameters you’ll want to set up in this file. You can open it using any text editor you prefer, but we’ll be using nano for the purposes of this guide.
sudo nano /etc/bluetooth/main.conf
which will open up the file below:
Automatically Turn On Bluetooth
Before you wrap up your Bluetooth configuration, make sure the AutoEnable setting at the very bottom of the file is set to true and not commented out, as shown in the snapshot above. Remember, any line that starts with a # is a comment, so if you want to activate a line, you’ll need to delete the # at the beginning.
Enabling the AutoEnable configuration ensures that the Bluetooth feature is turned on automatically every time you boot up your device. Moreover, this configuration enables your Bluetooth adapter to detect and pair with newly connected Bluetooth devices in your vicinity.
Read: How to fix Ubuntu update errors
Turn on Fast Connect
To speed up the process of connecting Bluetooth devices to your computer after a reboot or hibernation, it’s recommended that you enable the FastConnectable configuration by setting it to true. This will make it easier for Bluetooth devices to connect to your PC.
To utilize the FastConnectable function, your computer’s kernel must be version 4.1 or later. However, it is essential to note that using this feature may result in more power consumption on your device.
Turn on Automatic Reconnection
To save yourself the trouble of manually reconnecting your computer and Bluetooth devices, you can configure your Bluetooth stack to automatically attempt reconnection whenever the connection is lost. To enable this feature, you just need to remove the ‘#’ symbol to uncomment the line that says ReconnectAttempts=7 in the configuration file. After enabling this feature, your Bluetooth service will automatically try to reconnect with all disconnected Bluetooth devices.
Performing a Bluetooth Stack reinstallation
If all else fails, you can resort to reinstalling Bluez which is the official Bluetooth protocol used on Ubuntu and other Linux distributions, like Kali and Debian. If you’re experiencing Bluetooth connection problems on those systems, using Bluez should solve the issue.
It’s possible that Bluez isn’t functioning correctly or needs to be updated. In this case, run the command :
sudo apt install bluez
Troubleshoot Bluetooth on Ubuntu
Once you’ve completed the re-installation of the Bluetooth stack, it’s essential to ensure that the Bluetooth service is up and running. To accomplish this, execute the following commands to activate and start the service :
sudo systemctl enable bluetooth.service
sudo systemctl start bluetooth.service
If you still have some issues, try updating your repositories and upgrading your system.
Read: Securing Ubuntu: Best Practices for Keeping Your System Safe
Conclusion
Experiencing Bluetooth connectivity problems on Ubuntu 22.04 can be a hassle, but there are easy fixes available. The steps discussed in this article, including reinstalling the Bluetooth stack and loading kernel modules, can help you overcome any obstacles you may face. It is crucial to keep your software updated to prevent any compatibility issues and to address any problems promptly. By implementing the tips and tricks provided in this article, you can ensure smooth Bluetooth connectivity on your Ubuntu 22.04 system.