Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3535

Raspberry Pi OS • Re: Missing Bluetooth Audio Sink and Source in Lite OS

$
0
0
I have previously had a bluetooth sink working on several Pis under both Bookworm and Bullseye Lite installations, both 32 bit and 64 bit, and I have been attempting to get a bluetooth sink working on a Trixie Lite image.

So far, I have not succeeded. I have been looking out for questions and answers about getting Bluetooth sinks working on Trixie for a few months, but there has been little discussion. Clearly something has changed vis a vis the earlier releases, but I have not yet worked it out. I also feel as though I am a non-expert in both bluetooth and audio on the Pi, and so perhaps I am doing somethinbg stupid. If that's the case, I would greatly appreciate somebody more knowledgeable pointing out what I've done incorrectly.

Here is how to replicate what I've done. When these packages are installed and configured and the Pi is rebooted, I can pair a phone with the Pi using bluetoothctl, but it disconnects itself shortly afterwards. The logs indicate that A2DP is not found, even though I think its installed.

Code:

#! /bin/bashapt-get --yes --allow-change-held-packages install --no-install-recommends \wireplumber pipewire pipewire-alsa pipewire-audio-client-libraries pipewire-jack \pipewire-pulse pipewire-bin libspa-0.2-bluetooth pulseaudio-utils alsa-utils \lpplug-bluetooth wfplug-bluetooth lpplug-volumepulse wfplug-volumepulse \libpipewire-0.3-common libspa-0.2-modules bluez bluez-tools bluez-obexdif [[ -z "$(grep "Class = 0x200414" /etc/bluetooth/main.conf)" ]] ; then  # The following two timeouts are expressed in seconds  sed -i 's/^#DiscoverableTimeout.*/DiscoverableTimeout = 180/g'  /etc/bluetooth/main.conf  sed -i 's/^#PairableTimeout.*/PairableTimeout = 180/g'  /etc/bluetooth/main.conf  sed -i 's/^#FastConnectable.*/FastConnectable = true/g'  /etc/bluetooth/main.conf  sed -i 's/^#JustWorksRepairing.*/JustWorksRepairing = always/g'  /etc/bluetooth/main.conf  sed -i 's/^#Cache.*/Cache = yes/g'  /etc/bluetooth/main.conf  sed -i 's/^#Class.*/Class = 0x200414 #Present as an audio loudspeaker/g'  /etc/bluetooth/main.conf  sed -i 's/^#ReconnectAttempts.*/ReconnectAttempts = 7/g'  /etc/bluetooth/main.conf  sed -i 's/^#ReconnectIntervals.*/ReconnectIntervals=1,2,4,8,16,32,64/g'  /etc/bluetooth/main.conf  # The following timeout is expressed in minutes  sed -i 's/^#IdleTimeout.*/IdleTimeout=180/g'  /etc/bluetooth/input.conf  # Modify the /etc/systemd/system/bluetooth.target.wants/bluetooth.service  sed -i '/ExecStart=./ s/$/ --noplugin=sap/' /lib/systemd/system/bluetooth.service  sed -i 's/^.*Restart=.*/Restart=always/g' /lib/systemd/system/bluetooth.servicefirfkill unblock bluetoothchmod 755 /var/lib/bluetoothCARD=$(aplay -l | grep card | grep Headphones | sed -e 's/^card[[:space:]]*//g; s/:.*//g')cat << EOF > /etc/asound.confpcm.!default {  type hw  card ${CARD}}ctl.!default {  type hw  card ${CARD}}EOFUSERNAME=$(who am i)USER_ID=$(id -u ${USERNAME})# create system-level units that run the services as the 'audio' usercat << EOF > /etc/systemd/system/pipewire@${USERNAME}.service[Unit]Description=PipeWire for user ${USERNAME}After=network.target dbus.service bluetooth.serviceRequires=bluetooth.service[Service]User=${USERNAME}PAMName=loginEnvironment= XDG_RUNTIME_DIR=/run/user/${USER_ID}ExecStart=/usr/bin/pipewireRestart=on-failureKillMode=processLimitNOFILE=65536[Install]WantedBy=multi-user.targetEOFcat << EOF > /etc/systemd/system/pipewire-pulse@${USERNAME}.service[Unit]Description=PipeWire Pulse for user ${USERNAME}After=pipewire@${USERNAME}.serviceRequires=pipewire@${USERNAME}.service[Service]User=${USERNAME}PAMName=loginEnvironment= XDG_RUNTIME_DIR=/run/user/${USER_ID}ExecStart=/usr/bin/pipewire-pulseRestart=on-failure[Install]WantedBy=multi-user.targetEOFcat << EOF > /etc/systemd/system/wireplumber@${USERNAME}.service[Unit]Description=WirePlumber for user ${USERNAME}After=pipewire@${USERNAME}.service pipewire-pulse@${USERNAME}.service bluetooth.serviceRequires=pipewire@${USERNAME}.service[Service]User=${USERNAME}PAMName=loginEnvironment= XDG_RUNTIME_DIR=/run/user/${USER_ID}ExecStart=/usr/bin/wireplumberRestart=on-failure[Install]WantedBy=multi-user.targetEOF# Enable the services we just definedusermod "${USERNAME}" -aG pi,audio,video,bluetooth 2> /dev/nullsystemctl enable pipewire@${USERNAME}.service pipewire-pulse@${USERNAME}.service wireplumber@${USERNAME}.serviceloginctl enable-linger "${USERNAME}"
If you have sorted the issue, I would appreciate you sharing your solution. If you can see what I have done incorrectly, or have not done, I would also appreciate that too.

Statistics: Posted by dazed_confused — Thu Dec 11, 2025 2:58 am



Viewing all articles
Browse latest Browse all 3535

Trending Articles