bluez5 : Cannot connect to a paired bluetooth device on Ubuntu 17.10

From Arch wiki, Pairing works, but connecting does not, section:

This may be due to the pulseaudio-bluetooth package not being installed. Install it if it missing, then restart pulseaudio.

But pulseaudio-bluetooth package's name is pulseaudio-module-bluetooth on Ubuntu.

So your problem should be solved after installing it:

sudo apt install pulseaudio-module-bluetooth

And after installing this package restart your system to load some pulse audio modules like module-bluetooth-policy and module-bluetooth-discover.

Update:

But if still, you get below message after reboot:

connect error: Connection refused (111)

According to this answer, you should add these lines to /etc/pulse/default.pa file. (If not exist):

load-module module-bluetooth-policy
load-module module-bluetooth-discover

But these lines should be exist by default and after reboot your system, those modules should be loaded.

Update2:

According to this article on Arch wiki:

This may be because you have already paired the device with another operating system using the same bluetooth adapter (e.g., dual-booting). Some devices can't handle multiple pairings associated with the same MAC address (i.e., bluetooth adapter). You can fix this by re-pairing the device

So please re-pair your device with this commands (Or you can use GUI method):

First run:

bluetoothctl

Then use this commands to show paired devices:

devices

And this should be have some output like this:

Device XX:XX:XX:XX:XX:XX Device Name

Then remove paired devices with this command:

remove XX:XX:XX:XX:XX:XX

And restart Bluetooth service:

sudo service bluetooth restart

Then try to pair device again.