Trying to enable bluetooth on startup (Debian)

2

I have already paired and connected some devices successfully. In order to do so I had to use rfkill.

$ sudo bluetoothctl
[bluetooth]# power on
Failed to set power on: org.bluez.Error.Blocked
[bluetooth]# exit
$ sudo rfkill unblock bluetooth
$ sudo bluetoothctl
[bluetooth]# power on
Changing power on succeeded

This however, does not persist through restarts. So after some googling, I attempted to create a service.

$ sudo cat /etc/systemd/system/rfkill-unblock.service 
[Unit]
Description=RFKill-Unblock Bluetooth Devices
After=bluetooth.service
Requires=bluetooth.service

[Service]
Type=oneshot
ExecStart=/usr/sbin/rfkill unblock bluetooth
ExecStop=
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

After a restart, I still have to manually call rfkill unblock bluetooth before I can power on bluetoothctl. Here is my output from systemctl status

$ sudo systemctl status rfkill-unblock.service
● rfkill-unblock.service - RFKill-Unblock Bluetooth Devices
   Loaded: loaded (/etc/systemd/system/rfkill-unblock.service; enabled)
   Active: active (exited) since Wed 2015-07-15 02:26:18 UTC; 9min ago
  Process: 286 ExecStart=/usr/sbin/rfkill unblock bluetooth (code=exited, status=0/SUCCESS)
 Main PID: 286 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/rfkill-unblock.service

I think it should also be noted that I am using ssh to connect in to this machine, as it is being used as a media center.

kwolfe

Posted 2015-07-15T13:56:25.977

Reputation: 121

Have you checked your syslog? Error messages from rfkill when called from systemd should be there. – Larssend – 2015-07-15T22:43:04.903

Answers

0

Install and configure urfkill. This seems to work for me:

# cat /etc/urfkill/urfkill.conf |grep '^[[:alpha:]]\|\['
[general]
user=root
master_key=true
force_sync=true
persist=true

midenok

Posted 2015-07-15T13:56:25.977

Reputation: 190