Bluez Prerequisites

This section describes the requirements that must be satisfied in order to use Bluetooth on an Ubuntu Core device.

In short you have to make sure that:

  • the BlueZ snap is installed
  • the Bluetooth daemons are running
  • the plugs and slots are connected

You can check the bluez snap is installed by using snap list:

$ snap list
Name     Version   Rev   Tracking       Publisher    Notes
bluez    5.48-3    284   latest/stable  canonical*   -

If bluez is not listed by the above command you can install it with:

$ sudo snap install bluez

Bluetooth Daemons

Normally, once the snap is installed, the Bluetooth daemon is up and running.

Nevertheless it is still good to verify this.

For bluetoothd type:

$ systemctl status snap.bluez.bluez.service

The expected output should look like:

● snap.bluez.bluez.service - Service for snap application bluez.bluez
   Loaded: loaded (/etc/systemd/system/snap.bluez.bluez.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2016-11-02 15:15:31 UTC; 4 months 11 days ago
 Main PID: 1580 (bluetoothd)
   CGroup: /system.slice/snap.bluez.bluez.service
           └─1580 /snap/bluez/x2/usr/lib/bluetooth/bluetoothd -E

For obexd type:

$ systemctl status snap.bluez.obex.service

The expected output should look like:

● snap.bluez.obex.service - Service for snap application bluez.obex
   Loaded: loaded (/etc/systemd/system/snap.bluez.obex.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2016-11-02 15:15:31 UTC; 4 months 11 days ago
 Main PID: 1584 (obexd)
   CGroup: /system.slice/snap.bluez.obex.service
           └─1584 /snap/bluez/x2/usr/lib/bluetooth/obexd

Note that you need bluetoothd for the regular Bluetooth usage, however it is not enough for exchanging files over Bluetooth. For this to work you need the obexd daemon. It is mentioned here because, for example, on Ubuntu Desktop the obexd is not started by default.

Plugs and slots

Checking for the Bluetooth plug and slot being auto-connected is one of the snap verification criteria therefore in 99.9% cases it will be as expected. For the sake of exercise it is good to verify:

$ snap connections bluez
Interface          Plug                     Slot           Notes
bluetooth-control  bluez:bluetooth-control  -              -
bluez              -                        bluez:service  -
bluez              bluez:client             -              -
home               bluez:home               :home          -
network-control    bluez:network-control    -              -
uhid               bluez:uhid               :uhid          -

You should expect the output like the above, that is the bluez:service slot is connected with the bluez:client plug.

1 Like