The officially official Devuan Forum!

You are not logged in.

#1 2025-12-15 04:04:58

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

BlueALSA without systemd

BlueALSA is a Bluetooth audio ALSA backend that allows the use of Bluetooth-connected audio devices without the use of PulseAudio or PipeWire.
_https://wiki.debian.org/Bluetooth/Alsa

It's not entirely beyond the wit of the average person to compile BlueALSA without systemd and manage a basic init script.

Step 1: Compile libfreeaptx codec from git.
Step 2: Compile bluez-alsa from git.

Tested on Devuan 5 Daedalus:

$ inxi -Sxxx
System:
  Host: devuan Kernel: 6.1.0-41-amd64 arch: x86_64 bits: 64 compiler: gcc
    v: 12.2.0 Desktop: MATE v: 1.26.0 info: mate-panel wm: marco v: 1.26.1 vt: 7
    dm: LightDM v: 1.26.0 Distro: Devuan GNU/Linux 5 (daedalus)

Install compilers, packaging tools, and other useful utilities:

sudo apt-get install build-essential fakeroot git sed awk apt-file command-not-found

1. Compile libfreeaptx

Remove the  outdated version of libfreeaptx

apt --simulate remove freeaptx-utils libfreeaptx-dev libfreeaptx0
sudo apt remove freeaptx-utils libfreeaptx-dev libfreeaptx0

This will remove gstreamer1.0-plugins-bad and sayonara, if they are installed. You can reinstall them later if needed.
Create a build directory:

mkdir BUIL1 && cd BUILD1

Clone the repository:

git clone https://github.com/regularhunter/libfreeaptx.git

Compile:

$ cd libfreeaptx && make

Install to ../debdir, that is, BUILD1/debdir

$ make PREFIX=/usr DESTDIR="$(dirname $(pwd))"/debdir install

Go back to the BUILD1folder

$ cd .. && ls -1
debdir
libfreeaptx

Make a template to run dpkg-shlibdeps

mkdir debian && echo -e "Source: libfreeaptx\nPackage: libfreeaptx\nDepends: \${shlibs:Depends}" >> debian/control 

Verify:

$ cat debian/control
Source: libfreeaptx
Package: libfreeaptx
Depends: ${shlibs:Depends} 

Run dpkg-shlibdeps to calculate dependencies

dpkg-shlibdeps -v -xlibfreeaptx -ldebdir/usr/lib --ignore-missing-info -e $(find debdir/usr -type f 2>/dev/null) 

Check the dependencies calculated by dpkg-shlibdeps

$ cat debian/substvars
shlibs:Depends=libc6 (>= 2.34)

This means the Depends field in the DEBIAN/control file you're about to create should be:

Depends: libc6 (>= 2.34)

Now you can build the Debian package from debdir.

install -vm0755 -d debdir/DEBIAN 
$ install -vm0755 -d debdir/DEBIAN 
install: creating directory 'debdir/DEBIAN'

Create DEBIAN/control with a text editor

nano debdir/DEBIAN/control
$ cat debdir/DEBIAN/control
Package: libfreeaptx
Version: 0.2.2
Architecture: amd64
Priority: optional
Section: libdevel
Source: libfreeaptx
Maintainer: Devuan
Installed-Size: 24.6 kB
Conflicts: freeaptx-utils, libfreeaptx-dev, libfreeaptx0
Provides: freeaptx-utils (= 0.2.2), libfreeaptx-dev (= 0.2.2), libfreeaptx0 (= 0.2.2)
Replaces: freeaptx-utils, libfreeaptx-dev, libfreeaptx0
Depends: libc6 (>= 2.34)
Homepage: https://github.com/regularhunter/libfreeaptx
Tag: devel::library, role::devel-lib
Download-Size: 4,596 B
Description: Free implementation of aptX codec.
 libfreeaptx is based on version 0.2.0 of libopenaptx with the intent of
 continuing under a free license without the additional license restriction
 added to libopenaptx 0.2.1.
 .
 This package contains the binaries, libraries, and header files for libfreeaptx.

Generate DEBIAN/md5sums

cd debdir && find . -type f -not -path "./DEBIAN/*" -exec md5sum {} + | sort -k 2 | sed 's/\.\/\(.*\)/\1/' > DEBIAN/md5sums
cd .. && chmod 0644 -- debdir/DEBIAN/md5sums 

Build the Debian package

fakeroot -- dpkg-deb -b debdir libfreeaptx_0.2.2_amd64.deb
$ fakeroot -- dpkg-deb -b debdir libfreeaptx_0.2.2_amd64.deb
dpkg-deb: building package 'libfreeaptx' in 'libfreeaptx_0.2.2_amd64.deb'.
$ ls *.deb
libfreeaptx_0.2.2_amd64.deb

Install

sudo dpkg -i libfreeaptx_0.2.2_amd64.deb 

Re-install gstreamer1.0-plugins-bad and sayonara if needed

sudo apt install gstreamer1.0-plugins-bad sayonara

2. Compile bluez-alsa

Install Buid-Deps:

sudo apt install libfdk-aac-dev libasound2-dev libbluetooth-dev libdbus-1-dev libglib2.0-dev libsbc-dev liblc3-dev libldacbt-enc-dev libldacbt-abr-dev libmp3lame-dev libmpg123-dev libspandsp-dev libopus-dev libbsd-dev libreadline-dev check dbus-daemon python3-docutils pkgconf libudev-dev libell-dev

Clone the source and run autoreconf

mkdir BUILD2 && cd BUILD2
git clone https://github.com/arkq/bluez-alsa.git
cd bluez-alsa && autoreconf --install

Create a build directory

mkdir ../build && cd ../build

Run the configure script from within the build directory:

"$(dirname $(pwd))"/bluez-alsa/configure --prefix=/usr --sysconfdir=/etc --with-bluealsaduser=bluealsad --enable-ldac --with-libfreeaptx --enable-aptx  --enable-aptx-hd --enable-faststream --enable-lc3-swb --enable-mp3lame --enable-mpg123 --enable-msbc --enable-ofono --enable-midi --enable-opus --enable-upower --enable-rfcomm --enable-a2dpconf --enable-hcitop --enable-test --enable-aac --enable-manpages --disable-systemd 

Compile

make

Install to debdir

make DESTDIR="$(dirname $(pwd))"/debdir install
$ cd .. && ls -1
bluez-alsa
build
debdir
install -vDm0644 "$(pwd)"/bluez-alsa/LICENSE "$(pwd)"/debdir/usr/share/licenses/bluez-alsa/LICENSE

To run bluealsad daemon on Devuan, you need a simple init script

mkdir -vp debdir/etc/init.d
nano debdir/etc/init.d/bluealsad
$ cat debdir/etc/init.d/bluealsad
#!/bin/sh

### BEGIN INIT INFO
# Provides:          bluealsa
# Required-Start:    dbus $syslog $local_fs $remote_fs bluetooth
# Required-Stop:     dbus $syslog $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: BlueALSA daemon
# Description:       Bluetooth ALSA audio daemon
### END INIT INFO

. /lib/lsb/init-functions

NAME=bluealsad
DESC="BlueALSA daemon"
DAEMON=/usr/bin/$NAME
PIDFILE="/var/run/$NAME.pid"
STORAGE_DIR="/var/lib/bluealsa"
USER="bluealsad"
COMMON_OPTS="--quiet --oknodo --pidfile $PIDFILE"

# Working configuration without low-quality HSP codecs
BA_OPTS="-S -p a2dp-source -p a2dp-sink -p hfp-ag -p hfp-hf -c sbc -c aac -c mp3 -c aptx -c aptx-hd -c faststream -c opus -c msbc -c lc3-swb"

# Ensure bluealsad user exists and has correct group membership
if ! id $USER >/dev/null 2>&1; then
    # Create user if it doesn't exist
    useradd -r -s /bin/false $USER
    usermod -a -G audio $USER
else
    # User exists, check if in audio group
    if ! id -nG $USER | grep -qw audio; then
        usermod -a -G audio $USER
    fi
fi

# Ensure storage directory exists with correct ownership
if [ ! -d "$STORAGE_DIR" ]; then
    mkdir -p "$STORAGE_DIR"
    chown $USER:$USER "$STORAGE_DIR"
    chmod 0700 "$STORAGE_DIR"
else
    # Directory exists, check ownership
    CURRENT_OWNER=$(stat -c "%U:%G" "$STORAGE_DIR")
    if [ "$CURRENT_OWNER" != "$USER:$USER" ]; then
        chown $USER:$USER "$STORAGE_DIR"
        chmod 0700 "$STORAGE_DIR"
    fi
fi

case "$1" in
  start)
    log_daemon_msg "Starting $DESC" "$NAME"
    start-stop-daemon $COMMON_OPTS --start --background \
        --make-pidfile --chuid $USER --exec $DAEMON -- $BA_OPTS
    log_end_msg $?
    ;;
  stop)
    log_daemon_msg "Stopping $DESC" "$NAME"
    start-stop-daemon $COMMON_OPTS --stop --retry 5
    log_end_msg $?
    ;;
  restart|force-reload)
    $0 stop
    $0 start
    ;;
  status)
    status_of_proc $DAEMON "$NAME" || exit $?
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
    exit 1
    ;;
esac

exit 0

Make it executable

chmod +x debdir/etc/init.d/bluealsad

Make a template

mkdir debian && echo -e "Source: bluez-alsa\nPackage: bluez-alsa\nDepends: \${shlibs:Depends}" >> debian/control 
$ cat debian/control
Source: bluez-alsa
Package: bluez-alsa
Depends: ${shlibs:Depends}

Run dpkg-shlibdeps to calculate dependencies

dpkg-shlibdeps -v -xbluez-alsa -ldebdir/usr/lib --ignore-missing-info -e $(find debdir/usr -type f 2>/dev/null) 
$ cat debian/substvars
shlibs:Depends=libasound2 (>= 1.1.7), libbluetooth3 (>= 4.91), libbsd0 (>= 0.0), libc6 (>= 2.34), libdbus-1-3 (>= 1.9.14), libfdk-aac2 (>= 2.0.1), libglib2.0-0 (>= 2.67.3), liblc3-0 (>= 1.0.1), libldacbt-abr2 (>= 2.0.2), libldacbt-enc2 (>= 2.0.2), libmp3lame0 (>= 3.100), libmpg123-0 (>= 1.28.0), libncurses6 (>= 6), libopus0 (>= 1.1), libreadline8 (>= 6.0), libsbc1 (>= 2.0), libspandsp2 (>= 0.0.6~pre18), libtinfo6 (>= 6)
install -vm0755 -d debdir/DEBIAN 

Create DEBIAN/control with a text editor

$ cat debdir/DEBIAN/control
Package: bluez-alsa
Version: 4.3.1-86
Architecture: amd64
Priority: optional
Section: utils
Source: bluez-alsa
Maintainer: Devuan
Installed-Size: 541 kB
Conflicts: bluez-alsa-utils, libasound2-plugin-bluez
Provides: bluez-alsa-utils (= 4.3.1-86), libasound2-plugin-bluez (= 4.3.1-86)
Replaces: bluez-alsa-utils, libasound2-plugin-bluez
Depends: libasound2 (>= 1.1.7), libbluetooth3 (>= 4.91), libbsd0 (>= 0.0), libc6 (>= 2.34), libdbus-1-3 (>= 1.9.14), libfdk-aac2 (>= 2.0.1), libglib2.0-0 (>= 2.67.3), liblc3-0 (>= 1.0.1), libldacbt-abr2 (>= 2.0.2), libldacbt-enc2 (>= 2.0.2), libmp3lame0 (>= 3.100), libmpg123-0 (>= 1.28.0), libncurses6 (>= 6), libopus0 (>= 1.1), libreadline8 (>= 6.0), libsbc1 (>= 2.0), libspandsp2 (>= 0.0.6~pre18), libtinfo6 (>= 6)
Homepage: https://github.com/Arkq/bluez-alsa
Description: Bluetooth Audio ALSA Backend (utils)
 Bluetooth Audio ALSA Backend allows bluetooth audio without PulseAudio and PipeWire.
 This package provides sysVinit script for bluealsad daemon to run it without systemd.   
.
This project is a rebirth of a direct integration between Bluez and ALSA.
Since Bluez >= 5, the build-in integration has been removed in favor of 3rd
party audio applications. From now on, Bluez acts as a middleware between an
audio application, which implements Bluetooth audio profile, and a Bluetooth
audio device.

Generate DEBIAN/md5sums

cd debdir && find . -type f -not -path "./DEBIAN/*" -exec md5sum {} + | sort -k 2 | sed 's/\.\/\(.*\)/\1/' > DEBIAN/md5sums
cd .. && chmod 0644 -- debdir/DEBIAN/md5sums 

Make a Debian package

fakeroot -- dpkg-deb -b debdir bluez-alsa_4.3.1-86_amd64.deb
$ fakeroot -- dpkg-deb -b debdir bluez-alsa_4.3.1-86_amd64.deb
dpkg-deb: building package 'bluez-alsa' in 'bluez-alsa_4.3.1-86_amd64.deb'.
$ ls *.deb
bluez-alsa_4.3.1-86_amd64.deb

Install

sudo dpkg -i bluez-alsa_4.3.1-86_amd64.deb

Configure the bluealsad service  to start automatically at system boot

sudo update-rc.d bluealsad defaults

Start the bluealsad service and check its status

sudo service bluealsad start
sudo service bluealsad status

If, for some strange reason, bluealsad fails to start, restart services in the correct order:

sudo service dbus restart
sudo service dbus status

sudo service bluetooth restart
sudo service bluetooth status

sudo service bluealsad restart
sudo service bluealsad status

Or simply reboot the system to ensure all services start in the proper sequence.

3. Pair and connect Bluetooth headphones using the Blueman Manager

$ apt-cache show blueman | grep Recommends:
Recommends: pulseaudio-module-bluetooth

It will install pulseaudio and/or pipewire. if they are not pinned.
The magic command apt-mark hold can fix the problem

sudo apt-mark hold pulseaudio* pipewire*
sudo apt install blueman
  1. Put Headphones in Pairing Mode:

  • Turn on your headphones and press/hold the power or Bluetooth button until an indicator light flashes (usually blue/red), showing they are discoverable.

  1. Launch Blueman Manager:

   blueman-manager
  • Search for Devices:

  • In the Blueman Manager window, click the "Search" button (or magnifying glass icon) to scan for devices.

  • Pair the Headphones:

  • When your headphones appear, right-click the device name.

  • Select Pair. Confirm the pairing request if a prompt appears (often within 20 seconds).

  • Right-click again and select Trust so they connect automatically next time.

  • Connect and Set Audio Output:

  • Right-click the device in Blueman and choose Connect

You can do the same with bluetoothctl

bluetoothctl scan on
bluetoothctl pair XX:XX:XX:XX:XX:XX
bluetoothctl trust XX:XX:XX:XX:XX:XX
bluetoothctl connect XX:XX:XX:XX:XX:XX 

Test:

alsamixer -D bluealsa
aplay -D bluealsa /usr/share/sounds/alsa/Front_Center.wav
$ bluealsactl status
Service: org.bluealsa
Version: v4.3.1-86-gf1e53d3
Adapters: hci0
Profiles:
  A2DP-source : SBC MP3 AAC aptX aptX-HD FastStream Opus
  A2DP-sink   : SBC MP3 AAC aptX aptX-HD FastStream Opus
  HFP-AG      : CVSD mSBC LC3-SWB
  HFP-HF      : CVSD mSBC LC3-SWB

Both aptX  and aptX-HD codecs support 16kHz, 32kHz, 44.1kHz, and 48kHz sample rates with BlueALSA.
The aptX-HD implementation in src/a2dp-aptx-hd.c includes:

  • Sample rate support for 16kHz, 32kHz, 44.1kHz, and 48kHz

  • 24-bit audio support

  • Encoder and decoder initialization functions

Tested with:
ASUS USB-BT540 Bluetooth 5.4 Dongle Adapter Compatible with Linux
Sennheiser HD 450BT
Specifications:

  • Bluetooth profiles: AVRCP, A2DP, HFP, HSP

  • Bluetooth Audio Codecs: AptX, AptX Low Latency, AAC, SBC

$ bluealsa-aplay -L
bluealsa:DEV=80:C3:BA:8B:B6:CC,PROFILE=sco,SRV=org.bluealsa
    HD 450BT, trusted audio-headphones, playback
    SCO (mSBC): S16_LE 1 channel 16000 Hz
bluealsa:DEV=80:C3:BA:8B:B6:CC,PROFILE=sco,SRV=org.bluealsa
    HD 450BT, trusted audio-headphones, capture
    SCO (mSBC): S16_LE 1 channel 16000 Hz
bluealsa:DEV=80:C3:BA:8B:B6:CC,PROFILE=a2dp,SRV=org.bluealsa
    HD 450BT, trusted audio-headphones, playback
    A2DP (aptX): S16_LE 2 channels 48000 Hz
$ bluealsa-aplay -l
**** List of PLAYBACK Bluetooth Devices ****
hci0: 80:C3:BA:8B:B6:CC [HD 450BT], trusted audio-headphones
  SCO (mSBC): S16_LE 1 channel 16000 Hz
  A2DP (aptX): S16_LE 2 channels 48000 Hz
**** List of CAPTURE Bluetooth Devices ****
hci0: 80:C3:BA:8B:B6:CC [HD 450BT], trusted audio-headphones
  SCO (mSBC): S16_LE 1 channel 16000 Hz

ALSA config for BlueALSA virtual PCM device

$ cat ~/.asoundrc
defaults.pcm.rate_converter "fftrate"

pcm.!default
{
    type    plug
    slave.pcm    "bluealsa"
    hint.description    "Default device"
}

MPV Player config:

$ cat ~/.config/mpv/mpv.conf
ao=alsa
alsa-resample=yes
alsa-buffer-time=160000
alsa-periods=4

Celluloid:

  • Open the Preferences menu.

  • Go to the Miscellaneous tab.

  • Enter mpv command-line options into the "Extra MPV Options" text box:

ao=alsa alsa-resample=yes alsa-buffer-time=160000 alsa-periods=4

Audacious:

  • go to Preferences → Audio → Buffer size

  • set 2000 ms

Firefox
about:config

media.cubeb.backend                    alsa
media.resampling.enabled            false
media.cubeb_latency_playback_ms        160

TEST:

$ mpv *.dsf
 (+) Audio --aid=1 (dsd_lsbf_planar 2ch 1411200Hz)
Input:  1411200 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 56448
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  1411200 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.
AO: [alsa] 1411200Hz stereo 2ch float
(Paused) AV: 00:00:30 / 00:04:35 (11%)
$ audacious 2>&1 *.dsf
Input:  1411200 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 352800
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 12000
Rates:  1411200 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.
$ MOZ_LOG="MediaDecoder:4,cubeb:5" stdbuf -oL firefox 2>&1 https://rutube.ru/video/4202a6f411ad55ea7f55e38f860e26bc/ | grep  --line-buffered -E "MetadataLoaded.*rate=|FirstFrameLoaded.*rate=|CubebStreamInit output stream rate|target rate|Output hardware|Input|Output|Rates" | grep -vE "hasVideo=0|hasAudio=0"
[Child 21800: Main Thread]: D/MediaDecoder MediaDecoder[7f5208797000] MetadataLoaded, channels=2 rate=44100 hasAudio=1 hasVideo=1
[Child 21800: Main Thread]: D/MediaDecoder MediaDecoder[7f5208797000] FirstFrameLoaded, channels=2 rate=44100 hasAudio=1 hasVideo=1 mPlayState=PLAY_STATE_LOADING transportSeekable=1
[Child 21800: MediaDecoderStateMachine #1]: I/cubeb CubebStreamInit output stream rate 44100
[Child 21800: MediaDecoderStateMachine #1]: I/cubeb CubebStreamInit output stream rate 44100
$ mpv 2>&1 rudra*
 (+) Audio --aid=1 (flac 2ch 44100Hz)
AO: [alsa] 44100Hz stereo 2ch s16
(Paused) A: 00:00:41 / 00:18:33 (4%)

It means that sample rate 44100Hz is indeed supported by aptX codec. That is why you do not see logs of fftrate, which is now the default ALSA resampler.
Buffer settings for aplayand arecord

aplay -F 40000 -B 160000 <.wav>
arecord -F 40000 -B 160000 <.wav>
$ aplay -F 40000 -B 160000 1_08*
Playing WAVE '1_08-Faust - Funeral March Of A Marionette - DSD256.dsf.wav' : Signed 32 bit Little Endian, Rate 1411200 Hz, Stereo
Input:  1411200 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 56448
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  1411200 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.

Full duplex with mSBC  codec 

$ arecord -F 40000 -B 160000 -D bluealsa:PROFILE=sco -V mono -f CD | aplay -F 40000 -B 160000 -D bluealsa:PROFILE=sco
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Input:  16000 Hz, 1 ch, 's16_le' (0x2): dummy = 0, period = 640
Output: 44100 Hz, 1 ch, 's16_le' (0x2): dummy = 0, period = 1764
Rates:  16000 --> 44100 (J: 0.00%, T: FFT, W: Vorbis)
Ok.

Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Input:  44100 Hz, 1 ch, 's16_le' (0x2): dummy = 0, period = 1764
Output: 16000 Hz, 1 ch, 's16_le' (0x2): dummy = 0, period = 640
Rates:  44100 --> 16000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.

#################################                 +| MAX

mSBC codec Playback/Capture devices:

**** PLAYBACK Bluetooth Device ****
hci0: 80:C3:BA:8B:B6:CC [HD 450BT], trusted audio-headphones
  SCO (mSBC): S16_LE 1 channel 16000 Hz
**** CAPTURE Bluetooth Device ****
hci0: 80:C3:BA:8B:B6:CC [HD 450BT], trusted audio-headphones
  SCO (mSBC): S16_LE 1 channel 16000 Hz

Last edited by igorzwx (2025-12-15 20:35:38)

Offline

#2 2025-12-15 04:17:25

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,558  

Re: BlueALSA without systemd

Note also that In excalibur bluez-alsa-utils provides bluealsa (without systemd dependency).

Offline

#3 2025-12-15 04:32:19

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

Re: BlueALSA without systemd

Can you post URL of the source package?

Offline

#4 2025-12-15 04:38:25

golinux
Administrator
Registered: 2016-11-25
Posts: 3,610  

Offline

#5 2025-12-15 04:40:59

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

Re: BlueALSA without systemd

https://pkginfo.devuan.org/cgi-bin/poli … .68.126.15

An error occurred while reading CGI reply (no response received)

Offline

#6 2025-12-15 05:17:45

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,558  

Re: BlueALSA without systemd

Yes try https://pkginfo.devuan.org/bluez-alsa-utils rather
(golinux' URL includes the AI bot distraction so it's not sharable)

Offline

#7 2025-12-15 05:29:53

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

Re: BlueALSA without systemd

It does not seem to contain any init script.
I have already enabled the stable repository:

$ apt source bluez-alsa-utils
Reading package lists... Done
Picking 'bluez-alsa' as source package instead of 'bluez-alsa-utils'
NOTICE: 'bluez-alsa' packaging is maintained in the 'Git' version control system at:
https://salsa.debian.org/bluetooth-team/bluez-alsa.git
Please use:
git clone https://salsa.debian.org/bluetooth-team/bluez-alsa.git
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 257 kB of source archives.
Get:1 http://deb.devuan.org/merged stable/main bluez-alsa 4.3.1-3 (dsc) [2,528 B]
Get:2 http://deb.devuan.org/merged stable/main bluez-alsa 4.3.1-3 (tar) [249 kB]
Get:3 http://deb.devuan.org/merged stable/main bluez-alsa 4.3.1-3 (diff) [6,076 B]
Fetched 257 kB in 0s (764 kB/s)       
dpkg-source: info: extracting bluez-alsa in bluez-alsa-4.3.1
dpkg-source: info: unpacking bluez-alsa_4.3.1.orig.tar.xz
dpkg-source: info: unpacking bluez-alsa_4.3.1-3.debian.tar.xz

The source package is from Debian repository, configured for systemd.

bluez-alsa-utils_4.3.1-3_amd64.deb

was compiled for systemd, it does not have any init script inside.

_https://pkginfo.devuan.org/cgi-bin/package-query.html?c=package&q=bluez-alsa-utils=4.3.1-3.1

Package: bluez-alsa-utils
Version: 4.3.1-3.1
Installed-Size: 521
Maintainer: Debian Bluetooth Maintainers <team+pkg-bluetooth@tracker.debian.org>

Content
/etc/alsa/conf.d/20-bluealsa.conf
/etc/default/bluez-alsa
/usr/bin/a2dpconf
/usr/bin/bluealsa-aplay
/usr/bin/bluealsa-cli
/usr/bin/bluealsa-rfcomm
/usr/bin/bluealsa
/usr/bin/hcitop
/usr/lib/systemd/system/bluealsa-aplay.service
/usr/lib/systemd/system/bluealsa.service
/usr/share/dbus-1/system.d/bluealsa.conf
/usr/share/doc/bluez-alsa-utils/changelog.Debian.gz
/usr/share/doc/bluez-alsa-utils/copyright
/usr/share/man/man1/bluealsa-aplay.1.gz
/usr/share/man/man1/bluealsa-cli.1.gz
/usr/share/man/man1/bluealsa-rfcomm.1.gz
/usr/share/man/man1/hcitop.1.gz
/usr/share/man/man8/bluealsa.8.gz

It should look like this:

/etc/init.d/bluealsa

In the git version, it is already renamed to "bluealsad"

Last edited by igorzwx (2025-12-15 05:41:43)

Offline

#8 2025-12-15 05:48:41

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,558  

Re: BlueALSA without systemd

I think bluealsa gets started via dbus, But I haven't explored it.

Offline

#9 2025-12-15 05:55:23

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

Re: BlueALSA without systemd

It was compiled with --enable-systemd   (see: debian/rules )

I have already recompiled the Debian source package.
It is outdated, and the codecs are outdated.
The git version is much better.

Last edited by igorzwx (2025-12-15 05:58:49)

Offline

#10 2025-12-15 06:04:57

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,558  

Re: BlueALSA without systemd

Thanks. Good advice. I'll probably look at doing that eventually.
(I'm not using my bluetooth headset much at the moment)

It could possibly be helpful to the debian maintainer of bluez-alsa-util to lodge a bug regarding outdated codecs. Especially if there is a patch included. I guess the packaging project is on salsa.debian.org.

Offline

#11 2025-12-15 06:11:14

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

Re: BlueALSA without systemd

What is the spec of your headset, is there something like this:

- Bluetooth codecs
- aptX™ Adaptive 
  aptX™ HD 
  aptX™ 
  AAC 
  SBC
- Bluetooth profiles
- A2DP 
  AVRCP 
  HFP

Debian default is low quality SBC codec.
With aptX codec, sound quality is much better.

libfreeaptx is outdated in the oldstable
_https://tracker.debian.org/pkg/libfreeaptx

git version;

$ freeaptxdec --help
aptX decoder utility 0.2.2 (using libfreeaptx 0.2.2)
This utility decodes aptX or aptX HD audio stream
from stdin to a raw 24 bit signed stereo on stdout 

he Debian source of bluez-alsa is outdated
_https://tracker.debian.org/pkg/bluez-alsa

The git version is now v4.3.1-86-gf1e53d3. It means that 86 bugs were fixed. In any case, everything was compiled.
All codecs available for Linux were compiled and enabled.

$ bluealsactl status
Service: org.bluealsa
Version: v4.3.1-86-gf1e53d3
Adapters: hci0
Profiles:
  A2DP-source : SBC MP3 AAC aptX aptX-HD FastStream Opus
  A2DP-sink   : SBC MP3 AAC aptX aptX-HD FastStream Opus
  HFP-AG      : CVSD mSBC LC3-SWB
  HFP-HF      : CVSD mSBC LC3-SWB

hsp codecs are not loaded with init script. They are of low quality: 8kHz sample rate.
The question is: which codecs are supported by your BT headphones?
What is your spec?

Sennheiser HD 450BT does have aptX-HD, but it has aptX

Specifications:

Bluetooth profiles: AVRCP, A2DP, HFP, HSP

Bluetooth Audio Codecs: AptX, AptX Low Latency, AAC, SBC

$ bluealsa-aplay -L
bluealsa:DEV=80:C3:BA:8B:B6:CC,PROFILE=sco,SRV=org.bluealsa
    HD 450BT, trusted audio-headphones, playback
    SCO (mSBC): S16_LE 1 channel 16000 Hz
bluealsa:DEV=80:C3:BA:8B:B6:CC,PROFILE=sco,SRV=org.bluealsa
    HD 450BT, trusted audio-headphones, capture
    SCO (mSBC): S16_LE 1 channel 16000 Hz
bluealsa:DEV=80:C3:BA:8B:B6:CC,PROFILE=a2dp,SRV=org.bluealsa
    HD 450BT, trusted audio-headphones, playback
    A2DP (aptX): S16_LE 2 channels 48000 Hz

Sennheiser HDB 630
_https://www.sennheiser-hearing.com/en-DE/p/hdb-630/
Specifications
Codec support
aptX™ Adaptive™, aptX™ HD, aptX™, AAC, SBC

Enjoy high resolution with support for aptX™ HD and aptX™ Adaptive, especially when paired with the included BTD 700 Bluetooth® USB C Dongle
For the purest signal, connect via USB C or analog input for lossless listening at up to 24 bit/96 kHz.
_https://www.sennheiser-hearing.com/en-DE/p/hdb-630/

Bowers & Wilkins Px7 S2e Bluetooth Wireless Headphones
_https://www.bowerswilkins.com/en-gb/product/over-ear-headphones/px7-s2e/FP44520P.html#specifications
Specifications
Bluetooth codecs
aptX™ Adaptive 
aptX™ HD
aptX™ 
AAC 
SBC

SBC is a basic low quality codec.
aptX Adaptive is not available for Linux.

AAC in BlueALSA uses the fdk-aac library from Fraunhofer IIS, which is not completely free software.
The fdk-aac library is under Fraunhofer license which:
    Is free for non-commercial use
    Requires licensing for commercial applications
    Has patent encumbrances in some countries
You may try high quality options: --aac-afterburner --aac-bitrate=320000 --aac-true-bps

# without -c aptx -c aptx-hd
BA_OPTS="-S -p a2dp-source -p a2dp-sink -p hfp-ag -p hfp-hf -c sbc -c aac -c mp3 -c faststream -c opus -c msbc -c lc3-swb -c ldac --aac-afterburner --aac-bitrate=320000 --aac-true-bps"

AAC codec supports 8 kHz to 96 kHz including 44.1kHz and  48kHz.

While BlueALSA's automatic selection is limited to 48kHz, the codecs themselves support higher rates. For example, AAC supports up to 96kHz.
You can manually select higher sample rates using:

bluealsactl codec -r96000 PCM_PATH aac
bluealsactl list-pcms

Sennheiser HD 450BT does not support 96kHz sample rate with AAC codec, but it has analog audio cable with 3.5mm jack plug. It is much better than any Bluetooth codec.

Last edited by igorzwx (Today 13:14:02)

Offline

#12 2025-12-15 12:03:41

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

Re: BlueALSA without systemd

There is, one might say, a slight oversight in the Debian bluez-alsa package: it runs as root, which is a bit like giving the keys to the house to someone just to borrow the kettle. Should a flaw exist — and history suggests they often do — it could be exploited with elevated consequences.

The good news? This doesn’t affect Devuan at all. The package simply doesn’t work without systemd, so it sits there, harmless and inert — like a very quiet paperweight.

So while Debian’s setup is perhaps more trusting than strictly necessary, Devuan users are, by design, not involved in the drama.

Offline

#13 2025-12-15 22:40:26

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,558  

Re: BlueALSA without systemd

I guess you won't be interested but as you may know, the action path for Devuan would be for a maintainer to set up a fork project (at git.devuan.org) to sort out its utility in Devuan. I anyhow invite you to take on that role for this package (as well as fftrate packages if you like).

Offline

#14 2025-12-16 15:14:25

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

Re: BlueALSA without systemd

1. The package is not needed.
2. It is easy to compile.

The Devuan consumer community want to consume knowledge rather than packages. You should not keep them in ignorance.

Knowledge and only knowledge liberates, and absolute knowledge liberates absolutely.
Isaiah Berlin, Four Essays on Liberty (1969).

How to Create a Debian Package Release Bundle

Download sourcedir:

mkdir BUILD3 && cd BUILD3 
git clone https://github.com/arkq/bluez-alsa.git 
cd bluez-alsa && export DEBFULLNAME="John Frum" 

Install a template:

dh_make --createorig -p bluez-alsa_4.3.1-86 -c apache -e my@mail.org -s 

1. debian/control

If you have libfreeaptx-dev installed, replace "libfreeaptx" with "libfreeaptx-dev" in Build-Depends. If you compiled libfreeaptx from git, leave it as is.

$ cat debian/control
Source: bluez-alsa
Section: libs
Priority: optional
Maintainer: John Frum <my@mail.org>
Rules-Requires-Root: no
Build-Depends:
 debhelper-compat (= 13),
	dh-exec,
	libasound2-dev,
	libbluetooth-dev (>= 5.0),
	libdbus-1-dev (>= 1.6),
	libfreeaptx,
	libglib2.0-dev (>= 2.30),
	libsbc-dev (>= 1.2),
	liblc3-dev,
	libldacbt-enc-dev (>= 2.0.0) [!hppa !m68k !powerpc !ppc64 !s390x !sparc64],
	libldacbt-abr-dev (>= 2.0.0) [!hppa !m68k !powerpc !ppc64 !s390x !sparc64],
	libmp3lame-dev,
	libmpg123-dev,
	libspandsp-dev,
	libopus-dev,
	libbsd-dev,
	libreadline-dev,
	check,
	dbus-daemon <!nocheck>,
	python3-docutils,
	pkgconf
Standards-Version: 4.6.2
Homepage: https://github.com/Arkq/bluez-alsa
#Vcs-Browser: https://salsa.debian.org/debian/bluez-alsa
#Vcs-Git: https://salsa.debian.org/debian/bluez-alsa.git

Package: bluez-alsa
Architecture: linux-any
Multi-Arch: same
Section: libs
Depends:
 ${shlibs:Depends},
 ${misc:Depends},
Conflicts: bluez-alsa-utils, libasound2-plugin-bluez
Provides: bluez-alsa-utils (= 4.3.1-86-1), libasound2-plugin-bluez (= 4.3.1-86-1)
Replaces: bluez-alsa-utils, libasound2-plugin-bluez
Description: Bluetooth Audio ALSA Backend 
 Bluetooth Audio ALSA Backend allows bluetooth audio without PulseAudio and PipeWire.
 This package provides sysVinit script for bluealsad daemon to run it without systemd.   
 .
 This project is a rebirth of a direct integration between Bluez and ALSA.
 Since Bluez >= 5, the build-in integration has been removed in favor of 3rd
 party audio applications. From now on, Bluez acts as a middleware between an
 audio application, which implements Bluetooth audio profile, and a Bluetooth
 audio device.

2. debian/rules

$ cat debian/rules
#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.
#export DH_VERBOSE = 1

# See FEATURE AREAS in dpkg-buildflags(1).
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# See ENVIRONMENT in dpkg-buildflags(1).
# Package maintainers to append CFLAGS.
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# Package maintainers to append LDFLAGS.
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@ --with autoreconf

# dh_make generated override targets.
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
#override_dh_auto_configure:
#	dh_auto_configure -- \
#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
override_dh_auto_configure:
	dh_auto_configure --  --prefix=/usr --sysconfdir=/etc --with-bluealsaduser=bluealsad --enable-ldac --with-libfreeaptx --enable-aptx  --enable-aptx-hd --enable-faststream --enable-lc3-swb --enable-mp3lame --enable-mpg123 --enable-msbc --enable-ofono --enable-midi --enable-opus --enable-upower --enable-rfcomm --enable-a2dpconf --enable-hcitop --enable-test --enable-aac --enable-manpages --disable-systemd 

override_dh_installinit:
	dh_installinit --name=bluealsad

override_dh_shlibdeps: 
	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
	

3. debian/bluez-alsa.bluealsad.init

$ cat cat debian/bluez-alsa.bluealsad.init
cat: cat: No such file or directory
#!/bin/sh

### BEGIN INIT INFO
# Provides:          bluealsa
# Required-Start:    dbus $syslog $local_fs $remote_fs bluetooth
# Required-Stop:     dbus $syslog $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: BlueALSA daemon
# Description:       Bluetooth ALSA audio daemon
### END INIT INFO

. /lib/lsb/init-functions

NAME=bluealsad
DESC="BlueALSA daemon"
DAEMON=/usr/bin/$NAME
PIDFILE="/var/run/$NAME.pid"
STORAGE_DIR="/var/lib/bluealsa"
USER="bluealsad"
COMMON_OPTS="--quiet --oknodo --pidfile $PIDFILE"

# Working configuration without low-quality HSP codecs
BA_OPTS="-S -p a2dp-source -p a2dp-sink -p hfp-ag -p hfp-hf -c sbc -c aac -c mp3 -c aptx -c aptx-hd -c faststream -c opus -c msbc -c lc3-swb"

# Ensure bluealsad user exists and has correct group membership
if ! id $USER >/dev/null 2>&1; then
    # Create user if it doesn't exist
    useradd -r -s /bin/false $USER
    usermod -a -G audio $USER
else
    # User exists, check if in audio group
    if ! id -nG $USER | grep -qw audio; then
        usermod -a -G audio $USER
    fi
fi

# Ensure storage directory exists with correct ownership
if [ ! -d "$STORAGE_DIR" ]; then
    mkdir -p "$STORAGE_DIR"
    chown $USER:$USER "$STORAGE_DIR"
    chmod 0700 "$STORAGE_DIR"
else
    # Directory exists, check ownership
    CURRENT_OWNER=$(stat -c "%U:%G" "$STORAGE_DIR")
    if [ "$CURRENT_OWNER" != "$USER:$USER" ]; then
        chown $USER:$USER "$STORAGE_DIR"
        chmod 0700 "$STORAGE_DIR"
    fi
fi

case "$1" in
  start)
    log_daemon_msg "Starting $DESC" "$NAME"
    start-stop-daemon $COMMON_OPTS --start --background \
        --make-pidfile --chuid $USER --exec $DAEMON -- $BA_OPTS
    log_end_msg $?
    ;;
  stop)
    log_daemon_msg "Stopping $DESC" "$NAME"
    start-stop-daemon $COMMON_OPTS --stop --retry 5
    log_end_msg $?
    ;;
  restart|force-reload)
    $0 stop
    $0 start
    ;;
  status)
    status_of_proc $DAEMON "$NAME" || exit $?
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
    exit 1
    ;;
esac

exit 0
chmod +x debian/bluez-alsa.bluealsad.init 

Create Debian source package

dpkg-source -b . 

Build Debian package

dpkg-buildpackage -us -uc 
$ cd .. && ls -1 *.deb
bluez-alsa_4.3.1-86-1_amd64.deb
bluez-alsa-dbgsym_4.3.1-86-1_amd64.deb 

Install

sudo dpkg -i bluez-alsa_4.3.1-86-1_amd64.deb 

In bureaucratic terms, you have a complete Debian package upload set or package release bundle:

$ ls -1
bluez-alsa
bluez-alsa_4.3.1-86-1_amd64.buildinfo
bluez-alsa_4.3.1-86-1_amd64.changes
bluez-alsa_4.3.1-86-1_amd64.deb
bluez-alsa_4.3.1-86-1.debian.tar.xz
bluez-alsa_4.3.1-86-1.dsc
bluez-alsa_4.3.1-86.orig.tar.xz
bluez-alsa-dbgsym_4.3.1-86-1_amd64.deb 

This includes:

Source files (.dsc, .orig.tar.xz, .debian.tar.xz)
Binary packages (.deb)
Debug symbols (.dbgsym.deb)
Build metadata (.buildinfo)
Changes file (.changes) — the key control file listing all others
The .changes file defines the full set, used by Debian archive tools (like dak) to process uploads into a repository.

Configure the bluealsad service to start automatically at system boot

sudo update-rc.d bluealsad defaults 
$ sudo service bluealsad restart
Stopping BlueALSA daemon: bluealsad.
Starting BlueALSA daemon: bluealsad. 
$ sudo service bluealsad status
bluealsad is running. 

See also:
_https://dev1galaxy.org/viewtopic.php?id=7671

Ah, the --with-bluealsaduser=bluealsad option — very sensible. Lets you run the daemon as a dedicated user, which is ever so slightly less daft than letting it run as root. Keeps things tidy, limits the carnage if something goes wrong. Think of it as giving your Bluetooth audio a sensible hat and a laminated badge — still can’t stop it from misbehaving entirely, but at least it’s not running the whole show.

If you don’t specify a user, it defaults to root, which works — until it doesn’t. And when used with older BlueZ versions (≤ 5.50), just make sure your chosen user’s in the "bluetooth" group, or it’ll sulk and refuse to connect. Nothing dramatic — just typical Linux passive aggression.

Last edited by igorzwx (2025-12-16 21:16:36)

Offline

#15 2025-12-16 16:12:30

greenjeans
Member
Registered: 2017-04-07
Posts: 1,367  
Website

Re: BlueALSA without systemd

I guess you won't be interested but as you may know, the action path for Devuan would be for a maintainer to set up a fork project (at git.devuan.org) to sort out its utility in Devuan. I anyhow invite you to take on that role for this package (as well as fftrate packages if you like).

I agree 100%, I think Igor would be the perfect candidate to maintain packages like fftrate.  He's certainly knowledgeable about all things ALSA, and you've already done the hard part for fftrate.

C'mon Igor, step up to the plate bro! Ralph's rolling out the red carpet for ya and Devuan is clearly onboard with all this amazing work being done in ALSA these days, we can all make a real difference in how sound is dealt with in Linux. big_smile


https://sourceforge.net/projects/vuu-do/ New Vuu-do isos uploaded October 2025!
Vuu-do GNU/Linux, minimal Devuan-based Openbox and Mate systems to build on. Also a max version for OB.
Devuan 5 mate-mini iso, pure Devuan, 100% no-vuu-do. wink Devuan 6 version also available for testing.
Please donate to support Devuan and init freedom! https://devuan.org/os/donate

Offline

#16 2025-12-16 17:24:42

igorzwx
Member
Registered: 2024-05-06
Posts: 431  

Re: BlueALSA without systemd

If nobody wants to maintain it, it's not needed. 
If nobody can maintain it, it doesn't make sense.

Offline

Board footer