bluetooth headset not working in ubuntu 18.04 code example

Example 1: ubuntu 18.04 bluetooth headset problem turning off

I restart it in the terminal, and it works:

Code:

$ sudo -i
# bluetoothctl
[bluetooth]# power off
[bluetooth]# power on
[bluetooth]# scan on
[bluetooth]# connect XX:XX:XX:XX:XX:XX (your bluetooth address)
[Arc Touch Mouse SE]# trust
[Arc Touch Mouse SE]# pair
[Arc Touch Mouse SE]# unblock
[Arc Touch Mouse SE]# power off
[bluetooth]# power on

Example 2: ubuntu 18 does not connect to bluetooth earphones

$ sudo -i
# bluetoothctl
[bluetooth]# power off
[bluetooth]# power on
[bluetooth]# scan on
[bluetooth]# connect XX:XX:XX:XX:XX:XX (your bluetooth address)
[Arc Touch Mouse SE]# trust
[Arc Touch Mouse SE]# pair
[Arc Touch Mouse SE]# unblock
[Arc Touch Mouse SE]# power off
[bluetooth]# power on