Bluetooth fix for December update


OK, can do this.



Sorry for the delay in replies here. It’s been busy.

@Den4t as you seem to be willing to tinker with this a bit, I’d recommend you get to where we were before we made changes to try and get it running out of system mode.

apt-get install git build-essential
git clone
cd osmc
git checkout 27a9e28b6d7224c540424445b45da87096042030
cd package/a2dp-app-osmc

That will give you a Deb package which you can install and run apt-get -f install on a fresh installation to get dependencies.

In my findings, A2DP won’t work properly.

But if you stop PulseAudio (systemctl stop pulseaudio) and run pulseaudio -vvv once as the OSMC user and kill it, it will then work without issue.

I couldn’t work out why this was (I checked directories were OK; auth cookies were fine). I did spend quite some time on this.

There’s probably work that needs to be done in files/DEBIAN/postinst to set up permissions properly.


Bluetooth audio output

Hi Sam !

Made a fresh installation (latest osmc 2018-02-01) with the git-version of a2dp-app-osmc, and here is my dicovering.
Firstly i disabled onboard bt (dtoverlay=pi3-disable-bt), then cloned git and made package,
right after install a2dp-app-osmc i have:

osmc@pi:~$ systemctl status pulseaudio
● pulseaudio.service - Pulse Audio
   Loaded: loaded (/lib/systemd/system/pulseaudio.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-03-12 22:32:17 MSK; 3min 24s ago
 Main PID: 952 (pulseaudio)
   CGroup: /system.slice/pulseaudio.service
           └─952 /usr/bin/pulseaudio --system --disallow-exit --disable-shm --realtime --no-cpu-limit

system pulse unit started, but:

osmc@pi:~$ ps axwu|grep pulse
osmc       362  0.5  0.9  90120  7420 ?        Sl   22:29   0:01 /usr/bin/pulseaudio --start --log-target=syslog
pulse      952  0.2  0.9  99484  7512 ?        S<sl 22:32   0:00 /usr/bin/pulseaudio --system --disallow-exit --disable-shm --realtime --no-cpu-limit

we also have a user instance, thats why you can’t use bt headset.
In my case, i can connect headset (via kodi GUI):

osmc@pi:~$ sudo bluetoothctl
[NEW] Controller 00:1A:7D:DA:71:11 pi [default]
[NEW] Device 00:11:67:11:4C:EE BT-1005
[BT-1005]# paired-devices
Device 00:11:67:11:4C:EE BT-1005


osmc@pi:~$ pactl list short cards
0 alsa_card.platform-soc_audio module-alsa-card.c

This is because the headset connected to the system instance of pulseaudio,
kodi (as osmc user) connected to the user instance.

So, what we need to do now:
as osmc user disable pulseaudio user unit:

osmc@pi:~$ systemctl --user disable pulseaudio

and disable autostart server in /etc/pulse/client.conf:

autospawn = no

After reboot for clean start:

osmc@pi:~$ ps axwu|grep pulse
pulse 192 5.7 1.0 108924 8156 ? S<sl 22:57 2:57 /usr/bin/pulseaudio --system --disallow-exit --disable-shm --realtime --no-cpu-limit

Now connect headset:

osmc@pi:~$ pactl list short cards
0 alsa_card.platform-soc_audio module-alsa-card.c
2 bluez_card.00_11_67_11_4C_EE module-bluez5-device.c

Switch pulse in kodi and listen audio from headset. But in my case default card profile
not a2dp:

osmc@pi:~$ pactl list cards

Card #1
Name: bluez_card.00_11_67_11_4C_EE
Driver: module-bluez5-device.c
Owner Module: 16
device.description = "BT-1005"
device.string = "00:11:67:11:4C:EE"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "speaker"
bluez.path = "/org/bluez/hci0/dev_00_11_67_11_4C_EE"
bluez.class = "0x240414"
bluez.alias = "BT-1005"
device.icon_name = "audio-speakers-bluetooth"
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: headset_head_unit
speaker-output: Speaker (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit, a2dp_sink
speaker-input: Bluetooth Input (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit

I think this is my bt adapter feature, switch to a2dp:

osmc@pi:~$ pactl set-card-profile bluez_card.00_11_67_11_4C_EE a2dp_sink

Personally, I’m using a python script that tracks dbus events and runs this command when the bt headset is connected. It is possible, to add a module to module-card-restore
in this case the pulseaudio will restore the profile of the bt card when connected, in this way we only need to set the card profile once.

Tomorrow i try to make changes in postint and client.conf and make a new fresh install.

Bluetooth audio output


Thank you for such a detailed response and your efforts, which will no doubt benefit and be appreciated by many others.

We had a user instance before, and auto-spawning, which while not ideal, did not cause a problem with Jessie. It seems that does cause a problem now.

Yes – this is ideal.

The necessary files should already be diverted so you should be able to produce a package that makes the necessary changes.

Let me know how you get on



Hi !

I made a patches:

branch: a2dp

Remember, that after first headset connect, may be needed to switch card profile by hand:
osmc@pi:~$ pactl set-card-profile bluez_card.XX_XX_XX_XX_XX_XX a2dp_sink


Thanks. I’ll take a look at this shortly.



Before the a2dp-app-osmc package has been installed, the “user” instance of pulseaudio still runs at startup, even though the service is already disabled. I’ve found that it is triggered by pulseaudio.socket, so disabling the service will have no effect - and it would probably need to be masked, instead.

After installing the a2dp-app-osmc package, two instances of pulseaudio do run, but the user instance ceases to run after a reboot, though I guess that it might still be activated via pulseaudio.socket.

So do you know what’s being sent to pulseaudio.socket that causes the user instance of pulseaudio.service to start? And is there still a possibility of whatever is sent happening again?


Nope, and I’m not sure stopping this is the solution, because it worked before under Jessie.


Stopping what?

Anything more concrete than that? Different versions of systemd and different versions of pulse.


I’ve now made some fixes available, and hopefully this will allow A2DP to work out of the box again.

  1. Login via the command line
  2. Edit the file /etc/apt/sources.list
  3. Add the following line: deb stretch-devel main
  4. Run the following commands to update: sudo apt-get update && sudo apt-get dist-upgrade && reboot
  5. Your system should have have received the update.

Please see if the issue is resolved.

I also recommend you edit /etc/apt/sources.list again and remove the line that you added after updating. This will return you to the normal update channel.

Cannot make ALSA + SoundWire to work
[Solved] Bluetooth speaker with harmony remote?

Thanks sam.

Will give it a test near the weekend.



Thanks Sam, I’ve worked through the different steps that you outlined above and everything proceeded smoothly. I.e it found the update and processed it without issue. However I still can’t seem to use OSMC (Raspberry Pi 2) as the output source with bluetooth.


Hi Sam

Just updated but unfortunately no change the bluetooth device automatically disconnects once connected using bluetoothctl see below. I’m using an external dongle which worked fine before the stretch update.

Anything else i can do to help let me know

[bluetooth]# connect 45:C6:59:42:A3:04
Attempting to connect to 45:C6:59:42:A3:04
[CHG] Device 45:C6:59:42:A3:04 Connected: yes
Connection successful
[CHG] Device 45:C6:59:42:A3:04 ServicesResolved: yes
[CHG] Device 45:C6:59:42:A3:04 ServicesResolved: no
[CHG] Device 45:C6:59:42:A3:04 Connected: no


I’ve tried the update on my RPi3. Still big issues pairing and no audio :frowning:

See Cannot make ALSA + SoundWire to work


Don’t know what SoundWire is unfortunately.

Did you try using it as intended (i.e. for A2DP sending / receiving?)


As reported in the linked reply, I tried to use a bluetooth headset and, apart from some issues in the pairing phase, I wasn’t unable to select it as an audio device for the output.

Soundwire is a small binary that (using a Pulseaudio sink) would stream the audio over the network to an Android app.


With the latest a2dp it works for me.
So suggest you try to update to latest devel version and if you still don’t have the Sink provide a screenshot and a debug log.


I’ve already updated with the devel Apt repo last friday, if there aren’t newer updates I’m stuck… Or am I missing some setup step? Do I need to install/configure something additional? The only thing I did is pairing the headphones using bluetoothctland checking in Kodi under System/Audio…


Sam published an update on Sunday


Latest staging update fixed it. Bluetooth doesn’t disconnect after connecting.

All good so far will do more testing.

Thanks @sam_nazarko again :slight_smile: