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
Thanks for the tips and inspiration. I played around with your suggestions and noticed different behaviour, but ultimately I couldn't use your ideas to get the bluetooth working on a Lite image. However, I tried a different approach and succeeded!

1) I installed a standard Trixie 64 bit image on one Pi, and a Lite Trixie 64 bit image on another. Then I verified bluetooth was working on the standard image.

2) I then (very carefully) compared the two images, particularly in /home/username/.config as well as /etc/systemd/system.
  • I noticed that there was a /home/username/pulse/cookie file on the standard system and this directory wasn't present on the Lite system.
  • I also noticed that there was a module /etc/systemd/system/getty@tty1.service.d/autologin.conf on the standard system and not on the Lite system.
So, as I don't really know how these files were created, I hand-created the service file, rebooted, and tried to use bluetooth. It was then working as it used to work, before I upgraded the Pi to trixie. The cookie file in the /home/username/.config/pulse directory gets created on reboot.

Hopefully somebody knowledgeable can now jump in and tell us the 'correct' way of creating the service file (I couldn't work it out myself, so I just copied what was on the working standard system onto the Lite system). I'm also interested to know why the userctl enable-linger that I was originally trying didn't work (and that this getty@tty1 hack works).

Cheers.

Code:

#! /bin/bash# Make sure only root can run our scriptif [[ $EUID -ne 0 ]] ; then  echo "This script must be run as root." 1>&2  echo "For example, run the script as follows:" 1>&2  echo "   sudo $0" 1>&2  exit 1fiapt-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)DOLLAR="\$"# Enable the services we just definedusermod "${USERNAME}" -aG pi,audio,video,bluetooth 2> /dev/null# Create an autologin session (no idea why, but this works and loginctl enable-linger "${USERNAME}" doesn't)mkdir /etc/systemd/system/getty\@tty1.service.dcat > /etc/systemd/system/getty\@tty1.service.d/autologin.conf << EOF[Service]ExecStart=ExecStart=-/sbin/agetty --autologin ${USERNAME} --noclear %I ${DOLLAR}TERMEOF# Load the service file we just created and enable itsystemctl daemon-reloadsystemctl restart getty@tty1.serviceecho "Now reboot and pair a device using bluetoothctl. Bluetooth should be working."

Statistics: Posted by dazed_confused — Thu Dec 18, 2025 2:59 am



Viewing all articles
Browse latest Browse all 3535

Trending Articles