2

I have uninstalled BlueZ from my raspberry pi.

sudo apt-get --purge remove bluez

Then, I reinstalled it using this tutorial:

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.47.tar.xz
tar -xvf bluez-5.47.tar.xz
cd bluez-5.47/
./configure --enable-mesh --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var
make
sudo make install
sudo ln -sf /usr/libexec/bluetooth/bluetoothd /usr/lib/bluetooth/bluetoothd
sudo systemctl daemon-reload

Then, I did bluetoothd -v as the tuto was suggesting and it told me "command not found". I went on by adding /usr/lib/bluetooth/ to PATH in my ~/.bashrc.

Then, bluetoothd -v gives me 5.47.

But sudo systemctl status bluetooth gives me:

● bluetooth.service - Bluetooth service
   Loaded: loaded (/etc/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:bluetoothd(8)

I tried sudo systemctl start bluetooth, sudo systemctl enable bluetooth.service and none of that worked. (cf https://askubuntu.com/questions/779911/bluetooth-status-inactive-dead).

What makes the bluetooth service inactive? I also remarked that my /etc/bluetooth/ folder does not exist anymore since I reinstalled BlueZ. Why is that?

Specs:

  • Raspberry Pi 3 Model B Rev 1.2
  • BlueZ v 5.47
2
  • Did you remember to also create the bluetooth.service file for systemd, place it in the proper place, and issue the proper "systemctl daemon-reload" and "systemctl enable bluetooth.service"? – Ole Wolf Nov 6 '20 at 7:09
  • @OleWolf Yes, I did execute the commands you specify and checked that bluetooth.service exists and is at the proper location (/lib/systemd/system/bluetooth.service). – vinzee Nov 6 '20 at 9:12
3

I did:

sudo modprobe btusb  # add the btusb module to the kernel
sudo systemctl start bluetooth.service

And it works!

$ sudo systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
   Loaded: loaded (/etc/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-11-06 21:38:45 CET; 6s ago
     Docs: man:bluetoothd(8)
 Main PID: 2434 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/bluetooth.service
           └─2434 /usr/lib/bluetooth/bluetoothd

I found the answer here: https://stackoverflow.com/a/44079184/5446749

1
  • 1
    Please mark the answer as the accepted one with a click on the tick on its left side. That prevents your Question from being shown as an unsolved Post to the community and saves them/us a lot of work. – Ingo Nov 13 '20 at 9:56
2

I assume you are using a Raspberry Pi OS based on Buster. It is curious that systemd does not give you any output what's going on with the bluetooth.service. The status should at least contain additional lines why it fails to start, something similar to this with some red lines:

Nov 02 12:00:48 raspberrypi systemd[1]: Starting Bluetooth service...
Nov 02 12:00:48 raspberrypi bluetoothd[714]: Bluetooth daemon 5.50
Nov 02 12:00:48 raspberrypi systemd[1]: Started Bluetooth service.
Nov 02 12:00:48 raspberrypi bluetoothd[714]: Starting SDP server
Nov 02 12:00:48 raspberrypi bluetoothd[714]: Bluetooth management interface 1.14 initialized
Nov 02 12:00:48 raspberrypi bluetoothd[714]: Sap driver initialization failed.
Nov 02 12:00:48 raspberrypi bluetoothd[714]: sap-server: Operation not permitted (1)
Nov 02 12:00:48 raspberrypi bluetoothd[714]: Endpoint registered: sender=:1.22 path=/org/bluez/hci0/A2DP/SBC/Source/1
Nov 02 12:00:48 raspberrypi bluetoothd[714]: Endpoint registered: sender=:1.22 path=/org/bluez/hci0/A2DP/SBC/Source/2
Nov 02 12:00:48 raspberrypi bluetoothd[714]: Failed to set privacy: Rejected (0x0b)

Try this:

rpi ~$ rfkill unblock bluetooth
rpi ~$ sudo systemctl enable bluetooth.service
rpi ~$ sudo systemctl reboot

After login:

rpi ~$ sudo systemctl restart bluetooth.service
rpi ~$ systemctl status bluetooth.service

It may also show you that the service is dead but it should show additional lines why it fails. You can also look at the journal for the bluetooth.service:

rpi ~$ journalctl --boot --unit bluetooth.service

Look at the Unit file what the service is doing:

rpi ~$ systemctl cat bluetooth.service

The default Unit from 2020-08-20-raspios-buster-armhf looks like this:

# /lib/systemd/system/bluetooth.service
[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
ConditionPathIsDirectory=/sys/class/bluetooth

[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/lib/bluetooth/bluetoothd
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
ProtectHome=true
ProtectSystem=full

[Install]
WantedBy=bluetooth.target
Alias=dbus-org.bluez.service
1
  • I tried what you did but did not manage to get a "not dead" bluetooth service.. Moreover, with your commands, I did not manage to get any entries in the journal. :( – vinzee Nov 6 '20 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.