This guide explains how to configure Ubuntu 24.04 to act as a Bluetooth Serial Port (SPP) server to receive data from the ABCommander app.
sudo apt update
sudo apt install bluez bluez-tools
sudo nano /lib/systemd/system/bluetooth.serviceExecStart line to: ExecStart=/usr/libexec/bluetooth/bluetoothd --compatsudo systemctl daemon-reload && sudo systemctl restart bluetoothsudo chmod 777 /var/run/sdp (repeat after restart).Ubuntu’s ModemManager often “hijacks” serial ports, causing “Address already in use” errors.
sudo systemctl stop ModemManager
Create a script with these contents for a clean connection:
#!/bin/bash
echo "--- Resetting Bluetooth Stack ---"
sudo pkill -9 rfcomm
sudo rfcomm release all
sudo hciconfig hci0 down
sudo hciconfig hci0 up
sudo sdptool add --channel=4 SP
echo "Waiting for connection on CHANNEL 4..."
sudo rfcomm listen 10 4 # Uses /dev/rfcomm10
Follow these steps exactly to ensure a successful connection without “Address already in use” errors:
sudo systemctl stop ModemManager./ble_listen.sh in Terminal A.
Waiting for connection on channel 4.cat command yet.Connection from [MAC] to /dev/rfcomm10Status: Connected to... and the button should say Disconnect.sudo cat /dev/rfcomm10
1_ON will appear in Terminal B.Ctrl+C to stop cat.Ctrl+C and run sudo rfcomm release all before the next test.sudo rfcomm release all and ensure no cat or tail processes are running on /dev/rfcomm*./dev/rfcomm10) failed to initialize. Restart the script.