I get it resolved this way in my Ubuntu 18.04.2 LTS. I followed up the link posted before by cbsuh in the first comment but I can show you how to pair it quickly and safe:
Be sure you have the tool hcidump installed. If don't, sudo apt install bluez-hcidump
Run hcitool scan and search for your device.
In my case:
hcitool scan
Scanning ...
XX:XX:XX:XX:XX:XX ThinkPad Compact Bluetooth Keyboard with TrackPoint
Next, run "sudo hcidump -at | grep -i passkey" and wait till you see the line with the passcode you'll have to enter with your keyboard and press enter.
Now, go to your Bluetooth devices list (when you see your device listed), and after select it, choose Setup, Pair device and Next (in the dialogue)
After a few seconds later, you will see the passcode number so enter it quickly and press Enter. You have to slide the lid of the right several times to put the keyboard in Discoverable mode.
For me, it did not work at first time, but yes at the second time.
In my case:
sudo hcidump -at|grep -i passkey
bdaddr XX:XX:XX:XX:XX:XX passkey 159066
The command prints out a lot of output, so with the grep you only pay attention to what's important.
I get it resolved this way in my Ubuntu 18.04.2 LTS. I followed up the link posted before by cbsuh in the first comment but I can show you how to pair it quickly and safe:
Be sure you have the tool hcidump installed. If don't, sudo apt install bluez-hcidump
Run hcitool scan and search for your device.
In my case:
hcitool scan
Scanning ...
XX:XX:XX:XX:XX:XX ThinkPad Compact Bluetooth Keyboard with TrackPoint
Next, run "sudo hcidump -at | grep -i passkey" and wait till you see the line with the passcode you'll have to enter with your keyboard and press enter.
Now, go to your Bluetooth devices list (when you see your device listed), and after select it, choose Setup, Pair device and Next (in the dialogue)
After a few seconds later, you will see the passcode number so enter it quickly and press Enter. You have to slide the lid of the right several times to put the keyboard in Discoverable mode.
For me, it did not work at first time, but yes at the second time.
In my case:
sudo hcidump -at|grep -i passkey
bdaddr XX:XX:XX:XX:XX:XX passkey 159066
The command prints out a lot of output, so with the grep you only pay attention to what's important.
And, now it's paired.