DietPi version | 10.6.2 Distro version | trixie Kernel version | Linux Family 6.12.101+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian6.12.101-1 (2026-08-05) x86_64 GNU/Linux Architecture | amd64 SBC model | Native PC (x86_64)
I’m currently running Dietpi and have Kodi on Autostart and Bluetooth ON
To connect to my BT headphones I put a small script into /var/lib/dietpi/postboot.d/bt-headphoness.sh
Everything worked perfectly for a couple of weeks, even this morning, however when attempting to reconnect later today, the bluetooth connection in Kodi sound devices has disappeared. I rebooted several times but it won’t return.
On reboot I get an audio message through the headphones saying “Bluetooth Connected”, but then nothing
I then ran;
bluetoothctl connect 88:C9:E8:91:B8:68
Attempting to connect to 88:C9:E8:91:B8:68
Connection successful
speaker-test -D bluealsa
speaker-test 1.2.14
Playback device is bluealsa
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
\[2894\] D: bluealsa-pcm.c:1538: Getting BlueALSA PCM: PLAYBACK 00:00:00:00:00:00 a2dp
\[2894\] D: bluealsa-pcm.c:1296: /org/bluealsa/hci0/dev_88_C9_E8_91_B8_68/a2dpsrc/sink: Setting constraints
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 960 to 206158430
Period size range from 480 to 524288
Periods = 4
\[2894\] D: bluealsa-pcm.c:566: /org/bluealsa/hci0/dev_88_C9_E8_91_B8_68/a2dpsrc/sink: Initializing HW
\[2894\] D: bluealsa-pcm.c:612: /org/bluealsa/hci0/dev_88_C9_E8_91_B8_68/a2dpsrc/sink: Couldn't open PCM: Device or resource busy
Unable to set hw params for playback: Device or resource busy
Setting of hwparams failed: Device or resource busy
\[2894\] D: bluealsa-pcm.c:475: /org/bluealsa/hci0/dev_88_C9_E8_91_B8_68/a2dpsrc/sink: Closing
Extract fom Kodi Log
info : Loading skin file: /root/.kodi/addons/script.bluetooth.man/resources/skins/Default/1080i/discover.xml, load type: LOAD_ON_GUI_INIT
info : CAddonMgr::FindAddons: script.bluetooth.delay v1.2.0 installed
info : CAddonMgr::FindAddons: script.bluetooth.man v1.0.6 installed
info : CAddonMgr::FindAddons: service.bluetooth-audio v12.2.0.1 installed
info : CAESinkALSA - Unable to open device "bluealsa" for playback
Ok
I think I’ve worked it out.
When booting you must connect at time of boot, if not, the Bluetooth audio device will not appear in Kodi. If I turn off the headphones I can still reconnect at anytime.
I don’t suppose there is anyway of changing this because I have Kodi on Autostart.
This means your Bluetooth sound card does not appear in aplay -l, so it cannot appear in dietpi-config. intel-sst-dsp is not your Bluetooth sound card, but would install firmware for specific Intel chips.
I am no expert with BlueALSA, but did you try the command suggested by Jappe instead?
bluealsa-aplay -l
… let me check the last info I collected about this … does this produce noise through the Bluetooth speakers?
speaker-test -D bluealsa
If so:
echo -e 'pcm.!default bluealsa\nctl.!default bluealsa' | sudo tee /etc/asound.conf
speaker-test
That makes sense. Isn’t it possible to do the pairing with a service? You could order it before autostarts are reached. Also, IIRC, that bluealsa audio module is independent of an actually connected Bluetooth speaker. Of course it won’t work before, but if Kodi has a way to select that “bluealsa” card, or use the system default, it might work with above /etc/asound.conf.
Thanks
After further testing it appears something isn’t quite right.
If I turn my headphones off and then reboot the PC and turn the headphones back on at boot, I get the connect message through the headphones. However when checking the audio devices in Kodi, there is no Bluetooth.
So I then left the headphones on and rebooted. Got a disconnected message then Connected message at boot.
Checked Kodi again and the Bluetooth device is there.
Tried this again and no Bluetooth device.
I just noticed the the Bluetooth connected message happens during Kodi startup. Could it be that the connection is happening too late for Kodi to detect the Bluetooth device?
To test for a timing problem stop the Kodi service, wait a few seconds, connect the Bluetooth device and restart Kodi.
Another interesting test would be:
Reboot,
Stop kodi
Do not connect the BT headphones
Do bluealsa-aplay -l (should output nothing)
Connect the headphones
Do again bluealsa-aplay -l
If you see your device, do speaker-test -D bluealsa -c 2
Thanks
I’ll try those. How do I stop/restart Kodi?
My PC is plugged into a TV and I can only access via ssh and from what I’ve read Kodi won’t start from SSH.