Skip to Content

基本检查

# 蓝牙服务状态 systemctl status bluetooth # 蓝牙适配器信息(hciconfig 已废弃,改用 bluetoothctl/btmgmt) bluetoothctl show bluetoothctl list # 列出所有适配器 # 射频开关状态 rfkill list bluetooth

如果蓝牙被禁用:

sudo rfkill unblock bluetooth sudo systemctl restart bluetooth

使用 bluetoothctl

sudo bluetoothctl

常用命令:

power on # 开启蓝牙 agent on # 启用代理 default-agent # 设为默认代理 scan on # 扫描设备 devices # 列出发现的设备 pair XX:XX:XX:XX:XX # 配对 trust XX:XX:XX:XX:XX # 信任设备 connect XX:XX:XX:XX:XX # 连接 info XX:XX:XX:XX:XX # 查看设备信息 remove XX:XX:XX:XX:XX # 移除设备 quit # 退出

常见问题

无法发现设备

# 确认蓝牙适配器已上电 bluetoothctl power on # 重新扫描 sudo bluetoothctl scan on

如果仍然发现不了,检查内核日志:

sudo dmesg | grep -i bluetooth sudo dmesg | grep -i "hci\|btusb"

配对失败

  1. 先移除之前的配对记录再重新配对:
sudo bluetoothctl remove XX:XX:XX:XX:XX:XX scan on pair XX:XX:XX:XX:XX:XX
  1. 某些设备需要输入 PIN 码,默认为 0000 或 1234

  2. 清除蓝牙缓存:

sudo rm -rf /var/lib/bluetooth/* sudo systemctl restart bluetooth

已配对但无法连接

# 先信任设备 sudo bluetoothctl trust XX:XX:XX:XX:XX:XX connect XX:XX:XX:XX:XX:XX

如果提示 “Failed to connect: org.bluez.Error.Failed”:

# 重启蓝牙协议栈 sudo systemctl restart bluetooth sudo modprobe -r btusb && sudo modprobe btusb

连接后频繁断开

# 查看蓝牙日志 journalctl -u bluetooth -f # 禁用蓝牙电源管理 sudo nano /etc/bluetooth/main.conf

在 [Policy] 段添加或修改:

[Policy] AutoEnable=true [General] FastConnectable=true

重启服务:

sudo systemctl restart bluetooth

蓝牙耳机音质差

蓝牙耳机可能使用了 SCO/HSP 协议(通话模式)而非 A2DP(高质量音频)。

# 检查当前音频协议 wpctl status # 在 PipeWire 中切换到 A2DP # 可在 GNOME 声音设置中选择输出配置文件为 "高保真播放 (A2DP Sink)"

蓝牙键盘/鼠标延迟

hcitool 已废弃,连接参数现由内核和 BlueZ 自动协商。如需排查延迟,先用 bluetoothctl info XX:XX:XX:XX:XX:XX 确认连接状态,再通过 btmgmt 查看/管理适配器:

# 查看适配器信息与连接情况 btmgmt info btmgmt con # 列出当前连接

升级 BlueZ

Ubuntu 26.04 自带 BlueZ 蓝牙协议栈。检查版本:

bluetoothd --version

如果遇到兼容性问题,可安装更新版本(如果可用):

sudo apt update sudo apt install --only-upgrade bluez

USB 蓝牙适配器

如果内置蓝牙有问题,可使用 USB 蓝牙适配器:

# 确认识别 lsusb | grep -i bluetooth # 加载驱动 sudo modprobe btusb # 如果有多个适配器,查看并选择使用哪个 bluetoothctl list # 列出所有适配器及其 MAC bluetoothctl select XX:XX:XX:XX:XX:XX # 选中指定适配器 bluetoothctl power on # 为该适配器上电

蓝牙日志调试

# 启用详细日志 sudo nano /etc/systemd/system/bluetooth.service.d/override.conf
[Service] ExecStart= ExecStart=/usr/libexec/bluetooth/bluetoothd -d
sudo systemctl daemon-reload sudo systemctl restart bluetooth journalctl -u bluetooth -f
Last updated on