5

Today I installed Ubuntu 18.04 x64 LTS on a Dell Latitude E6410i with Windows 7 pre-installed. I connected to my new JBL Flip4 speaker with Bluetooth 4.2 and with A2DP V1.3, AVRCP V1.6, HFP V1.6, and HSP V1.2, and paired it successfully.

I want to auto-connect to the speaker at login; it should connect every time I login to Ubuntu, but does not.

After study, I found suggestions on the web (like Autoconnect to a bluetooth speaker in Ubuntu 16.04), but I can't find rc.local in my system. Also, I installed bt-autoconnect which does not help.

How should I proceed to resolve this?

0
1

Work Around

Note:
Below Procedure Tested with my JBL Xtreme
OS: Ubuntu 18.04

at your present Situation that is you have already paired your BT device and while booting your BT device is On,

after login try this..

  1. Open Terminal and run bluetoothctl

  2. The Output will be similar to this

Output:

pratap@i7-4770:~$ bluetoothctl
[NEW] Controller xx:xx:xx:xx:xx:xx i7-4770 [default]
[NEW] Device aa:bb:cc:dd:ee:ff JBL Xtreme
[NEW] Device xx:xx:xx:xx:xx:xx HUAWEI P smart
Agent registered
[bluetooth]# 
  1. In above case "JBL Xtreme" Bluetooth Device is Paired but not yet connected.. So to connect to this device

run connect aa:bb:cc:dd:ee:ff at the prompt [bluetooth]#

Example:

[bluetooth]# connect aa:bb:cc:dd:ee:ff
Attempting to connect to aa:bb:cc:dd:ee:ff
[CHG] Device aa:bb:cc:dd:ee:ff Connected: yes
Connection successful
[CHG] Device aa:bb:cc:dd:ee:ff ServicesResolved: yes
[JBL Xtreme]#

This Means if you can run the command bluetoothctl and then at the [bluetooth]# prompt if you can input connect aa:bb:cc:dd:ee:ff The Bluetooth Device will connect.

So this can be done with a single command in terminal like this, after your first login open Terminal and run this command.

echo "connect aa:bb:cc:dd:ee:ff" | bluetoothctl

Example:

pratap@i7-4770:~$ echo "connect aa:bb:cc:dd:ee:ff" | bluetoothctl
[NEW] Controller xx:xx:xx:xx:xx:xx i7-4770 [default]
[NEW] Device aa:bb:cc:dd:ee:ff JBL Xtreme
[NEW] Device xx:xx:xx:xx:xx:xx HUAWEI P smart
Agent registered
[bluetooth]# connect aa:bb:cc:dd:ee:ff
Attempting to connect to aa:bb:cc:dd:ee:ff
Agent unregistered
[DEL] Controller xx:xx:xx:xx:xx:xx i7-4770 [default]
pratap@i7-4770:~$

so the command echo "connect aa:bb:cc:dd:ee:ff" | bluetoothctl is working..

This means if we can run this command at login without human interaction.. the Bluetooth Device which is Paired and already Turned on at the time of Boot will connect in the above manual way..


  1. mkdir ~/bin (Create this directory if you dont have already.. Otherwise Ignore this step)

  2. touch ~/bin/btautoconnect.sh

  3. gedit ~/bin/btautoconnect.sh

Paste the Below Content:

#!/bin/bash

bluetoothctl
sleep 10
echo "connect aa:bb:cc:dd:ee:ff" | bluetoothctl
sleep 12
echo "connect aa:bb:cc:dd:ee:ff" | bluetoothctl
exit
  1. Save & Close the File.

  2. chmod +x ~/bin/btautoconnect.sh

create a .desktop file named btautoconnect.desktop in ~/.config/autostart/

  1. touch ~/.config/autostart/btautoconnect.desktop

Open the fiel with gedit and copy paste the content below this command

  1. gedit ~/.config/autostart/btautoconnect.desktop

Content:

[Desktop Entry]
Type=Application
Exec=/bin/bash /home/pratap/bin/btautoconnect.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=BTAutoConnect
X-GNOME-Autostart-Delay=5
Comment=Starts Bluetooth speaker
  1. Reboot to see the BT Device Connected after login in 10 to 20seconds.. without any Human Interaction..

Credits: https://ubuntuforums.org/showthread.php?t=2365083

2
  • Clean and easy. thank you so much, this solution worked like charm. – Netmoon Sep 6 '19 at 16:13
  • bluetoothctl connect xx:xx:xx:xx:xx:xx and remove step 6. – RichieHH Oct 21 '19 at 8:38
0

In Ubuntu sound-problems are due to installed drivers. If this speaker is the newest and most trendiest hardware, you have no good chances and would have to wait 2 to 8 months until driver is present at Linux Community. But you could try to install following packages in terminal :

sudo apt-get install amarok rhythmbox

reboot

Then switch on bluetooth and see if your speaker is supported :

  • Open the Activities overview and start typing Bluetooth.
  • Click on Bluetooth to open the panel.
  • Set the switch at the top to ON.

Good luck or be patient for at maximum 8 months.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.