A Brief But Accurate Documentation, BSD Linux And Programming

 Docker

Saturday, October 31, 2026

Ubuntu Bluetooth Speaker failed to reconnect after waking up from sleep

 First things first, we need to create a local service.

Just type it in the terminal

sudo nano /etc/systemd/system/headset-resume.service


Copy the entire script into it

Note that you have to change the Bluetooth MAC Address to your speaker.


[Unit]

Description=Force connect Bluetooth headset on resume

After=suspend.target


[Service]

Type=oneshot

# Wait for 3 seconds for device to power on

ExecStartPre=/bin/sleep 3

#  Force the mac address speaker

ExecStart=/usr/bin/bluetoothctl connect 34:CB:B9:BA:2B:F4


[Install]

WantedBy=suspend.target



Save and exit from Nano

Activate the scrip

sudo systemctl daemon-reload

then

sudo systemctl enable headset-resume.service

This will force the device to reconnect your speaker by the MAC address

Test it to sleep, it should be working by now. thanks for myself

No comments:

Post a Comment

Back to top