You are not logged in.

#1 2024-02-14 21:40:03

cdelorme
Member
Registered: 2013-11-23
Posts: 18

rfkill bluetooth blocked

Hello, I am having trouble figuring out why rfkill is defaulting to blocked for bluetooth after every reboot.

I have tried using `systemctl enable rfkill-unblock@all`, `systemctl-rfkill-unblock-bluetooth`, and even adding a systemd unit override of `PreStartExec=/usr/bin/rfkill unblock bluetooth` to the bluetooth service file.

When I check each service it says they ran, yet everytime I reboot I  have to pull out a wired keyboard to login and re-apply the unblock before I can start using my system.

Any idea what would be causing the default to be blocked everytime?  How can I go about troubleshooting this?

Offline

#2 2024-02-14 23:23:53

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,231

Re: rfkill bluetooth blocked

Do you have TLP or so installed? They have a setting to control the BT state, you'll want to set your preference in their config.

Offline

#3 2024-02-15 00:46:25

cdelorme
Member
Registered: 2013-11-23
Posts: 18

Re: rfkill bluetooth blocked

I am on a desktop so I have not installed tlp.  Thank you for the idea though.

Offline

#4 2024-02-18 00:33:14

cdelorme
Member
Registered: 2013-11-23
Posts: 18

Re: rfkill bluetooth blocked

"Solved", at least as far as I'm going to waste time on it.

I poured through my logs but couldn't find anything causing an explicit block, so it must just be the default state.  However I did see `Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch`, which suggests that it was failing to persist or load the unblocked state.

According to [this old post](https://bbs.archlinux.org/viewtopic.php?id=155282) the `rfkill` command cannot see and therefore cannot unblock the bluetooth service if the unit file runs before the bluetooth controller is brought online.

I am not sure why the `rfkill-unblock@.service` would not have these overrides, but I added `/etc/systemd/system/rfkill-unblock@bluetooth.service.d/wait-for-bluetooth.conf` with the following lines:

    [Install]
    After=bluetooth.service
    Requires=bluetooth.service

> After a `systemctl daemon-reload` both `reboot` and `shutdown -h 0` followed by cold boot appear to be working and I can use my bluetooth keyboard without having to connect a USB first.  _This was important since it's a media machine setup in a living room, hence wireless input devices._

At the same time I am curious since the post I referenced is from over 10 years ago why the `rfkill-unblock@.service` does not have these overrides by default, or even a note, or any mention in the bluetooth wiki page (and I couldn't find an rfkill wiki entry).  I guess it's possible someone might not be using `bluetooth.service`, and there are multiple network managers, but then why bother having a default unblock file if it's not usable without unmentioned/undocumented customization?  Or maybe I'm completely wrong and my system is just jank.

Either way, hopefully this helps someone else out in the future.

Offline

#5 2024-02-18 09:15:21

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,031

Re: rfkill bluetooth blocked

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

The bluetooth.service is part of the optional bluez package, one cannot just inject that into the rfkill service as that would break it on every system w/o bluez installed.
Likewise WantedBy=bluetooth.target would fail on systems w/ WiFi but w/o BT (eg. disabled in BIOS or just non-existent), so that's not a generic option either.

You'd need a special rfkill service if your BT is up very late, or, if the BT comes in dynamic via dongle, a udev rule.
Or you unblock the radio as part of your pairing routine (connman seems to have support for that)

Offline

Board footer

Powered by FluxBB