Bluetooth on Ubuntu 18.04 server (used as desktop) on Dell Precision 5530

First install required packages:

sudo apt install bluetooth bluez bluez-tools rfkill pulseaudio-module-bluetooth

Reboot

Use bluetoothctl to scan, pair and connect to BT devices:

jonas@octo:~$ bluetoothctl 
[NEW] Controller 48:F1:7F:56:BB:6A octo [default]
Agent registered
[bluetooth]# agent on

Scan

[bluetooth]# scan on
Discovery started
[CHG] Controller 48:F1:7F:56:BB:6A Discovering: yes
[NEW] Device FC:A8:9A:EF:A6:E4 Swedish flag

Pair

[bluetooth]# pair FC:A8:9A:EF:A6:E4
Attempting to pair with FC:A8:9A:EF:A6:E4
[CHG] Device FC:A8:9A:EF:A6:E4 Connected: yes
[CHG] Device FC:A8:9A:EF:A6:E4 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device FC:A8:9A:EF:A6:E4 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device FC:A8:9A:EF:A6:E4 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device FC:A8:9A:EF:A6:E4 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device FC:A8:9A:EF:A6:E4 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:A8:9A:EF:A6:E4 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:A8:9A:EF:A6:E4 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device FC:A8:9A:EF:A6:E4 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device FC:A8:9A:EF:A6:E4 ServicesResolved: yes
[CHG] Device FC:A8:9A:EF:A6:E4 Paired: yes
Pairing successful
[CHG] Device FC:A8:9A:EF:A6:E4 ServicesResolved: no
[CHG] Device FC:A8:9A:EF:A6:E4 Connected: no

List paired devices:

[bluetooth]# devices
Device FC:A8:9A:EF:A6:E4 Swedish flag
[CHG] Device FC:A8:9A:EF:A6:E4 RSSI: -53
[CHG] Device FC:A8:9A:EF:A6:E4 ManufacturerData Key: 0x0057
[CHG] Device FC:A8:9A:EF:A6:E4 ManufacturerData Value:
  53 00 23 00 11 00 00                             S.#....         
[CHG] Device FC:A8:9A:EF:A6:E4 Appearance is nil

Connect to BT device:

[bluetooth]# connect FC:A8:9A:EF:A6:E4
Attempting to connect to FC:A8:9A:EF:A6:E4
[CHG] Device FC:A8:9A:EF:A6:E4 Connected: yes
Connection successful
[CHG] Device FC:A8:9A:EF:A6:E4 ServicesResolved: yes

Stop the device scan:

[Swedish flag]# scan off
Discovery stopped
[CHG] Controller 48:F1:7F:56:BB:6A Discovering: no
[CHG] Device FC:A8:9A:EF:A6:E4 TxPower is nil
[CHG] Device FC:A8:9A:EF:A6:E4 RSSI is nil

Exit bluetoothctl:

[Swedish flag]# exit
Agent unregistered
[DEL] Controller 48:F1:7F:56:BB:6A octo [default]

Troubleshooting

This is an addition to the original post. I recently purchased an Elecom Bluetooth mouse (EX-G / M-XGS10BB) which can switch between two PCs. It paired OK but would then connect / disconnect in an eternal loop.

Symptoms:

[bluetooth]# connect C8:47:8C:09:DC:15
Attempting to connect to C8:47:8C:09:DC:15
Failed to connect: org.bluez.Error.Failed
[CHG] Device C8:47:8C:09:DC:15 Connected: yes
[CHG] Device C8:47:8C:09:DC:15 Connected: no
[CHG] Device C8:47:8C:09:DC:15 Connected: yes
[CHG] Device C8:47:8C:09:DC:15 Connected: no
[CHG] Device C8:47:8C:09:DC:15 Connected: yes
[CHG] Device C8:47:8C:09:DC:15 Connected: no
[CHG] Device C8:47:8C:09:DC:15 Connected: yes
[CHG] Device C8:47:8C:09:DC:15 Connected: no

How to fix it:

jonas@octo:~$ bluetoothctl 
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# trust C8:47:8C:09:DC:15
[CHG] Device C8:47:8C:09:DC:15 Trusted: yes
Changing C8:47:8C:09:DC:15 trust succeeded
[bluetooth]# agent off
Agent unregistered
[bluetooth]# quit