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?


2 Answers 2


Work Around

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


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
  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]#


[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


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]

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 don't have already.. Otherwise Ignore this step)

  2. touch ~/bin/btautoconnect.sh

  3. gedit ~/bin/btautoconnect.sh

Paste the Below Content:


sleep 10
echo "connect aa:bb:cc:dd:ee:ff" | bluetoothctl
sleep 12
echo "connect aa:bb:cc:dd:ee:ff" | bluetoothctl
  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 file with gedit and copy paste the content below this command

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


[Desktop Entry]
Exec=/bin/bash /home/pratap/bin/btautoconnect.sh
Comment=Starts Bluetooth speaker
  1. Reboot to see the BT Device Connected after login in 10 to 20 seconds.. without any Human Interaction..

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

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

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


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .