site  contact  subhomenews

Fix bluetoothd endless restarting

April 25, 2024 — BarryK

In 2020 I posted about using the 'restarter' utility in /etc/init.d/bluetooth, to immediately restart 'bluetoothd' if it crashes:

https://bkhome.org/news/202011/xf86-input-wacom-and-restarter-compiled-in-oe.html

Yes, well, the worst has happened. Testing the latest QV, I observed /tmp/bootsysinit.log being endlessly appended, like this:

...
restarter[8300]: Executing [79]: (/usr/sbin/bluetoothd)
restarter[8604]: Starting [/usr/sbin/bluetoothd] with pid:8604
D-Bus setup failed: Name already in use
restarter[8603]: [8603]:sigchildhdl_GetExitStatus SIGCHLD handler, child_pid:8604, waitpid returned:8604, exit_reason:process exited, exit status=1, child exit status:256, signal:17, nchildren now:0
exit_valid:(), cmd_exitstatus2:1
[8603]: Exiting

restarter[8300]: Executing [80]: (/usr/sbin/bluetoothd)
restarter[8606]: Starting [/usr/sbin/bluetoothd] with pid:8606
D-Bus setup failed: Name already in use
restarter[8605]: [8605]:sigchildhdl_GetExitStatus SIGCHLD handler, child_pid:8606, waitpid returned:8606, exit_reason:process exited, exit status=1, child exit status:256, signal:17, nchildren now:0
exit_valid:(), cmd_exitstatus2:1
[8605]: Exiting
...

I do not know of a fix for this. 'bluetoothd' is still flakey and can crash. Just restarting it causes that dbus problem and it immediately crashes. I didn't have this problem with EasyOS, or perhaps I just didn't notice it.

So, have taken out 'restarter':

https://github.com/bkauler/woof-quantum-vis/commit/ac472ff697184ffaf3d48e6c6ff432b8d03f0577

However, 'restarter' does work, at least sometimes, without going into that endless loop. Now, if it crashes, that's it, you will have to manually restart it, by "/etc/init.d/bluetoothd start" -- and I hope that it doesn't hit that dbus problem.

It would be good if 'restarter' could set a limit on how many restarts. Oh, and it is not just a QV problem; do a search on "bluetoothd d-bus setup failed: name already in use" will return a lot of hits.      

Tags: quirky