Cannot power on bluetooth from bluetoothctl if it was powered off from the GNOME Setting
I first switch off Bluetooth by clicking on the switch button inside GNOME Settings. Then, I want to power on Bluetooth from the command line, but I get an error.
❯ bluetoothctl power on
Failed to set power on: org.bluez.Error.Failed
I tried to sudo bluetoothctl power on
, but the issue remains.
However, if I switch on Bluetooth from GNOME Settings, then use bluetoothctl to switch Bluetooth on and off, it works fine.
So, my problem is that if I had switched Bluetooth off from GNOME Settings, I cannot switch it back on using the command line.
Relevant information
-
GNOME Settings version: 46.2
-
Operating system (distribution): NixOS 24.05 (Uakari)
-
bluetoothd
andbluetoothctl
version: 5.75 -
Error message:
❯ bluetoothctl power on
Failed to set power on: org.bluez.Error.Failed
- Screenshots
Steps to reproduce:
- Open GNOME Settings
- Switch off Bluetooth using the switch button
- Open a terminal
- Run
bluetoothctl power on
Additional notes
- I originally posted this issue at https://discourse.gnome.org/t/cannot-power-on-bluetooth-from-bluetoothctl-if-it-was-powered-off-from-the-gnome-settings/24782. I add here further details provided by Sid:
I can reproduce it.
It appears that Settings app sets some state in the Bluetooth adpater / driver code which causes this. Below are the debug logs for bluetoothd.
bluetoothd[]: src/adapter.c:property_set_mode() sending Set Powered command for index 0 bluetoothd[]: src/shared/mgmt.c:send_request() [0x0000] command 0x0005 bluetoothd[]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x05 status: 0x03 bluetoothd[]: src/adapter.c:property_set_mode_complete() Failed (0x03) bluetoothd[]: Failed to set mode: Failed (0x03)
Unfortunately, the adapter returns an error code of 0x03 which is a generic Failed error code as in bluez/lib/mgmt.h#L1250.
- #2984 (moved) might be related, but this issue is different in that I cannot switch Bluetooth on from command line, not from a GUI.