RPi-Distro / pi-bluetooth

Loads BCM43430A1 firmware on boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hciuart.service failed because the control process exited with error code

drankinatty opened this issue · comments

I'm not entirely sure this is a direct pi-blutooth bug, so I apologize if this isn't the right project, but beginning with 0.1.16 release on raspberry pi 3 with rasbain/Buster, on pi-bluetooth upgrade I now get the following failures noted in the terminal:

Job for hciuart.service failed because the control process exited with error code.
See "systemctl status hciuart.service" and "journalctl -xe" for details.

Checking the journal related to hciuart, I see:

May 21 00:24:54 raspberryz systemd[1]: hciuart.service: Dependency Before=bluetooth.device ignored (.device units cannot be delayed)
May 21 00:24:56 raspberryz systemd[1]: hciuart.service: Dependency Before=bluetooth.device ignored (.device units cannot be delayed)
May 21 19:05:16 raspberryz systemd[1]: Stopping Configure Bluetooth Modems connected by UART...
May 21 19:05:18 raspberryz systemd[1]: hciuart.service: Succeeded.
May 21 19:05:18 raspberryz systemd[1]: Stopped Configure Bluetooth Modems connected by UART.
May 21 19:05:18 raspberryz systemd[1]: Starting Configure Bluetooth Modems connected by UART...
May 21 19:05:48 raspberryz btuart[12649]: Initialization timed out.
May 21 19:05:48 raspberryz btuart[12649]: bcm43xx_init
May 21 19:05:48 raspberryz systemd[1]: hciuart.service: Control process exited, code=exited, status=1/FAILURE
May 21 19:05:48 raspberryz systemd[1]: hciuart.service: Failed with result 'exit-code'.
May 21 19:05:48 raspberryz systemd[1]: Failed to start Configure Bluetooth Modems connected by UART.
May 21 19:05:49 raspberryz systemd[1]: Starting Configure Bluetooth Modems connected by UART...
May 21 19:06:19 raspberryz btuart[12700]: Initialization timed out.
May 21 19:06:19 raspberryz btuart[12700]: bcm43xx_init
May 21 19:06:19 raspberryz systemd[1]: hciuart.service: Control process exited, code=exited, status=1/FAILURE
May 21 19:06:19 raspberryz systemd[1]: hciuart.service: Failed with result 'exit-code'.
May 21 19:06:19 raspberryz systemd[1]: Failed to start Configure Bluetooth Modems connected by UART.

I have 2 raspberry Pi 3 (one 3+) with the Pi 3 being flawless (no errors at all) since Jessie was installed, and the 3+ flawless since the original Buster install. The only additional packages installed in recent history were:

gpsd gpsd-clients libbluetooth3 libgps-dev libgps23 python-gps

So bottom line. Now, hciuart fails on pi-bluetooth update (or start on boot, etc..). I have searched and there are some threads that claim the errors are harmless and should be ignored, but they were not present earlier. So I am submitting here. If this isn't the correct location, just let me know. Also, If you need additional information or details, let me know and I'll be happy to get it for you.

0.1.17 was released yesterday. Please update and report back.

Oh, I'm sorry, the log entries I provided for May 21 corresponded to the install of 0.1.17. The terminal lines before the hciuart errors were:

Preparing to unpack .../pi-bluetooth_0.1.17_all.deb ...
Unpacking pi-bluetooth (0.1.17) over (0.1.16) ...
Setting up pi-bluetooth (0.1.17) ...
Job for hciuart.service failed because the control process exited with error code.
See "systemctl status hciuart.service" and "journalctl -xe" for details.

Please do a full reboot, run this command and post the contents of btlog.txt:

$ grep -i -E "(bt|blue|\bhci)" /var/log/syslog | tail -100 > btlog.txt

Here are the logs from each Pi. First the P3:

$ cat btlog.txt
May 22 18:37:18 raspberrypi systemd[1]: Removed slice system-bthelper.slice.
May 22 18:37:27 raspberrypi systemd[1]: Starting Configure Bluetooth Modems connected by UART...
May 22 18:37:31 raspberrypi kernel: [   15.746924] Bluetooth: Core ver 2.22
May 22 18:37:31 raspberrypi kernel: [   15.747033] Bluetooth: HCI device and connection manager initialized
May 22 18:37:31 raspberrypi kernel: [   15.749560] Bluetooth: HCI socket layer initialized
May 22 18:37:31 raspberrypi kernel: [   15.749580] Bluetooth: L2CAP socket layer initialized
May 22 18:37:31 raspberrypi kernel: [   15.749608] Bluetooth: SCO socket layer initialized
May 22 18:37:31 raspberrypi kernel: [   15.773175] Bluetooth: HCI UART driver ver 2.3
May 22 18:37:31 raspberrypi kernel: [   15.773191] Bluetooth: HCI UART protocol H4 registered
May 22 18:37:31 raspberrypi kernel: [   15.773279] Bluetooth: HCI UART protocol Three-wire (H5) registered
May 22 18:37:31 raspberrypi btuart[375]: bcm43xx_init
May 22 18:37:31 raspberrypi btuart[375]: Flash firmware /lib/firmware/brcm/BCM43430A1.hcd
May 22 18:37:31 raspberrypi btuart[375]: Set BDADDR UART: b8:27:eb:cd:d2:66
May 22 18:37:31 raspberrypi btuart[375]: Set Controller UART speed to 921600 bit/s
May 22 18:37:31 raspberrypi btuart[375]: Device setup complete
May 22 18:37:31 raspberrypi kernel: [   15.775015] Bluetooth: HCI UART protocol Broadcom registered
May 22 18:37:31 raspberrypi systemd[1]: Started Configure Bluetooth Modems connected by UART.
May 22 18:37:31 raspberrypi systemd[1]: Created slice system-bthelper.slice.
May 22 18:37:31 raspberrypi systemd[1]: Starting Raspberry Pi bluetooth helper...
May 22 18:37:32 raspberrypi bthelper[813]: Can't init device hci0: Operation not possible due to RF-kill (132)
May 22 18:37:32 raspberrypi systemd[1]: bthelper@hci0.service: Main process exited, code=exited, status=1/FAILURE
May 22 18:37:32 raspberrypi systemd[1]: bthelper@hci0.service: Failed with result 'exit-code'.
May 22 18:37:32 raspberrypi systemd[1]: Failed to start Raspberry Pi bluetooth helper.
May 22 18:37:32 raspberrypi systemd[1]: Starting Bluetooth service...
May 22 18:37:32 raspberrypi bluetoothd[816]: Bluetooth daemon 5.50
May 22 18:37:32 raspberrypi systemd[1]: Started Bluetooth service.
May 22 18:37:32 raspberrypi systemd[1]: Reached target Bluetooth.
May 22 18:37:32 raspberrypi bluetoothd[816]: Starting SDP server
May 22 18:37:32 raspberrypi bluetoothd[816]: Excluding (cli) sap
May 22 18:37:32 raspberrypi kernel: [   16.084252] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
May 22 18:37:32 raspberrypi kernel: [   16.084273] Bluetooth: BNEP filters: protocol multicast
May 22 18:37:32 raspberrypi kernel: [   16.084384] Bluetooth: BNEP socket layer initialized
May 22 18:37:32 raspberrypi dbus-daemon[384]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.27' (uid=0 pid=816 comm="/usr/lib/bluetooth/bluetoothd --noplugin=sap ")
May 22 18:37:32 raspberrypi bluetoothd[816]: Bluetooth management interface 1.18 initialized
May 22 18:37:32 raspberrypi bluetoothd[816]: Failed to set mode: Blocked through rfkill (0x12)

And now from the Pi 3+:

$ cat btlog.txt
May 22 18:37:14 raspberryz systemd[1]: Removed slice system-bthelper.slice.
May 22 18:37:21 raspberryz systemd[1]: Starting Configure Bluetooth Modems connected by UART...
May 22 18:37:29 raspberryz kernel: [   18.873939] Bluetooth: Core ver 2.22
May 22 18:37:29 raspberryz kernel: [   18.874077] Bluetooth: HCI device and connection manager initialized
May 22 18:37:29 raspberryz kernel: [   18.874182] Bluetooth: HCI socket layer initialized
May 22 18:37:29 raspberryz kernel: [   18.874205] Bluetooth: L2CAP socket layer initialized
May 22 18:37:29 raspberryz kernel: [   18.874236] Bluetooth: SCO socket layer initialized
May 22 18:37:29 raspberryz kernel: [   18.893806] Bluetooth: HCI UART driver ver 2.3
May 22 18:37:29 raspberryz kernel: [   18.893864] Bluetooth: HCI UART protocol H4 registered
May 22 18:37:29 raspberryz kernel: [   18.894453] Bluetooth: HCI UART protocol Three-wire (H5) registered
May 22 18:37:29 raspberryz kernel: [   18.894878] Bluetooth: HCI UART protocol Broadcom registered
May 22 18:37:29 raspberryz btuart[358]: bcm43xx_init
May 22 18:37:29 raspberryz btuart[358]: Flash firmware /lib/firmware/brcm/BCM4345C0.hcd
May 22 18:37:29 raspberryz btuart[358]: Set BDADDR UART: b8:27:eb:33:d1:c8
May 22 18:37:29 raspberryz btuart[358]: Set Controller UART speed to 3000000 bit/s
May 22 18:37:29 raspberryz btuart[358]: Device setup complete
May 22 18:37:29 raspberryz systemd[1]: Started Configure Bluetooth Modems connected by UART.
May 22 18:37:29 raspberryz systemd[1]: Created slice system-bthelper.slice.
May 22 18:37:29 raspberryz systemd[1]: Starting Raspberry Pi bluetooth helper...
May 22 18:37:29 raspberryz bthelper[865]: Raspberry Pi BDADDR already set
May 22 18:37:29 raspberryz systemd[1]: Started Raspberry Pi bluetooth helper.
May 22 18:37:29 raspberryz systemd[1]: Starting Bluetooth service...
May 22 18:37:29 raspberryz bluetoothd[877]: Bluetooth daemon 5.50
May 22 18:37:29 raspberryz systemd[1]: Started Bluetooth service.
May 22 18:37:29 raspberryz systemd[1]: Reached target Bluetooth.
May 22 18:37:29 raspberryz bluetoothd[877]: Starting SDP server
May 22 18:37:29 raspberryz bluetoothd[877]: Excluding (cli) sap
May 22 18:37:29 raspberryz dbus-daemon[360]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.20' (uid=0 pid=877 comm="/usr/lib/bluetooth/bluetoothd --noplugin=sap ")
May 22 18:37:29 raspberryz bluetoothd[877]: Bluetooth management interface 1.18 initialized
May 22 18:37:29 raspberryz kernel: [   19.237201] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
May 22 18:37:29 raspberryz kernel: [   19.237213] Bluetooth: BNEP filters: protocol multicast
May 22 18:37:29 raspberryz kernel: [   19.237229] Bluetooth: BNEP socket layer initialized
May 22 18:37:30 raspberryz bluetoothd[877]: Failed to set privacy: Rejected (0x0b)
May 22 18:37:34 raspberryz bthelper[865]: Changing power off succeeded
May 22 18:37:34 raspberryz bthelper[865]: Changing power on succeeded

Strange that there logs are slightly different, the first on the Pi3 where bthelper fails, then on Pi3+ were bluetoothd complains about a permissions/privacy issue. It almost looks like the boot sequence ordering is different between the two boxes, though I have been through /etc/systemd/system/... with a fine-toothed comb and ensured they are the same.

I'm happy to send anything else you need. Just let me know and post it as soon as I can.

May 22 18:37:32 raspberrypi bthelper[813]: Can't init device hci0: Operation not possible due to RF-kill (132)

Something (probably the user) has disabled Bluetooth, using either the lxpanel Bluetooth plugin or the rfkill command line utility.

Well, that one on the Pi 3 was easy enough to fix -- I wonder what dummy did that.... (I plead the 5th)

The privacy failure is on the list of things to investigate, but I'm not aware of it causing real problems. Are you saying that Bluetooth is not working on the 3B+?

Bluetooth seems to be up and running fine. It is more of an annoyance error that I don't know what is causing it and whether I should be worried. From the searches I did before opening this ticket, it looks like it isn't hurting anything. Here is the status of bluetooth on the 3+:

● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2021-05-22 18:37:29 CDT; 2 days ago
     Docs: man:bluetoothd(8)
 Main PID: 877 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 2062)
   CGroup: /system.slice/bluetooth.service
           └─877 /usr/lib/bluetooth/bluetoothd --noplugin=sap

May 22 18:37:29 raspberryz systemd[1]: Starting Bluetooth service...
May 22 18:37:29 raspberryz bluetoothd[877]: Bluetooth daemon 5.50
May 22 18:37:29 raspberryz systemd[1]: Started Bluetooth service.
May 22 18:37:29 raspberryz bluetoothd[877]: Starting SDP server
May 22 18:37:29 raspberryz bluetoothd[877]: Excluding (cli) sap
May 22 18:37:29 raspberryz bluetoothd[877]: Bluetooth management interface 1.18 initialized
May 22 18:37:30 raspberryz bluetoothd[877]: Failed to set privacy: Rejected (0x0b)

So bluetooth is up and running. If this is just one of those annoying errors that isn't really hurting anything, then it can stay on the "get around to it" list and doesn't need immediate attention. I just noticed it and didn't know why it was there and checked and there wasn't an open ticket. Just making sure it doesn't slip though the cracks.

It's literally on my to do list, but I don't know when it might get some attention.

I' having the same problem. Any fix for this?
I got this error when updating immediately after flashing 2021-05-07-raspios-buster-armhf-lite.img.

Setting up pi-bluetooth (0.1.17) ...
Job for hciuart.service failed because the control process exited with error code.
See "systemctl status hciuart.service" and "journalctl -xe" for details.
Job for hciuart.service failed because the control process exited with error code.
See "systemctl status hciuart.service" and "journalctl -xe" for details.
pi@raspberrypi:~ $ sudo systemctl status hciuart.service --no-pager --full
● hciuart.service - Configure Bluetooth Modems connected by UART
   Loaded: loaded (/lib/systemd/system/hciuart.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2021-05-30 15:12:15 BST; 3min 7s ago
  Process: 344 ExecStart=/usr/bin/btuart (code=exited, status=0/SUCCESS)
 Main PID: 445 (hciattach)
    Tasks: 1 (limit: 2062)
   CGroup: /system.slice/hciuart.service
           └─445 /usr/bin/hciattach /dev/serial1 bcm43xx 3000000 flow - b8:27:eb:c3:3a:6b

May 30 15:12:08 raspberrypi systemd[1]: Starting Configure Bluetooth Modems connected by UART...
May 30 15:12:15 raspberrypi btuart[344]: bcm43xx_init
May 30 15:12:15 raspberrypi btuart[344]: Flash firmware /lib/firmware/brcm/BCM4345C0.hcd
May 30 15:12:15 raspberrypi btuart[344]: Set BDADDR UART: b8:27:eb:c3:3a:6b
May 30 15:12:15 raspberrypi btuart[344]: Set Controller UART speed to 3000000 bit/s
May 30 15:12:15 raspberrypi btuart[344]: Device setup complete
May 30 15:12:15 raspberrypi systemd[1]: Started Configure Bluetooth Modems connected by UART.
pi@raspberrypi:~ $ sudo systemctl status bluetooth --no-pager --full
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2021-05-30 15:12:16 BST; 3min 35s ago
     Docs: man:bluetoothd(8)
 Main PID: 459 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 2062)
   CGroup: /system.slice/bluetooth.service
           └─459 /usr/lib/bluetooth/bluetoothd

May 30 15:12:15 raspberrypi systemd[1]: Starting Bluetooth service...
May 30 15:12:16 raspberrypi bluetoothd[459]: Bluetooth daemon 5.50
May 30 15:12:16 raspberrypi systemd[1]: Started Bluetooth service.
May 30 15:12:16 raspberrypi bluetoothd[459]: Starting SDP server
May 30 15:12:16 raspberrypi bluetoothd[459]: Bluetooth management interface 1.18 initialized
May 30 15:12:16 raspberrypi bluetoothd[459]: Sap driver initialization failed.
May 30 15:12:16 raspberrypi bluetoothd[459]: sap-server: Operation not permitted (1)
May 30 15:12:16 raspberrypi bluetoothd[459]: Failed to set privacy: Rejected (0x0b)

Known issue, on the maintainers "to be fixed" list. Other than generating the error, there isn't a per-se failure. If you are not using sap, simply disable it to eliminate the error. See SAP error on bluetooth service status

Yeah, BT isn't working when this error intermittently occurs (about 80% of the boots on my Pi4). It seems to be a race condition because it'll always work when I restart the service at the prompt. So I've disabled the service (sudo systemctl disable hciuart.service) and then restart the service after booting. My children have a retropie setup, so in its autostart.sh file, before it runs emulationstation, I have the command sudo systemctl restart hciuart.service. Works as a flawless bandaid until this is resolved.

also getting this straight out of the box after a clean image....

commented

same issue here. raspberry pi 4 with retropie (and bluetooth controllers), one of the latest updates made it not working any more until I start hciservice manually: sudo systemctl start hciuart

Any help or hints?

Thank you!

commented

Yeah, BT isn't working when this error intermittently occurs (about 80% of the boots on my Pi4). It seems to be a race condition because it'll always work when I restart the service at the prompt. So I've disabled the service (sudo systemctl disable hciuart.service) and then restart the service after booting. My children have a retropie setup, so in its autostart.sh file, before it runs emulationstation, I have the command sudo systemctl restart hciuart.service. Works as a flawless bandaid until this is resolved.

thank you - this one works for me as well. :-)

The issue still persists.

commented

@hkayann contrary my last comment, the issue was not reliable solved.
I used now systemd edit to add an override for the affected service, and just restart it on failure. with this the issue is completely gone for me.
the content of /etc/systemd/system/hciuart.service.d/override.conf :

[Unit]
StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Restart=on-failure
RestartSec=5

Best regards

The problem still persists on Raspberry Pi OS (Debian bullseye) 64bit. The --noplugin=sap flag removed the SAP error msg, but hciuart.service still fails to start occasionally. Sometimes it works without problems, sometimes the said error occurs and bluetooth won't be available in this case.

$sudo systemctl status hciuart.service
● hciuart.service - Configure Bluetooth Modems connected by UART
     Loaded: loaded (/lib/systemd/system/hciuart.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2023-02-11 12:08:05 CET; 41min ago
    Process: 422 ExecStart=/usr/bin/btuart (code=exited, status=1/FAILURE)
        CPU: 191ms

Feb 11 12:07:18 raspberrypi systemd[1]: Starting Configure Bluetooth Modems connected by UART...
Feb 11 12:08:06 raspberrypi btuart[481]: Initialization timed out.
Feb 11 12:08:06 raspberrypi btuart[481]: bcm43xx_init
Feb 11 12:08:06 raspberrypi btuart[481]: Flash firmware /lib/firmware/brcm/BCM4345C0.hcd
Feb 11 12:08:05 raspberrypi systemd[1]: hciuart.service: Control process exited, code=exited, status=1/FAILURE
Feb 11 12:08:05 raspberrypi systemd[1]: hciuart.service: Failed with result 'exit-code'.
Feb 11 12:08:05 raspberrypi systemd[1]: Failed to start Configure Bluetooth Modems connected by UART.

In addition - also hardly understandable - systemd-rfkill.service cannot be started and throws an error msg during boot process.

$sudo systemctl status systemd-rfkill.service
● systemd-rfkill.service - Load/Save RF Kill Switch Status
      Loaded: loaded (/lib/systemd/system/systemd-rfkill.service; static)
      Active: inactive (dead) since Sat 2023-02-11 12:08:05 CET; 16min ago
TriggeredBy: ● systemd-rfkill.socket
        Docs: man:systemd-rfkill.service(8)
     Process: 320 ExecStart=/lib/systemd/systemd-rfkill (code=exited, status=0/SUCCESS)
    Main PID: 320 (code=exited, status=0/SUCCESS)
         CPU: 42ms

Feb 11 12:07:17 raspberrypi systemd[1]: Starting Load/Save RF Kill Switch Status...
Feb 11 12:07:17 raspberrypi systemd[1]: Started Load/Save RF Kill Switch Status.
Feb 11 12:08:05 raspberrypi systemd[1]: systemd-rfkill.service: Succeeded.

The fact that rfkill.service does not start does not depend on whether WiFi and Bluetooth are activated or not. I've tried both options. It occurs even on a freshly installed system. Not always but often.

The entire boot process is mostly painfully slow and starting the GUI with startx can take minutes until the desktop is available. However, sometimes, although rarely, the system boots within 30 seconds.
I usually boot without a GUI since the Raspberry Pi (4) runs headless in normal operation, but every once in a while I need the VNC connection to transfer files in bidirectional.

I didn't have these problems with 'buster'. What has happened there?

but every once in a while I need the VNC connection to transfer files in bidirectional.

You do not need VNC for this. Please have a look at SFTP. Here is a link from quick google search.

but every once in a while I need the VNC connection to transfer files in bidirectional.

You do not need VNC for this. Please have a look at SFTP. [...]

This is completely irrelevant to the problem I'm describing. I only mentioned that in passing.

You might want to try with dtparam=krnbt in config.txt, which gives the task of initialising the BT modem to the kernel. This is likely to become the default in the future.

dtparam=krnbt

That seems to work. Thank you for the suggestion.

After adding this to /boot/config.txt and rebooting I had file system errors and the system was inaccessible so I had to turn off the power. I've seen that before too. The errors occur quite randomly and it is difficult to understand what the causes are. I'm using an SSD and maybe the USB connection is causing some issues, although it shouldn't be. But that's probably a different issue, among other things (e.g. the login manager cannot be started) and it doesn't belong in this thread I think.

I then started the system and there were no errors.