Turn on Bluetooth at system boot

For some reason (I am guessing security?), CL does not turn on Bluetooth upon reboot, hence one has to turn Bluetooth on by hand everytime one reboots. Ideally I’d like to make sure that Bluetooth status and connections are restored after reboot: how can that be done please?

I tried sudo systemctl enable bluetooth, but that doesn’t seem to have any effect.

Are you trying to use a bluetooth keyboard at boot?

One thought is instead of using systemd is to invoke the kernel driver…

Example:

# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/bin/bluetoothctl --agent menu power on"

This is not a Clear Linux specific example, but a standard linux one.

I use a Bluetooth speaker, and I’d like to make sure it re-connects automatically after each reboot. The way things stand right now, I need to manually perform a couple of actions upon each reboot: turn on Bluetooth + connect speaker.

@Edwaleni In the example you have given, what configuration file does this go into? In some kind of boot configuration file? Some kind of gnome-session configuration file?

I believe I might have found the URL source or related URL source for invoking the Bluetooth start up
linux - Turn on bluetooth on login screen - Unix & Linux Stack Exchange

In this post you modify the /etc/ directory by adding a configuration directory for start up customization.
I have used for setting up network routing on my Clear Linux server.

1 Like

The solution given by @Edwaleni is a udev rule. The following snippet creates the directory under /etc if missing. Then, adds a udev configuration file. I verified that /bin/bluetoothctl exists on CL.

sudo mkdir -p /etc/udev/rules.d
sudo tee "/etc/udev/rules.d/bluetooth.conf" >/dev/null <<'EOF'
# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/bin/bluetoothctl --agent menu power on"
EOF
1 Like

Though see BlueZ » Blog Archive » Release of BlueZ 5.35. That seems to be favoring the /etc/bluetooth/main.conf method as opposed to “unreliable hciconfig hci0 up commands.”

I can attest that the /etc/bluetooth/main.conf method works perfectly.

1 Like