Autoconnect to a bluetooth speaker in Ubuntu 16.04

BT is enabled at startup. This is nice. But it will not autopair/connect to a device, even if it is once paired and get status "trusted". I can connect to a Speaker with the tool by selecting device, and "connect to audio output". How can this done automatically on boot? I can do this also with "bluetoothctl" and than "connect ", but this is interactive, seems not scriptable.

And second step is, that BT becomes default audio sink.
Isn't that all an ordinary use case?

(I found some pages here, most are outdated.) Autoconnecting Bluetooth Devices: load-module module-switch-on-connect doesn't work for me.

I also installed bt-autoconnect. But several issues: - it didn't foun the BT-Adapter - Button Audio-Setting does just nothing - Save and quit doesn't just nothing


Try bluetoothctl command.

If you then enter help, you'll see the commands to be used.

  • 'list' (devices)
  • 'trust 78:44:aa:bb:cc:dd' (MAC address of device)
  • 'info 78:44:aa:bb:cc:dd' (MAC address of device)
  • 'paired-devices'

Try, it worked for me.


For automatic connect to Audio Sink you can add the following line in /etc/rc.local:

(sleep 6; echo "connect AA:BB:CC:DD:EE:FF\nquit" | bluetoothctl) &

Update the address. You can verify from command line by:

echo -e "devices\nquit" | bluetoothctl

In my case sleep 6 is enough - but maybe on your computer it has to be increased to allow other bluetooth connection steps to be fully completed.

Generally with & sign at the end you will start process which will be executed in 6sec not blocking next processes starting normal bluetooth connection functions. If the rc.local is not existing (it was in my case) you can create it or to initiate at startup with other file.