Bluetooth does not start if system boots from USB

Bug #1929791 reported by taras.if.ua

This bug report will be marked for expiration in 45 days if no further activity occurs. (find out why)

10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux-raspi2 (Ubuntu)
Invalid
Undecided
Unassigned
pi-bluetooth (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

Hello! I have a strange bug with Bluetooth on Raspberry Pi 4 8Gb and Ubuntu 21.04 (also had it on Ubuntu 20.10). It's internal Bluetooth adapder does not initialize, if I boot system from USB, wherein does not matter what I am using: 16 Gb USB Flash Drive, 2 Tb External USB HDD or 1 Tb External SSD. After system boot up, it shows me "no Bluetooth adapters found", hcidev also shows nothing. I'm getting hciuart.service error:
===================
taras@taras-rpi:~$ systemctl status hciuart.service
● hciuart.service - Configure Bluetooth Modems connected by UART
     Loaded: loaded (/lib/systemd/system/hciuart.service; enabled; vendor prese>
     Active: failed (Result: exit-code) since Thu 2021-05-27 08:22:57 EEST; 3mi>
    Process: 599 ExecStart=/usr/bin/btuart (code=exited, status=1/FAILURE)

тра 27 08:22:46 taras-rpi systemd[1]: Starting Configure Bluetooth Modems conne>
тра 27 08:22:57 taras-rpi btuart[631]: Initialization timed out.
тра 27 08:22:57 taras-rpi btuart[631]: bcm43xx_init
тра 27 08:22:57 taras-rpi btuart[631]: Flash firmware /lib/firmware/brcm/BCM434>
тра 27 08:22:57 taras-rpi btuart[631]: Set Controller UART speed to 3000000 bit>
тра 27 08:22:57 taras-rpi systemd[1]: hciuart.service: Control process exited, >
тра 27 08:22:57 taras-rpi systemd[1]: hciuart.service: Failed with result 'exit>
тра 27 08:22:57 taras-rpi systemd[1]: Failed to start Configure Bluetooth Modem>
===================
But if I continue reboot system, it may appear in 1-2 cases from 10. It'v very strange.
If I disable this service manually via:
===================
sudo systemctl disable hciuart.service
===================
restart the system and run:
===================
sudo systemctl start hciuart.service
===================
Bluetooth adapter will appear in 100% cases. And if I boot Ubuntu from microSD card, everything works properly, Bluetooth starts all times. I thought, mb here is not enougth power for USB devices. I've bought USB hub with external power, but it does not help.
Must say, that I don't have this problem on Raspberry Pi OS, I have it on USB HDD too and it works without any problems.
Any suggestions?

description: updated
Revision history for this message
Alex Kurichenko (alexander-kurichenko) wrote :

I got the same bug.
If hciuart.service was started before /dev/serial1 is created, it fails.
Fixed by adding systemd override with "Requires" directive:

# systemctl cat hciuart
# /lib/systemd/system/hciuart.service
[Unit]
Description=Configure Bluetooth Modems connected by UART
ConditionFileNotEmpty=/proc/device-tree/soc/gpio@7e200000/bt_pins/brcm,pins
After=dev-serial1.device

[Service]
Type=forking
ExecStart=/usr/bin/btuart

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/hciuart.service.d/override.conf
[Unit]
Requires=dev-serial1.device <---- fix of this problem

----
Here's what documentation says:

After=: The units listed in this directive will be started before starting the current unit. This does not imply a dependency relationship and one must be established through the above directives if this is required.

Requires=: This directive lists any units upon which this unit essentially depends. If the current unit is activated, the units listed here must successfully activate as well, else this unit will fail. These units are started in parallel with the current unit by default.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in linux-raspi2 (Ubuntu):
status: New → Confirmed
Juerg Haefliger (juergh)
Changed in linux-raspi2 (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Dave Jones (waveform) wrote :

I haven't managed to reproduce this on several systems (pi4 booting from USB, pi5 booting from NVMe, etc). Setting to incomplete until anyone can come up with a firm reproduction case.

Changed in pi-bluetooth (Ubuntu):
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.