My team is trying to connect Bluetooth audio devices such as an AmazonBasics Bluetooth Speaker to an Ubuntu Core host. We have verified separately that the bluez snap and the pulseaudio snap work for us. However, the pulseaudio snap seems to be missing the required modules for working with Bluetooth audio devices.
The accepted solution there suggests that we should load the pulseaudio module module-bluetooth-discover, but this is not installed anywhere with the pulseaudio or bluez snaps. I would guess for Bluetooth audio to work, the pulseaudio snap first needs to incorporate these modules (module-bluetooth-discover.so, module-bluetooth-policy.so, module-bluez5-device.so, module-bluez5-discover.so).
Is this something that could be added to the pulseaudio snap? Thanks!
$ ls /snap/pulseaudio/current/usr/lib/pulse-8.0/modules/*blue*
ls: cannot access '/snap/pulseaudio/current/usr/lib/pulse-8.0/modules/*blue*': No such file or directory
$ snap interfaces|grep pulse|grep blue
$
There is indeed neither any of the bluetooth modules nor is there any ability to connect pulse to the bluez service ⦠we should definitely add this ⦠(thanks a lot for reporting)
It would be great if you can help adding the necessary bits into the snap. We currently disable BlueZ support explicitly but enabling it here snapcraft.yaml - ~snappy-hwe-team/snappy-hwe-snaps/+git/pulseaudio - [no description] would be a good first step. If you install a pulse and a bluez snap in devmode you should be already able to do basic testing of this. Once that works we can do any further interface adjustments if needed.
Thanks for the suggestions. I am looking into that now. I found that the BlueZ support also depends on D-Bus. Perhaps we will also need to change the bluez snap to add a dbus interface.
Thanks. That does seem to resolve the apparmor messages.
Further along⦠I am able to pair and connect some devices, but they immediately disconnect after about one second. I noticed a variety of messages in syslog such as the following:
Nov 2 16:59:09 localhost bluetoothd[2097]: Endpoint replied with an error: org.freedesktop.DBus.Error.AccessDenied
Nov 2 16:59:14 localhost kernel: [ 2870.458699] Bluetooth: hci0 SCO packet for unknown connection handle 63
Nov 2 16:59:15 localhost bluetoothd[2097]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
I am just throwing that out there in case someone here recognizes the symptoms. The same USB Bluetooth dongle and Bluetooth speaker work perfectly on Ubuntu 16.04 Desktop.
@ogra Thanks for pulling my changes into the pulseaudio snap. It looks like the functionality we need is almost all in place. I am testing with the versions of bluez, pulseaudio, and core in the edge channel, and it is mostly working. However, I do still need to install both bluez and pulseaudio in devmode to avoid apparmor rejections. It may be that the 2.29 update to core fixed some but not all of the rejects. I also found that I need to modify /etc/dbus-1/system.d/snap.bluez.bluez.conf to get audio devices working.
When pulseaudio starts up and loads the module-bluetooth-discover module, it connects to bluez over dbus. There are numerous apparmor messages related to that.
Finally, I did need to edit ā/etc/dbus-1/system.d/snap.bluez.bluez.confā in order to get things working. I added the following two lines inside the first policy block.
I noticed that these two lines are present on my Ubuntu Desktop workstation but not in Ubuntu Core and that the contents of this file are automatically generated on system boot. Are those dbus rules specified in the core snap or in the bluez snap?
Thanks, that is super helpful. I created a PR on snapd to add the dbus rules (https://github.com/snapcore/snapd/pull/4448) and will do some more testing with the pulseaudio snap.
@ogra, would you be willing to try adding the bluez plug to the pulseaudio snap? I think Jamie is correct that we will need to do that, but I have not been able to test it myself. Whenever I build the pulseaudio snap on my workstation and install the snap on an Ubuntu Core device, the daemon crashes during initialization. I tracked it down to a segmentation fault in the init_profile function in modules/alsa/module-alsa-card.c near line 292, but I have no idea why that would occur with my builds but not the ones from the snap store. Given the inconsistency, I am hesitant to call it a pulseaudio bug and more inclined to attribute it to a quirk in my build environment or hardware. Anyway, I would appreciate any help at making further progress on this.
Alright. So, the moment I input the command at the end of step 5 I get clean audio streamed from my phone. However, after about 15 second or so the sound cuts out and no longer pays despite my phone streaming with the weblink. I went through with the rest of the steps to see if it would resolve itself, but it did not. Any ideas folks? Thank you.