<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jack Millner</title>
    <description>The latest articles on DEV Community by Jack Millner (@campbelljones74).</description>
    <link>https://dev.to/campbelljones74</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F481806%2F76dc8d98-fb59-446e-baad-ff4532928180.jpg</url>
      <title>DEV Community: Jack Millner</title>
      <link>https://dev.to/campbelljones74</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/campbelljones74"/>
    <language>en</language>
    <item>
      <title>Common Bluetooth Problems in Ubuntu and How to Fix Them</title>
      <dc:creator>Jack Millner</dc:creator>
      <pubDate>Mon, 05 Oct 2020 21:49:15 +0000</pubDate>
      <link>https://dev.to/campbelljones74/common-bluetooth-problems-in-ubuntu-and-how-to-fix-them-18b5</link>
      <guid>https://dev.to/campbelljones74/common-bluetooth-problems-in-ubuntu-and-how-to-fix-them-18b5</guid>
      <description>&lt;p&gt;From time to time when you are using Ubuntu Linux and you want to use your Bluetooth headset to watch Netflix or YouTube videos you may experience some problems with the Bluetooth connection on Linux.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.zdnet.com/article/hands-on-using-bluetooth-on-linux/" rel="noopener noreferrer"&gt;Bluetooth in Linux&lt;/a&gt; functions thanks to the interaction of different modules like the Linux kernel, the drivers, client apps, pulseaudio and Bluez. To learn more about Bluetooth please refer to &lt;a href="https://www.audioreputation.com/bluetooth-audio-codecs/" rel="noopener noreferrer"&gt;this article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem #1 Bluetooth isn’t available when you wake up the system&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you put your system to sleep, there are chances Bluetooth won’t be available when you wake it up. In order to make everything work fine as before in most cases you will need to restart the system. &lt;/p&gt;

&lt;p&gt;On the other hand, sometimes you will need to disconnect the device and pair it up again with your system. &lt;/p&gt;

&lt;p&gt;One of the main reasons for such behavior was a bug in the Bluez version 4.48. The bug was responsible for the situation described above and other common actions like connecting, disconnecting and pairing. Luckily. Most bugs including this one were fixed in the next versions of Bluez.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick Fix&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In order to fix this issue, we need to launch the Terminal and check whether we have the 4.48 version of Bluez. You can easily do that with this command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 --status bluez | grep '^Version:'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;When you see the results, use the following commands to update to the latest version:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 add-apt-repository ppa:bluetooth/bluez
sudo apt-get update

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After these commands, you will be able to update the Buez using:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 apt upgrade

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;A new version of Bluez will provide better behavior during the actions mentioned above and you should still have access to your Bluetooth connection when you wake up the system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem #2 Bluetooth headset won’t play in A2DP (High Fidelity)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick Fix&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In order to fix this issue, you will need to make your system detect the right type of Bluetooth device by adding a simple configuration file. &lt;/p&gt;

&lt;p&gt;First, let’s check whether we have all the dependencies installed:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 apt install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;When we verify it, we need to create or edit this audio config file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 gedit /etc/bluetooth/audio.conf

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Include the next lines:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 section contains general options
    [General]
    Enable=Source,Sink,Media,Socket

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now it’s time to save the file and start the Bluetooth service again.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 service bluetooth restart

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You are good to go. Now you will be able to listen to your Bluetooth audio at a2dp (high fidelity) mode. Enjoy!&lt;/p&gt;

&lt;p&gt;Problem #3 After automatic pairing when the system booths Bluetooth won’t play sounds in Bluetooth headset &lt;/p&gt;

&lt;p&gt;In most cases the first thing we do after we boot up our system is turning on the Bluetooth headset. Sometimes the system and the device pair up well but no sound. If you use the command &lt;strong&gt;journalctl -f&lt;/strong&gt; you will receive the next message:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 [pulseaudio] module-bluez5-device.c: Profile a2dp_sink has no transport
pulseaudio[1148]: [pulseaudio] module-bluez5-device.c: Refused to switch profile to a2dp_sink: Not connected

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Connecting the device again will usually resolve the issue, but this isn’t something we would like to do often. The reason for that is that the Bluetooth device must work immediately after the system boots up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick Fix&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the solutions is to press the Play/Pause button after you pair the system and the device. This will make the gnome sound manager have the A2DP available. With this option on you can easily set the audio output in the menu. Although this solution isn’t ideal, it does the job. &lt;/p&gt;

&lt;p&gt;To make the process easier you can add a shortcut to set this output when the pairing completes and the Play/Pause button is pressed. Here is the command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 .bashrcThen add the following line at the end:
alias soundon = 'pacmd set-card-profile device_name a2dp_sink'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Please note that you can replace the &lt;strong&gt;“Device_name”&lt;/strong&gt;. Once the pairing completes you can identify your device with this command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 list-cards

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This will appear as a result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fz498dq5wvcpexfkz5g2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fz498dq5wvcpexfkz5g2f.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see the device is identified as &lt;strong&gt;“bluez_card.00_16_94_0B_5F_DE”&lt;/strong&gt;. So, you need to replace the &lt;strong&gt;device_name&lt;/strong&gt; with &lt;strong&gt;bluez_card.00_16_94_0B_5F_DE&lt;/strong&gt;. This is just an example, replace the device name with the result you receive after you use the command.&lt;/p&gt;

</description>
      <category>bluetooth</category>
      <category>ubuntu</category>
      <category>problems</category>
    </item>
  </channel>
</rss>
