Sửa lỗi không kết nối được thiết bị bluetooth trên một số Linux distribution

sudo systemctl status bluetooth

Đôi khi trên các hệ điều hành như Ubuntu, Pop!_OS, Arch Linux sẽ gặp lỗi không kết nối được thiết bị bluetooth. Khi xem log sử dụng systemctl thì sẽ thấy như sau:

trandatdt@pop-os:~$ sudo systemctl status bluetooth.service 
● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-10-26 22:36:35 +07; 19min ago
       Docs: man:bluetoothd(8)
   Main PID: 1416 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 18720)
     Memory: 2.3M
        CPU: 513ms
     CGroup: /system.slice/bluetooth.service
             └─1416 /usr/lib/bluetooth/bluetoothd

Oct 26 22:45:06 pop-os bluetoothd[1416]: src/profile.c:ext_connect() Hands-Free Voice gateway failed connect to AB:CD:EF:GH:IJ:KL: Permission denied (13)
Oct 26 22:45:07 pop-os bluetoothd[1416]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to AB:CD:EF:GH:IJ:KL: Too many levels of symbolic links (40)
Oct 26 22:45:12 pop-os bluetoothd[1416]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to AB:CD:EF:GH:IJ:KL: Permission denied (13)
Oct 26 22:49:48 pop-os bluetoothd[1416]: /org/bluez/hci0/dev_6C_47_60_81_C6_2B/sep2/fd0: fd(42) ready

Lỗi có thể được sửa bằng cách untrust, removepair lại với thiết bị. Mở terminal lên, vào bluetoothctl và gõ các command sau (với AB:CD:EF:GH:IJ:KL là địa chỉ MAC của thiết bị bluetooth cần kết nối):

trandatdt@pop-os:~$ bluetoothctl 
Agent registered
[bluetooth]# untrust AB:CD:EF:GH:IJ:KL
[bluetooth]# remove AB:CD:EF:GH:IJ:KL
[bluetooth]# scan on
[bluetooth]# pair AB:CD:EF:GH:IJ:KL
[bluetooth]# connect AB:CD:EF:GH:IJ:KL

#linux #ubuntu #superuser