I managed to succesfully pair my Raspberry Pi Zero 2W with my android phone via bluetoothctl but I cannot get it to connect on startup.
*@raspberrypi:~ $ uname -a Linux raspberrypi 5.15.74-v7+ #1595 SMP Wed Oct 26 11:03:05 BST 2022 armv7l GNU/Linux*
systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-11-05 10:18:21 GMT; 2 days ago
Docs: man:bluetoothd(8)
Main PID: 592 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 407)
CPU: 161ms
CGroup: /system.slice/bluetooth.service
└─592 /usr/libexec/bluetooth/bluetoothd
Nov 05 10:18:21 bluetoothd[592]: sap-server: Operation not permitted (1)
Nov 05 10:18:21 bluetoothd[592]: Endpoint registered: sender=:1.24 path=/MediaEndpoint/A2DPSink/sbc
Nov 05 10:18:21 bluetoothd[592]: Endpoint registered: sender=:1.24 path=/MediaEndpoint/A2DPSource/sbc
Nov 05 10:18:21 bluetoothd[592]: Failed to set privacy: Rejected (0x0b)
Nov 05 10:18:23 bluetoothd[592]: bnep0 connected
Nov 05 10:18:26 bluetoothd[592]: bnep0 disconnected
Nov 05 10:47:57 bluetoothd[592]: Endpoint registered: sender=:1.46 path=/MediaEndpoint/A2DPSink/sbc
Nov 05 10:47:57 bluetoothd[592]: Endpoint registered: sender=:1.46 path=/MediaEndpoint/A2DPSource/sbc
Nov 05 10:47:57 bluetoothd[592]: src/profile.c:ext_start_servers() RFCOMM server failed for Headset Voice gateway: rfcomm_bind: Address already in use (98)
Nov 05 10:47:57 bluetoothd[592]: src/profile.c:ext_start_servers() RFCOMM server failed for Headset unit: rfcomm_bind: Address already in use (98)*
If I issues this command in terminal it connects with tethering fully working with an IP so i can ssh in via my phone.
sudo bt-network -c MAC nap
I tried getting this going via a script using cron but still the same it connects and then disconnects straight away.
cron command
@reboot sh /usr/local/bin/blue.sh
script was
#!/bin/sh
sudo bt-network -c MAC nap
I also tried system which works but again it disconnects 2 seconds later.
[Unit]
Description=Bluetooth connect
[Service]
ExecStart=/usr/bin/bt-network -c MAC nap
[Install]
WantedBy=multi-user.target
I have also tried this way from the post below but no IP is givena nd tethering doesnt work either.
https://raspberrypi.stackexchange.com/questions/29504/how-can-i-set-up-a-bluetooth-pan-connection-with-a-raspberry-pi-and-an-ipod/
Tethering isnt massivly important as I will only be logging in to issue shutdown commands and to stop kismet any help is greatly appreciated.